WIP: Rigify - modifier keys on Rig Layers buttons #104998
@ -699,6 +699,19 @@ def register():
|
|||||||
id_store.rigify_types = CollectionProperty(type=RigifyName)
|
id_store.rigify_types = CollectionProperty(type=RigifyName)
|
||||||
id_store.rigify_active_type = IntProperty(name="Rigify Active Type",
|
id_store.rigify_active_type = IntProperty(name="Rigify Active Type",
|
||||||
description="The selected rig type")
|
description="The selected rig type")
|
||||||
|
id_store.rigify_layers_mode = EnumProperty(
|
||||||
|
name="Layer Buttons Mode",
|
||||||
|
items=(
|
||||||
|
("OPERATOR", "Keys", "Accept key combinations with click (No drag click)", 'EVENT_SPACEKEY', 0),
|
||||||
|
("PROPERTY", "Drag", "Allow drag click (No key combinations)", 'MOUSE_LMB_DRAG', 1),
|
||||||
|
),
|
||||||
|
default="OPERATOR",
|
||||||
|
description="Choose between modifier keys or drag click"
|
||||||
|
)
|
||||||
|
id_store.rigify_layers_info = BoolProperty(
|
||||||
|
name="Display Layer Info",
|
||||||
|
default=False
|
||||||
|
)
|
||||||
|
|
||||||
bpy.types.Armature.rigify_force_widget_update = BoolProperty(
|
bpy.types.Armature.rigify_force_widget_update = BoolProperty(
|
||||||
name="Overwrite Widget Meshes",
|
name="Overwrite Widget Meshes",
|
||||||
@ -861,6 +874,8 @@ def unregister():
|
|||||||
del id_store.rigify_types
|
del id_store.rigify_types
|
||||||
del id_store.rigify_active_type
|
del id_store.rigify_active_type
|
||||||
del id_store.rigify_transfer_only_selected
|
del id_store.rigify_transfer_only_selected
|
||||||
|
del id_store.rigify_layers_mode
|
||||||
|
del id_store.rigify_layers_info
|
||||||
|
|
||||||
coll_store: typing.Any = bpy.types.BoneCollection
|
coll_store: typing.Any = bpy.types.BoneCollection
|
||||||
|
|
||||||
|
@ -254,7 +254,8 @@ class RIGIFY_OT_display_select_group(bpy.types.Operator):
|
|||||||
|
|
||||||
collection_name: StringProperty(default="", options={'SKIP_SAVE'})
|
collection_name: StringProperty(default="", options={'SKIP_SAVE'})
|
||||||
action: EnumProperty(items=(('VIS_TOGGLE', 'TOGGLE', 'Toggle visibility'),
|
action: EnumProperty(items=(('VIS_TOGGLE', 'TOGGLE', 'Toggle visibility'),
|
||||||
('TOGGLE_SELECT', 'SELECT', 'Toggle selection'),
|
('SELECT', 'SELECT', 'Add to selection'),
|
||||||
|
('TOGGLE_SELECT', 'TOGGLE_SELECT', 'Toggle selection'),
|
||||||
('UNSELECT', 'UNSELECT', 'Remove from selection'),
|
('UNSELECT', 'UNSELECT', 'Remove from selection'),
|
||||||
('DETAIL', 'DETAIL', 'Select bones individually')),
|
('DETAIL', 'DETAIL', 'Select bones individually')),
|
||||||
default='VIS_TOGGLE')
|
default='VIS_TOGGLE')
|
||||||
@ -265,7 +266,7 @@ class RIGIFY_OT_display_select_group(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
if event.shift:
|
if event.shift:
|
||||||
self.action = 'TOGGLE_SELECT'
|
self.action = 'SELECT'
|
||||||
elif event.ctrl:
|
elif event.ctrl:
|
||||||
self.action = 'UNSELECT'
|
self.action = 'UNSELECT'
|
||||||
elif event.alt:
|
elif event.alt:
|
||||||
@ -282,13 +283,19 @@ class RIGIFY_OT_display_select_group(bpy.types.Operator):
|
|||||||
coll = context.object.data.collections[self.collection_name]
|
coll = context.object.data.collections[self.collection_name]
|
||||||
|
|
||||||
if self.action == 'TOGGLE_SELECT':
|
if self.action == 'TOGGLE_SELECT':
|
||||||
pose_bones = context.object.pose.bones
|
|
||||||
for bone in coll.bones:
|
for bone in coll.bones:
|
||||||
if should_skip_bone(bone):
|
if should_skip_bone(bone):
|
||||||
continue
|
continue
|
||||||
if is_pose_bone_all_locked(pose_bones[bone.name]):
|
if is_pose_bone_all_locked(context.object.pose.bones[bone.name]):
|
||||||
continue
|
continue
|
||||||
bone.select = not bone.select
|
bone.select = not bone.select
|
||||||
|
elif self.action == 'SELECT':
|
||||||
|
for bone in coll.bones:
|
||||||
|
if should_skip_bone(bone):
|
||||||
|
continue
|
||||||
|
if is_pose_bone_all_locked(context.object.pose.bones[bone.name]):
|
||||||
|
continue
|
||||||
|
bone.select = True
|
||||||
elif self.action == 'UNSELECT':
|
elif self.action == 'UNSELECT':
|
||||||
for bone in coll.bones:
|
for bone in coll.bones:
|
||||||
bone.select = False
|
bone.select = False
|
||||||
|
@ -903,6 +903,26 @@ class RigLayers(bpy.types.Panel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
wm = context.window_manager
|
||||||
|
|
||||||
|
split = layout.split()
|
||||||
|
row = split.row()
|
||||||
|
row.prop(wm, 'rigify_layers_mode', expand=True, text=None if wm.rigify_layers_info else "")
|
||||||
|
row.prop(wm, 'rigify_layers_info', icon='INFO', text="")
|
||||||
|
|
||||||
|
if wm.rigify_layers_info:
|
||||||
|
box = layout.box()
|
||||||
|
box.label(text="Click: toggle Layer visibility")
|
||||||
|
if wm.rigify_layers_mode == 'PROPERTY':
|
||||||
|
box.label(text="Click + Drag: multi-toggle")
|
||||||
|
else:
|
||||||
|
box.label(text="Click + Shift: Select Bones")
|
||||||
|
box.label(text="Click + Ctrl: Unselect Bones")
|
||||||
|
box.label(text="Click + Alt: Pick Bones")
|
||||||
|
box.label(text="No drag click", icon='ERROR')
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
|
||||||
row_table = collections.defaultdict(list)
|
row_table = collections.defaultdict(list)
|
||||||
for coll in context.active_object.data.collections:
|
for coll in context.active_object.data.collections:
|
||||||
row_id = coll.get('rigify_ui_row', 0)
|
row_id = coll.get('rigify_ui_row', 0)
|
||||||
@ -915,7 +935,10 @@ class RigLayers(bpy.types.Panel):
|
|||||||
if row_buttons:
|
if row_buttons:
|
||||||
for coll in row_buttons:
|
for coll in row_buttons:
|
||||||
title = coll.get('rigify_ui_title') or coll.name
|
title = coll.get('rigify_ui_title') or coll.name
|
||||||
row.operator('{RIGIFY_OT_display_select_group.bl_idname}', text=title, depress=coll.is_visible).collection_name = coll.name
|
if wm.rigify_layers_mode == 'PROPERTY':
|
||||||
|
row.prop(coll, 'is_visible', toggle=True, text=title)
|
||||||
|
else:
|
||||||
|
row.operator('{RIGIFY_OT_display_select_group.bl_idname}', text=title, depress=coll.is_visible).collection_name = coll.name
|
||||||
else:
|
else:
|
||||||
row.separator()
|
row.separator()
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user