View Single Post
# 1 25-03-2006 , 05:48 AM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224

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.


"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche