UI: Weight Paint: add a menu for locking and unlocking vertex groups.
authorAaron Carlisle <carlisle.b3d@gmail.com>
Sat, 21 Mar 2020 00:04:11 +0000 (20:04 -0400)
committerAaron Carlisle <carlisle.b3d@gmail.com>
Sat, 21 Mar 2020 00:07:42 +0000 (20:07 -0400)
This is a follow up on rBa1e50cfe6b4dbc360b6118c63a0dc7445023c37b

release/scripts/startup/bl_ui/space_view3d.py

index a2bfd711c04361afa064360dfc390fca551440b9..0d51bef0d8d67c1671e1d96db054c128e1abd3b0 100644 (file)
@@ -2939,6 +2939,32 @@ class VIEW3D_MT_gpencil_vertex_group(Menu):
             layout.operator("gpencil.vertex_group_deselect", text="Deselect")
 
 
+class VIEW3D_MT_paint_weight_lock(Menu):
+    bl_label = "Vertex Group Locks"
+
+    def draw(self, _context):
+        layout = self.layout
+
+        op = layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All")
+        op.action, op.mask = 'LOCK', 'ALL'
+        op = layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock All")
+        op.action, op.mask = 'UNLOCK', 'ALL'
+        op = layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Selected")
+        op.action, op.mask = 'LOCK', 'SELECTED'
+        op = layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock Selected")
+        op.action, op.mask = 'UNLOCK', 'SELECTED'
+        op = layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Unselected")
+        op.action, op.mask = 'LOCK', 'UNSELECTED'
+        op = layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock Unselected")
+        op.action, op.mask = 'UNLOCK', 'UNSELECTED'
+        op = layout.operator("object.vertex_group_lock", text="Lock Only Selected")
+        op.action, op.mask = 'LOCK', 'INVERT_UNSELECTED'
+        op = layout.operator("object.vertex_group_lock", text="Lock Only Unselected")
+        op.action, op.mask = 'UNLOCK', 'INVERT_UNSELECTED'
+        op = layout.operator("object.vertex_group_lock", text="Invert Locks")
+        op.action, op.mask = 'INVERT', 'ALL'
+
+
 class VIEW3D_MT_paint_weight(Menu):
     bl_label = "Weights"
 
@@ -2980,6 +3006,8 @@ class VIEW3D_MT_paint_weight(Menu):
 
             layout.operator("paint.weight_set")
 
+        layout.menu("VIEW3D_MT_paint_weight_lock", text="Locks")
+
     def draw(self, _context):
         self.draw_generic(self.layout, is_editmode=False)
 
@@ -7302,6 +7330,7 @@ classes = (
     VIEW3D_MT_vertex_group,
     VIEW3D_MT_gpencil_vertex_group,
     VIEW3D_MT_paint_weight,
+    VIEW3D_MT_paint_weight_lock,
     VIEW3D_MT_sculpt,
     VIEW3D_MT_sculpt_set_pivot,
     VIEW3D_MT_mask,