[Bf-blender-cvs] [b4bb9d59ee7] master: Fix T59450: brush colors flip inactive w/ texture paint
Campbell Barton
noreply at git.blender.org
Tue Jan 8 13:26:31 CET 2019
Commit: b4bb9d59ee7b6e962738df630a1c77b44b70aa36
Author: Campbell Barton
Date: Tue Jan 8 23:24:38 2019 +1100
Branches: master
https://developer.blender.org/rBb4bb9d59ee7b6e962738df630a1c77b44b70aa36
Fix T59450: brush colors flip inactive w/ texture paint
===================================================================
M source/blender/editors/sculpt_paint/paint_image.c
===================================================================
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)
More information about the Bf-blender-cvs
mailing list