You can add animation to vertices in editable meshes, spline shapes and FFD modifiers using the animateVertex() method. Its syntax is:
Animates one or more
vertex, knot, or control point, where
#selected -- not applicable for FFD modifiers
FFD modifiers, the animateAll()
method will animate all
the control points, and is equivalent to animateVertex
Animates all control points.
The animateVertex() and animateAll() methods effectively assign controllers to editable meshes, spline shapes and FFD modifiers which make them appear as animatables in the Track View, allowing further scripting of these vertex animation controllers.
animateVertex $line01 2
animateVertex $box01 #(2,3,4,5)
These animateVertex() method only work on editable meshes, spline shapes and FFD modifiers and will report an error if applied to other types of objects. You can use the functions convertToMesh() and convertToSplineShape() to convert existing geometry into the needed forms. Note that Line objects are SplineShapes already and don't need conversion.
The vertices to be animated are specified by index number, with the keyword #all to animate all vertices or control points, or #selected to animate the currently selected vertices. The #selected keyword is not applicable to FFD modifiers. In the case of SplineShapes, the vertex index numbers are interpreted in a special way to accommodate tangent handles and multiple curves, as follows:
Each SplineShape vertex has three indexes, one for each in-tangent handle, vertex, and out-tangent handle, in that order.
The indexes run consecutively through each curve in a multi-curve shape, with the index number for the first in-tangent handle of a curve starting after the index of the last out-tangent handle in the prior curve.
See also Class and Object Inspector Functions for details on accessing the vertices, tangents, or control points.
For information about scripting FFD control placement within FFD lattice space, see also the getModContextBBoxMin() and getModContextBBoxMin() functions, as described in Modifier Common Properties, Operators, and Methods.
For editable meshes and spline shapes, the controller values assigned to the vertices, knots, and tangent handles is in object space. See Using Node Transform Properties for information on converting between world space to object space.