WIP: Rigify - modifier keys on Rig Layers buttons #104998

Draft
Paolo Acampora wants to merge 6 commits from PaoloAcampora/rigify-ui-improvements:panel_modifier_keys into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit abc18dbb80 - Show all commits

View File

@ -203,7 +203,7 @@ def should_skip_bone(bone: Bone):
class BoneMultiSelect(bpy.types.PropertyGroup):
bone_name: bpy.props.StringProperty(name="")
bone_name: bpy.props.StringProperty(name="bone_name")
do_select: bpy.props.BoolProperty(name="select")
# =============================================
@ -256,7 +256,7 @@ class RIGIFY_OT_display_select_group(bpy.types.Operator):
action: EnumProperty(items=(('VIS_TOGGLE', 'TOGGLE', 'Toggle visibility'),
('TOGGLE_SELECT', 'SELECT', 'Toggle selection'),
('UNSELECT', 'UNSELECT', 'Remove from selection'),
('MENU', 'MENU', 'Display Menu')),
('DETAIL', 'DETAIL', 'Select bones individually')),
default='VIS_TOGGLE')
@classmethod
@ -269,7 +269,7 @@ class RIGIFY_OT_display_select_group(bpy.types.Operator):
elif event.ctrl:
self.action = 'UNSELECT'
elif event.alt:
self.action = 'MENU'
self.action = 'DETAIL'
else:
self.action = 'VIS_TOGGLE'
@ -292,19 +292,19 @@ class RIGIFY_OT_display_select_group(bpy.types.Operator):
elif self.action == 'UNSELECT':
for bone in coll.bones:
bone.select = False
elif self.action == 'MENU':
elif self.action == 'DETAIL':
context.object.data.collections.active = coll
bpy.ops.wm.call_panel(name=RIGIFY_PT_select_active_group_bones.bl_idname)
bpy.ops.wm.call_panel(name=RIGIFY_PT_active_group_selection.bl_idname)
else:
coll.is_visible = not coll.is_visible
return {'FINISHED'}
class RIGIFY_OT_select_prefix_bones(bpy.types.Operator):
class RIGIFY_OT_prefix_bone_selection(bpy.types.Operator):
"""Select armature bone"""
bl_idname = "object.rigify_select_prefix_bones"
bl_idname = "object.rigify_prefix_bone_selection"
bl_label = "Select collection bone from menu"
bl_options = {'REGISTER', 'UNDO'}
@ -343,9 +343,9 @@ class RIGIFY_OT_select_prefix_bones(bpy.types.Operator):
# UI Panel
# noinspection PyPep8Naming
class RIGIFY_PT_select_active_group_bones(bpy.types.Panel):
"""Display Panel"""
bl_idname = "object.rigify_active_group_select_bones"
class RIGIFY_PT_active_group_selection(bpy.types.Panel):
"""Display Panel for selecting bones of the active collection"""
bl_idname = "VIEW3D_PT_active_group_selection"
bl_label = "Select Bone"
bl_options = {'INSTANCED'}
@ -401,7 +401,7 @@ class RIGIFY_PT_select_active_group_bones(bpy.types.Panel):
continue
if bone.name in prefix_bones:
col.operator(RIGIFY_OT_select_prefix_bones.bl_idname, text=bone.name, icon='TRIA_RIGHT').prefix = bone.name
col.operator(RIGIFY_OT_prefix_bone_selection.bl_idname, text=bone.name, icon='TRIA_RIGHT').prefix = bone.name
else:
col.prop(bone, 'select', text=bone.name, toggle=True, expand=True)
@ -412,7 +412,7 @@ class RIGIFY_PT_select_active_group_bones(bpy.types.Panel):
if is_pose_bone_all_locked(pose_bones[bone.name]):
continue
if bone.name in prefix_bones:
col.operator(RIGIFY_OT_select_prefix_bones.bl_idname, text=bone.name, icon='TRIA_RIGHT').prefix = bone.name
col.operator(RIGIFY_OT_prefix_bone_selection.bl_idname, text=bone.name, icon='TRIA_RIGHT').prefix = bone.name
else:
col.prop(bone, 'select', text=bone.name, toggle=True, expand=True)
@ -700,8 +700,8 @@ classes = (
RIGIFY_OT_action_create,
RIGIFY_OT_jump_to_action_slot,
RIGIFY_OT_display_select_group,
RIGIFY_OT_select_prefix_bones,
RIGIFY_PT_select_active_group_bones,
RIGIFY_OT_prefix_bone_selection,
RIGIFY_PT_active_group_selection,
RIGIFY_UL_action_slots,
DATA_PT_rigify_actions,
)