diff --git a/scripts/startup/bl_operators/anim.py b/scripts/startup/bl_operators/anim.py index 1553700994f..71706f9b152 100644 --- a/scripts/startup/bl_operators/anim.py +++ b/scripts/startup/bl_operators/anim.py @@ -506,9 +506,9 @@ class ARMATURE_OT_sync_bone_color_to_selected(Operator): return {'FINISHED'} -class ARMATURE_OT_bone_collection_solo_visibility(Operator): +class ARMATURE_OT_collection_solo_visibility(Operator): """Hide all other bone collections and show the active one""" - bl_idname = "armature.bone_collection_solo_visibility" + bl_idname = "armature.collection_solo_visibility" bl_label = "Solo Visibility" bl_options = {'REGISTER', 'UNDO'} @@ -520,9 +520,25 @@ class ARMATURE_OT_bone_collection_solo_visibility(Operator): def execute(self, context): arm = context.object.data - active_bcoll = arm.collections.active for bcoll in arm.collections: - bcoll.is_visible = bcoll == active_bcoll + bcoll.is_visible = bcoll.name == self.name + return {'FINISHED'} + + +class ARMATURE_OT_collection_show_all(Operator): + """Show all bone collections""" + bl_idname = "armature.collection_show_all" + bl_label = "Show All" + bl_options = {'REGISTER', 'UNDO'} + + @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 + for bcoll in arm.collections: + bcoll.is_visible = True return {'FINISHED'} @@ -532,5 +548,6 @@ classes = ( ClearUselessActions, UpdateAnimatedTransformConstraint, ARMATURE_OT_sync_bone_color_to_selected, - ARMATURE_OT_bone_collection_solo_visibility, + ARMATURE_OT_collection_solo_visibility, + ARMATURE_OT_collection_show_all, ) diff --git a/scripts/startup/bl_ui/properties_data_armature.py b/scripts/startup/bl_ui/properties_data_armature.py index 6a3ff98e143..5cd6c617823 100644 --- a/scripts/startup/bl_ui/properties_data_armature.py +++ b/scripts/startup/bl_ui/properties_data_armature.py @@ -135,8 +135,9 @@ 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 + col.separator() + + col.menu("ARMATURE_MT_collection_context_menu", icon='DOWNARROW_HLT', text="") row = layout.row() @@ -149,6 +150,20 @@ class DATA_PT_bone_collections(ArmatureButtonsPanel, Panel): sub.operator("armature.collection_deselect", text="Deselect") +class ARMATURE_MT_collection_context_menu(Menu): + bl_label = "Bone Collection Specials" + + def draw(self, context): + layout = self.layout + + arm = context.armature + active_bcoll = arm.collections.active + + props = layout.operator("armature.collection_solo_visibility") + props.name = active_bcoll.name if active_bcoll else "" + layout.operator("armature.collection_show_all") + + class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel): bl_label = "Inverse Kinematics" bl_options = {'DEFAULT_CLOSED'} @@ -275,6 +290,7 @@ classes = ( DATA_PT_skeleton, DATA_PT_bone_collections, DATA_UL_bone_collections, + ARMATURE_MT_collection_context_menu, DATA_PT_motion_paths, DATA_PT_motion_paths_display, DATA_PT_display, diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index a36bc13a8b8..a9be18ec945 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -3989,8 +3989,12 @@ class VIEW3D_MT_bone_collections(Menu): layout.label(text="- select bones to operate on first -") return + layout.operator("armature.collection_show_all") + layout.separator() + arm = context.object.data bone = context.active_bone + found_editable_bcoll = False for bcoll in arm.collections: if not bcoll.is_editable: