Constraints may be applied to objects as well as to bones. In both instances a new constraint is added by calling the
append() method of the
constraints attribute. Our next example will show how we may restrict the movement of the clock hands from the rigged clock (fromChapter 3, Vertex Groups and Materials) to rotate around the z-axis. The code defining the function to accomplish this starts off with two
import statements that will save us some typing:
from Blender.Constraint import Type from Blender.Constraint import Settings
The function itself will take two arguments:
obbones, a reference to a Blender object whose data is an armature (that is, not the armature object itself) and
bone, the name of the bone whose motion ...