Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-01-08 15:24:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-08 15:25:36 +0300
commitb4bb9d59ee7b6e962738df630a1c77b44b70aa36 (patch)
treedd15d5aebe83c8db7b43aa393e6e5fb5ccb1e679 /source/blender/editors/sculpt_paint/paint_image.c
parent152c965b75f3ccc3b50301555cb9b1a2ee679193 (diff)
Fix T59450: brush colors flip inactive w/ texture paint
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index b8ac4403e1d..04941e36455 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1177,20 +1177,12 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
- UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
+ Scene *scene = CTX_data_scene(C);
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
- Object *ob = CTX_data_active_object(C);
- Brush *br;
- if (!(ob && (ob->mode & OB_MODE_VERTEX_PAINT))) {
- br = image_paint_brush(C);
- }
- else {
- /* At the moment, wpaint does not support the color flipper.
- * So for now we're only handling vpaint */
- ToolSettings *ts = CTX_data_tool_settings(C);
- VPaint *vp = ts->vpaint;
- br = BKE_paint_brush(&vp->paint);
- }
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Paint *paint = BKE_paint_get_active(scene, view_layer);
+ Brush *br = BKE_paint_brush(paint);
if (ups->flag & UNIFIED_PAINT_COLOR) {
swap_v3_v3(ups->rgb, ups->secondary_rgb);
@@ -1208,15 +1200,17 @@ 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)
- return 1;
+ return true;
}
else {
Object *ob = CTX_data_active_object(C);
- if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) {
- return 1;
+ if (ob != NULL) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
+ return true;
+ }
}
}
- return 0;
+ return false;
}
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)