diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-03-08 17:53:38 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-03-11 16:36:22 +0300 |
commit | 4302342287b56e6b47930eec7db55625c3589327 (patch) | |
tree | 3be6e6b6096f39018c33f1e58bad76237018abd8 /source/blender/editors | |
parent | f60896454929080ae775a7143c30722788ab83df (diff) |
Fix T62359: Flip colors for Fill Tool missing
Reviewers: brecht
Maniphest Tasks: T62359
Differential Revision: https://developer.blender.org/D4486
Diffstat (limited to 'source/blender/editors')
4 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 9101f65dc05..5e3d01d7f6a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -585,8 +585,12 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke) else { if (pop->mode == PAINT_MODE_2D) { float color[3]; - - srgb_to_linearrgb_v3_v3(color, BKE_brush_color_get(scene, brush)); + if (paint_stroke_inverted(stroke)) { + srgb_to_linearrgb_v3_v3(color, BKE_brush_secondary_color_get(scene, brush)); + } + else { + srgb_to_linearrgb_v3_v3(color, BKE_brush_color_get(scene, brush)); + } paint_2d_bucket_fill(C, color, brush, pop->prevmouse, pop->custom_paint); } else { @@ -1196,7 +1200,7 @@ static bool brush_colors_flip_poll(bContext *C) { if (image_paint_poll(C)) { Brush *br = image_paint_brush(C); - if (br->imagepaint_tool == PAINT_TOOL_DRAW) + if (ELEM(br->imagepaint_tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL)) return true; } else { diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index f8a2259d4a5..d712d0671f8 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5367,7 +5367,7 @@ static void paint_proj_stroke_ps( ps->blend = IMB_BLEND_ERASE_ALPHA; /* handle gradient and inverted stroke color here */ - if (ps->tool == PAINT_TOOL_DRAW) { + if (ELEM(ps->tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL)) { paint_brush_color_get(scene, brush, false, ps->mode == BRUSH_STROKE_INVERT, distance, pressure, ps->paint_color, NULL); if (ps->use_colormanagement) { srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); @@ -5376,15 +5376,6 @@ static void paint_proj_stroke_ps( copy_v3_v3(ps->paint_color_linear, ps->paint_color); } } - else if (ps->tool == PAINT_TOOL_FILL) { - copy_v3_v3(ps->paint_color, BKE_brush_color_get(scene, brush)); - if (ps->use_colormanagement) { - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); - } - else { - copy_v3_v3(ps->paint_color_linear, ps->paint_color); - } - } else if (ps->tool == PAINT_TOOL_MASK) { ps->stencil_value = brush->weight; diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 8363145ee07..5b86fc02979 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -81,6 +81,7 @@ int paint_stroke_modal(struct bContext *C, struct wmOperator *op, const struct w int paint_stroke_exec(struct bContext *C, struct wmOperator *op); void paint_stroke_cancel(struct bContext *C, struct wmOperator *op); bool paint_stroke_flipped(struct PaintStroke *stroke); +bool paint_stroke_inverted(struct PaintStroke *stroke); struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke); void *paint_stroke_mode_data(struct PaintStroke *stroke); float paint_stroke_distance_get(struct PaintStroke *stroke); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 2af6a4db3ee..a782ca9a5ec 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1365,6 +1365,11 @@ bool paint_stroke_flipped(struct PaintStroke *stroke) return stroke->pen_flip; } +bool paint_stroke_inverted(struct PaintStroke *stroke) +{ + return stroke->stroke_mode == BRUSH_STROKE_INVERT; +} + float paint_stroke_distance_get(struct PaintStroke *stroke) { return stroke->stroke_distance; |