Sub topic 17
Organizing bones with bone collections
A rig with a few bones is easy to read. A rig with a hundred bones, including deform bones, IK targets, pole targets and finger controls, is not. Bone collections let you group bones and show or hide each group with one click. This chapter covers how collections work, how to manage them in the interface and in Python, and the mistakes people commonly make.
Prerequisites
This chapter assumes you can do the following:
- Create bones in Edit Mode and switch between Object, Edit and Pose modes.
- Tell deform bones from control bones, as covered in the previous chapter.
- Run short
bpyscripts from the Scripting workspace.
It targets Blender 4.0 and later. Nested collections need 4.1 or later.
What a bone collection is
A bone collection is a named group of bones stored in the armature data. It replaces the 32 numbered bone layers used before Blender 4.0. The old layers had three limits: a fixed count, no names and no hierarchy. Collections have none of these limits.
Three properties matter in daily use:
- Collections belong to the armature data, not to the object. Every object that shares that armature data sees the same collections.
- A bone can belong to several collections, or to none. Membership is a list on the bone, not a single slot.
- Collections control visibility and selection, not deformation. A hidden bone still deforms the mesh if it has weights.
You manage collections in the Armature properties tab, in the Bone Collections panel. The list works like other Blender lists. Use the plus button to add a collection and the minus button to remove one. Double-click a name to rename it. The eye icon toggles visibility. In Pose Mode or Edit Mode, select bones, pick a collection, and press Assign. Remove takes the selected bones out of that collection. The Select and Deselect buttons act on all bones in a collection.
Pose Mode also has shortcuts. M moves the selected bones to a collection, which removes them from the others. Shift+M assigns the bones to an additional collection and keeps their existing memberships.
A typical layout
A common scheme separates bones by role, then by body part:
DEF: deform bones, hidden from animators.Controls: the bones animators select.Controls/FKandControls/IK: the two ways to drive a limb.Mechanism: helper bones such as pole targets and drivers, hidden by default.
Visibility rules
Visibility in the viewport depends on the collection, and on its parents in the hierarchy.
| Setting | Effect |
|---|---|
| `is_visible` off | The collection's bones are hidden in the viewport. |
| Parent collection hidden | Child collections are hidden too, whatever their own setting. |
| `is_solo` on | Only soloed collections are shown. Use it to isolate one group. |
| Bone in no collection | The bone is always visible. |
| Bone in several collections | The bone is visible if any of them is visible. |
The last two rows cause most surprises. A bone you forgot to assign never disappears when you hide collections. A bone that is hidden because of its collection also cannot be selected in the viewport.
Managing collections with Python
The script below builds a small armature, creates a hierarchy of collections and assigns bones. It runs from the Scripting workspace in a new file. The parent argument to collections.new needs Blender 4.1 or later.
import bpy
# Create the armature object
arm_data = bpy.data.armatures.new("CollectionsDemo")
arm_obj = bpy.data.objects.new("CollectionsRig", arm_data)
bpy.context.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
# Collections live on the armature data
deform = arm_data.collections.new("DEF")
controls = arm_data.collections.new("Controls")
fk = arm_data.collections.new("FK", parent=controls) # Blender 4.1+
bpy.ops.object.mode_set(mode='EDIT')
upper = arm_data.edit_bones.new("upper_arm")
upper.head = (0, 0, 0)
upper.tail = (0, 0, 1)
ctrl = arm_data.edit_bones.new("upper_arm_ctrl")
ctrl.head = (0.5, 0, 0)
ctrl.tail = (0.5, 0, 1)
ctrl.use_deform = False # a control bone should not deform the mesh
# assign() accepts an edit bone, a bone or a pose bone
deform.assign(upper)
fk.assign(ctrl)
bpy.ops.object.mode_set(mode='OBJECT')
# Hide the deform bones from animators
deform.is_visible = False
# Inspect the result. collections_all includes nested collections.
for coll in arm_data.collections_all:
names = [b.name for b in coll.bones]
print(coll.name, coll.is_visible, names)Some details of this script are easy to miss:
arm_data.collectionslists only the top-level collections.arm_data.collections_allincludes every nested one.coll.boneslists the bones in a collection. In the other direction,bone.collectionslists the collections a bone belongs to.- Collection names must be unique within the armature. Blender appends
.001to a duplicate name, so look collections up by the object you got back fromnew. A name lookup can fail after such a rename. coll.unassign(bone)removes one bone.arm_data.collections.remove(coll)deletes a collection, and its bones become unassigned, which makes them visible.
Common errors
- Old scripts using
bone.layersfail. The layers API was removed in 4.0. Replace it withcollection.assign(bone). - Bones vanish and cannot be selected. A collection is hidden, or another collection is soloed. Check the solo icons in the panel.
- Hiding the deform collection breaks the weights panel. Weight Paint with bone selection needs the bone to be visible. Show the collection while painting, then hide it again.
- Moving a bone in the list does nothing. The panel order only affects display. It has no effect on parenting or deformation.
- Old files show collections named after layers. Blender converts layers when it opens a pre-4.0 file. Rename the collections before you continue working on the rig.
Exercise
In an armature, a bone named "shin_ctrl" is assigned to the collection "IK" and also to "Controls". You hide "IK" but leave "Controls" visible. Is the bone visible in the viewport? Does hiding "IK" change how the bone affects the mesh?
Show answer
The bone is still visible, because a bone with several memberships is shown if any of its collections is visible, and "Controls" is visible. Hiding "IK" would not change deformation anyway. Visibility only controls display and selection. Whether a bone deforms the mesh depends on its Deform setting and its vertex group weights.
Exercise
Write the Python lines that create a collection named "Mechanism" on the armature data arm_data, assign an existing bone pole_bone to it, and hide it.
Show answer
mech = armdata.collections.new("Mechanism") mech.assign(polebone) mech.is_visible = False