UI: Weight Paint: add a menu for locking and unlocking vertex groups.

This is a follow up on rBa1e50cfe6b4dbc360b6118c63a0dc7445023c37b
This commit is contained in:
Aaron Carlisle 2020-03-20 20:04:11 -04:00
parent 9607e54985
commit a22cd6b6a9
1 changed files with 29 additions and 0 deletions

View 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,