From a1e50cfe6b4dbc360b6118c63a0dc7445023c37b Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Mon, 23 Dec 2019 12:46:05 +0300 Subject: Weight Paint: add a pie menu for locking and unlocking vertex groups. Provide different options for locking and unlocking vertex groups using bone selection, accessible via a pie menu triggered via the 'K' hotkey. To implement a variety of operations, extend the old operator with a new option to mask it by bone selection. If the X Mirror option is enabled, selection is automatically mirrored. This follows D6533 as the next step in improving accessibility of vertex group locking during weight painting. Differential Revision: https://developer.blender.org/D6618 --- .../keyconfig/keymap_data/blender_default.py | 1 + .../scripts/startup/bl_ui/properties_data_mesh.py | 9 ++++-- release/scripts/startup/bl_ui/space_view3d.py | 34 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) (limited to 'release') diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 3f5b7917f9c..cd531119155 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -3869,6 +3869,7 @@ def km_weight_paint(params): {"properties": [("data_path", 'weight_paint_object.data.use_paint_mask_vertex')]}), ("wm.context_toggle", {"type": 'S', "value": 'PRESS', "shift": True}, {"properties": [("data_path", 'tool_settings.weight_paint.brush.use_smooth_stroke')]}), + op_menu_pie("VIEW3D_MT_wpaint_vgroup_lock_pie", {"type" : 'K', "value": 'PRESS'}), *_template_items_context_panel("VIEW3D_PT_paint_weight_context_menu", params.context_menu_event), ]) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 3edce6b3b52..d6aa986613d 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -55,9 +55,12 @@ class MESH_MT_vertex_group_context_menu(Menu): layout.operator("object.vertex_group_remove", text="Delete All Unlocked Groups").all_unlocked = True layout.operator("object.vertex_group_remove", text="Delete All Groups").all = True layout.separator() - layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All").action = 'LOCK' - layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="UnLock All").action = 'UNLOCK' - layout.operator("object.vertex_group_lock", text="Lock Invert All").action = 'INVERT' + props = layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All") + props.action, props.mask = 'LOCK', 'ALL' + props = layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="UnLock All") + props.action, props.mask = 'UNLOCK', 'ALL' + props = layout.operator("object.vertex_group_lock", text="Lock Invert All") + props.action, props.mask = 'INVERT', 'ALL' class MESH_MT_shape_key_context_menu(Menu): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 537a4a4761a..cffa52c8052 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5020,6 +5020,39 @@ class VIEW3D_MT_sculpt_mask_edit_pie(Menu): op.auto_iteration_count = False +class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu): + bl_label = "Vertex Group Locks" + + def draw(self, _context): + layout = self.layout + pie = layout.menu_pie() + + # 1: Left + op = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All") + op.action, op.mask = 'LOCK', 'ALL' + # 2: Right + op = pie.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock All") + op.action, op.mask = 'UNLOCK', 'ALL' + # 3: Down + op = pie.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock Selected") + op.action, op.mask = 'UNLOCK', 'SELECTED' + # 4: Up + op = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Selected") + op.action, op.mask = 'LOCK', 'SELECTED' + # 5: Up/Left + op = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Unselected") + op.action, op.mask = 'LOCK', 'UNSELECTED' + # 6: Up/Right + op = pie.operator("object.vertex_group_lock", text="Lock Only Selected") + op.action, op.mask = 'LOCK', 'INVERT_UNSELECTED' + # 7: Down/Left + op = pie.operator("object.vertex_group_lock", text="Lock Only Unselected") + op.action, op.mask = 'UNLOCK', 'INVERT_UNSELECTED' + # 8: Down/Right + op = pie.operator("object.vertex_group_lock", text="Invert Locks") + op.action, op.mask = 'INVERT', 'ALL' + + # ********** Panel ********** @@ -7090,6 +7123,7 @@ classes = ( VIEW3D_MT_orientations_pie, VIEW3D_MT_proportional_editing_falloff_pie, VIEW3D_MT_sculpt_mask_edit_pie, + VIEW3D_MT_wpaint_vgroup_lock_pie, VIEW3D_PT_active_tool, VIEW3D_PT_active_tool_duplicate, VIEW3D_PT_view3d_properties, -- cgit v1.2.3