Anim: Add operator to 'solo' the active bone collection

With armature layers it was possible to, with one click, show a single
layer and hide all the others. This is now possible with bone collections
as well.

For that I added a new operator `armature.bone_collection_solo_visibility`,
with a button next to the list of bone collections. The icon is
`SOLO_ON`, which is also used in the NLA.
This commit is contained in:
Sybren A. Stüvel
2023-09-28 14:08:33 +02:00
parent bf23d0e53c
commit 2d04919a82
2 changed files with 23 additions and 0 deletions

View File

@@ -506,10 +506,31 @@ class ARMATURE_OT_sync_bone_color_to_selected(Operator):
return {'FINISHED'}
class ARMATURE_OT_bone_collection_solo_visibility(Operator):
"""Hide all other bone collections and show the active one"""
bl_idname = "armature.bone_collection_solo_visibility"
bl_label = "Solo Visibility"
bl_options = {'REGISTER', 'UNDO'}
name: StringProperty(name='Bone Collection')
@classmethod
def poll(cls, context):
return context.object and context.object.type == 'ARMATURE' and context.object.data
def execute(self, context):
arm = context.object.data
active_bcoll = arm.collections.active
for bcoll in arm.collections:
bcoll.is_visible = bcoll == active_bcoll
return {'FINISHED'}
classes = (
ANIM_OT_keying_set_export,
NLA_OT_bake,
ClearUselessActions,
UpdateAnimatedTransformConstraint,
ARMATURE_OT_sync_bone_color_to_selected,
ARMATURE_OT_bone_collection_solo_visibility,
)

View File

@@ -135,6 +135,8 @@ class DATA_PT_bone_collections(ArmatureButtonsPanel, Panel):
col.separator()
col.operator("armature.collection_move", icon='TRIA_UP', text="").direction = 'UP'
col.operator("armature.collection_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
props = col.operator("armature.bone_collection_solo_visibility", text="", icon='SOLO_ON')
props.name = active_bcoll.name
row = layout.row()