From e848bcdbbe4a9a7547206f7e2197a2e4d8e8d89f Mon Sep 17 00:00:00 2001 From: Falk David Date: Fri, 4 Oct 2024 14:48:09 +0200 Subject: [PATCH] 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. --- scripts/presets/keyconfig/keymap_data/blender_default.py | 6 +++++- scripts/startup/bl_ui/space_view3d.py | 3 +-- source/blender/editors/sculpt_paint/paint_image.cc | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/presets/keyconfig/keymap_data/blender_default.py b/scripts/presets/keyconfig/keymap_data/blender_default.py index 86949d40fd1..d619af49576 100644 --- a/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -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 diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index 567fd51423c..c60b3f8cecc 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -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") diff --git a/source/blender/editors/sculpt_paint/paint_image.cc b/source/blender/editors/sculpt_paint/paint_image.cc index b32f48647b9..0a0db55bd26 100644 --- a/source/blender/editors/sculpt_paint/paint_image.cc +++ b/source/blender/editors/sculpt_paint/paint_image.cc @@ -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;