Mel
|
IntroductionIf 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. Listing 1
The point of interest in the script is the use of the string $cv[] = `ls -flatten ($name + ".cv[3:3]")`;
The "setAttr \"" + $cv[0] + ".xValue\" (sin(frame));"; "setAttr \"" + $cv[0] + ".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. Listing 2
|
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.