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