Fix: GPv3: Flip primary and secondary toggle and shortcut missing

The `paint.brush_colors_flip` option was not exposed in the vertex color
panel.

This adds the toggle in the panel and also adds the keymap `X` to flip
the colors.
This commit is contained in:
Falk David
2024-10-04 14:48:09 +02:00
parent 9433ffe80a
commit e848bcdbbe
3 changed files with 11 additions and 3 deletions

View File

@@ -3745,7 +3745,8 @@ def km_grease_pencil_paint_mode(params):
# Show/hide
*_template_items_hide_reveal_actions("grease_pencil.layer_hide", "grease_pencil.layer_reveal"),
# Flip primary and secondary color
("paint.brush_colors_flip", {"type": 'X', "value": 'PRESS'}, None),
("paint.sample_color", {"type": 'X', "value": 'PRESS', "shift": True}, None),
# Isolate Layer
@@ -4021,6 +4022,9 @@ def km_grease_pencil_vertex_paint(params):
{"properties": [("data_path", "scene.tool_settings.use_gpencil_vertex_select_mask_stroke")]}),
("wm.context_toggle", {"type": 'THREE', "value": 'PRESS'},
{"properties": [("data_path", "scene.tool_settings.use_gpencil_vertex_select_mask_segment")]}),
# Flip primary and secondary color
("paint.brush_colors_flip", {"type": 'X', "value": 'PRESS'}, None),
# Radial controls
*_template_paint_radial_control("gpencil_vertex_paint"),
# Context menu

View File

@@ -8586,8 +8586,7 @@ class TOPBAR_PT_grease_pencil_vertex_color(Panel):
UnifiedPaintPanel.prop_unified_color(sub_row, context, brush, "color", text="")
UnifiedPaintPanel.prop_unified_color(sub_row, context, brush, "secondary_color", text="")
# TODO
# sub_row.operator("gpencil.tint_flip", icon='FILE_REFRESH', text="")
sub_row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
row = layout.row(align=True)
row.template_ID(paint, "palette", new="palette.new")

View File

@@ -1062,6 +1062,11 @@ static bool brush_colors_flip_poll(bContext *C)
if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_SCULPT)) {
return true;
}
if (blender::ed::greasepencil::grease_pencil_painting_poll(C) ||
blender::ed::greasepencil::grease_pencil_vertex_painting_poll(C))
{
return true;
}
}
}
return false;