Fix T59450: brush colors flip inactive w/ texture paint
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user