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:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user