Adding custom bone shapes
Armature bones are effective deformers, but we have experienced a major drawback for ourselves in the Using armature deformers section: bones tend to be hidden by the deformed geometry.
There are a few workarounds, such as activating the In Front attribute in the Armature properties and using X-Ray or Wireframe views.
Another gimmick consists in displaying special widgets by assigning mesh objects to the bone’s Custom Shape attribute.
Creating mesh objects in Python
First, we must create a new mesh. A mesh consists of vertex coordinates, plus edges or faces that connect vertices.
Figure 11.15: Vertex coordinates of a 2D square
In this example, we create a wireframe square and use it as a bone widget. Blender bones expand upon their Y
axis, so the horizontal coordinates of our bones that are placed vertically are X
and Z
.
We build our list of vertices. We aim for a side length of 1.0
, a measure easy to scale...