Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Another piece of code from Walkerman . . (https://simplymaya.com/forum/showthread.php?t=20823)

skywola 25-03-2006 05:48 AM

Another piece of code from Walkerman . .
 
This is part of the code the is used to build the sliders for various controls in the Walkerman window.

First, I check to make sure that the Left Index finger really exists.
The reason to do this is it makes the code very robust, it is harder to do something that will "break the code". . . you can delete parts of the Walkerman skeleton, and the rest can still function. Say for example you want to make a creature with only three fingers.

Here the code creates the slider control for FL2J1.rotateY, and the 4 buttons to control it. . .

// Check for Left Index finger
if (`objExists $FL2J1`){

// Now we create a string to initiate the building of a slider.
$attr = $FL2J1 + ".rotateY";

// create the slider
attrFieldSliderGrp -label "Point Finger Y" -min -.5 -max .5 -at $attr;

// Set Default value for the slider
string $c = "setAttr " + $attr + " " + 0;
// Create the button for the action
button -label "D" -annotation "Default Setting" -command $c;

// Build a button to select the FL2J1 Joint
string $c = "select -r " + $FL2J1;
button -label "S" -annotation "Select Joint" -command $c;

// Build a button to set the keyFrame on the FL2J1 Joint
string $c = "setKeyframe " + $attr;
button -label "K" -annotation "Set Keyframe" -command $c;

// Build a button to cut the keyFrame on the FL2J1 Joint
string $c = "cutKey -cl -t `currentTime -q` " + $attr;
button -label "U" -annotation "Cut Key" -command $c;

}

If the joint does not exist, the whole process in the brackets is skipped.


All times are GMT. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018