O'Reilly logo

Blender 2.49 Scripting by Michel J. Anders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding simple constraints

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required