Sub topic 18
Custom bone shapes for controls
This chapter assumes you can already create bones, switch between Object, Edit and Pose modes, and tell deform bones from control bones. You also need to know that a pose bone lives on the armature object, while the bone's rest data lives on the armature data. Here you will replace the default octahedral bone display with your own shapes, so animators can see and grab controls easily.
Why controls need their own shapes
By default every bone is drawn as a thin octahedron. In a rig with dozens of bones, these are hard to tell apart and hard to click. A control bone can instead be drawn as a circle, a square, a box or an arrow. Custom shapes change only how a bone is drawn in the viewport. They do not change deformation, constraints or animation.
A custom shape is an ordinary object, usually a small mesh. A pose bone points at it through its Custom Shape property. Because the property sits on the pose bone, you set it in Pose Mode.
Making a shape object
A good shape object follows these rules:
- It is a mesh with edges only. If it has faces, the viewport draws a solid surface, which is hard to see through.
- It is modeled at about one unit in size, because Blender scales it to the bone length by default.
- It is oriented to the bone's local axes. A bone points along its local Y axis, so a ring around the bone must lie in the shape object's XZ plane.
- Its origin sits where you want the shape anchored. The bone's head is the anchor point.
- It lives in a collection that is excluded from the view layer, often named
WGTorShapes. The shape still works, but it is not visible in the scene or in renders.
Custom shapes are never rendered. They are viewport overlays only.
Assigning a shape in the interface
- Enter Pose Mode and select the control bone.
- Open the Bone tab in the Properties editor and expand Viewport Display, then Custom Shape.
- Pick your mesh in the Custom Shape field.
- Adjust the transform fields until the shape looks right.
| Setting | Python property | Effect |
|---|---|---|
| Custom Shape | `custom_shape` | The object drawn in place of the octahedron. |
| Scale to Bone Length | `use_custom_shape_bone_size` | When on, the shape grows and shrinks with the bone's length. |
| Scale | `custom_shape_scale_xyz` | Extra scale per axis. |
| Translation | `custom_shape_translation` | Offsets the shape in the bone's local space. |
| Rotation | `custom_shape_rotation_euler` | Rotates the shape in the bone's local space. |
| Override Transform | `custom_shape_transform` | Draws the shape at another pose bone's position. |
| Wireframe | `bone.show_wire` | Draws the shape as wireframe in every shading mode. |
Doing it with Python
The script below builds a small rig from scratch. It makes a deform bone and a control bone, draws a ring shape, and assigns the ring to the control. Run it from the Scripting workspace while in Object Mode.
import bpy
import math
def make_circle_shape(name, radius=1.0, segments=32):
"""Return an edges-only ring lying in the XZ plane."""
verts = [
(radius * math.cos(2 * math.pi * i / segments),
0.0,
radius * math.sin(2 * math.pi * i / segments))
for i in range(segments)
]
edges = [(i, (i + 1) % segments) for i in range(segments)]
mesh = bpy.data.meshes.new(name)
mesh.from_pydata(verts, edges, [])
mesh.update()
return bpy.data.objects.new(name, mesh)
scene = bpy.context.scene
# Armature with one deform bone and one control bone
arm_data = bpy.data.armatures.new("ShapeDemo")
arm_obj = bpy.data.objects.new("ShapeDemoRig", arm_data)
scene.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT')
spine = arm_data.edit_bones.new("spine")
spine.head, spine.tail = (0, 0, 0), (0, 0, 1)
ctrl = arm_data.edit_bones.new("ctrl_spine")
ctrl.head, ctrl.tail = (1, 0, 0.5), (1, 0, 1)
ctrl.use_deform = False # controls should not deform the mesh
bpy.ops.object.mode_set(mode='OBJECT')
# Put the shape in a collection that is excluded from the view layer
wgt = bpy.data.collections.new("WGT")
scene.collection.children.link(wgt)
shape = make_circle_shape("WGT_circle")
wgt.objects.link(shape)
bpy.context.view_layer.layer_collection.children["WGT"].exclude = True
# Assign and tune the shape on the pose bone
pbone = arm_obj.pose.bones["ctrl_spine"]
pbone.custom_shape = shape
pbone.use_custom_shape_bone_size = False
pbone.custom_shape_scale_xyz = (0.4, 0.4, 0.4)
arm_data.bones["ctrl_spine"].show_wire = TrueThe ring is built in the XZ plane, so it encircles the bone's Y axis. Scale to Bone Length is switched off here, so the ring keeps a fixed size no matter how long the bone is.
Color and overrides
Since Blender 4.0, bone colors are set per bone with pbone.color.palette, for example 'THEME01'. Older versions used bone groups for this. Coloring left-side controls one color and right-side controls another is a common way to make a rig readable.
The Override Transform field is useful when the bone you want to click and the place you want the shape drawn differ. For example, a bone can sit at the wrist but draw its control ring at the fingertips.
Common errors
- The shape looks solid or blocks the view. The mesh has faces. Delete them in Edit Mode, keeping only edges, or turn on Wireframe.
- The shape is huge or tiny. Scale to Bone Length is on and the bone is long or short. Change the bone length, or turn the option off and use the Scale field.
- The ring stands at the wrong angle. The shape was modeled for the wrong axis. Remember that the bone points along Y, and fix it with the Rotation field or by editing the shape mesh.
- The shape vanished after linking or appending the rig. The shape objects were not brought along with the armature. Keep them in a collection that travels with the rig.
- A control deforms the mesh. Its Deform checkbox is still on. Turn it off for every control bone.
Exercise
A control bone should be drawn as a ring around its own axis at a fixed size, and the ring should not change if you later lengthen the bone in Edit Mode. Which shape-object orientation and which pose bone setting give you this?
Show answer
Model the ring in the shape object's XZ plane, because the bone points along its local Y axis. Turn off Scale to Bone Length (usecustomshapebonesize = False) and set the size with the Scale fields (customshapescale_xyz). The shape then keeps its size when the bone length changes.