Anim: Bone properties panel, add missing 'solo' property

Solo'ing bone collections was only possible from the Armature properties
panel. However, the bone collections shown on the Bone properties panel
should have the same functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/118512
This commit is contained in:
Sybren A. Stüvel 2024-02-20 18:09:04 +01:00
parent 490c183bfd
commit 1c789199d5

@ -260,6 +260,16 @@ class BONE_PT_collections(BoneButtonsPanel, Panel):
layout.use_property_split = False layout.use_property_split = False
bone = context.bone or context.edit_bone bone = context.bone or context.edit_bone
object = context.pose_object or context.edit_object or context.object
if not object:
layout.active = False
sub = layout.column(align=True)
sub.label(text="Cannot figure out which object this bone belongs to.")
sub.label(text="Please file a bug report.")
return
armature = object.data
is_solo_active = armature.collections.is_solo_active
if not bone.collections: if not bone.collections:
layout.active = False layout.active = False
@ -275,8 +285,15 @@ class BONE_PT_collections(BoneButtonsPanel, Panel):
# Name & visibility of bcoll. Safe things, so aligned together. # Name & visibility of bcoll. Safe things, so aligned together.
row = bcoll_row.row(align=True) row = bcoll_row.row(align=True)
row.label(text=bcoll.name) row.label(text=bcoll.name)
row.prop(bcoll, "is_visible", text="",
icon='HIDE_OFF' if bcoll.is_visible else 'HIDE_ON') # Sub-layout that's dimmed when the bone collection's own visibility flag doesn't matter.
sub_visible = row.row(align=True)
sub_visible.active = (not is_solo_active) and bcoll.is_visible_ancestors
sub_visible.prop(bcoll, "is_visible", text="",
icon='HIDE_OFF' if bcoll.is_visible else 'HIDE_ON')
row.prop(bcoll, "is_solo", text="",
icon='SOLO_ON' if bcoll.is_solo else 'SOLO_OFF')
# Unassignment operator, less safe so with a bit of spacing. # Unassignment operator, less safe so with a bit of spacing.
props = bcoll_row.operator("armature.collection_unassign_named", props = bcoll_row.operator("armature.collection_unassign_named",