If an expression is assigned to the cv's (control vertices) of a curve their positions can be dynamically changed from one frame to the next. As a consequence the curve will continually change. This tutorial shows how a mel script can assign an expression to one or more cv's of a curve. The mel script, listing 1, shows the basic technique of accessing a cv and assigning an expression to it.
The point of interest in the script is the use of the
string $cv = `ls -flatten ($name + ".cv[3:3]")`;
"setAttr \"" + $cv + ".xValue\" (sin(frame));"; "setAttr \"" + $cv + ".yValue\" (sin(frame));";
Using index 3 in the way shown in listing 1 makes the code easier to understand. The command setAttr is used twice to modify the x and y values of a cv.
The second mel script, listing 2, also "grabs" the names of all the
cv's but uses a for-loop to assign an expression to each cv. The script takes
advantage of the pre-defined variable
© 2002- Malcolm Kesson. All rights reserved.