//used in Nike jelly legs
//CONTROLLER SETUP
//select controller for attributes to be added to, one by one. eg. left foot ctrl. then right.
string $footCtrl[]=`ls -sl`;
print $footCtrl[0];
//upper controls
addAttr -ln "o" -at "enum" -en "--------" -keyable 1 $footCtrl[0];
setAttr -lock true ($footCtrl[0]+".o");
addAttr -ln "upper_amp" -keyable 1 -at double -dv 1 $footCtrl[0];
addAttr -ln "upper_sinPhase" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_transY" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_transZ" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_rotoX" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_rotoY" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_rotoZ" -keyable 1 -at double -dv 0 $footCtrl[0];
//lower controls
addAttr -ln "oo" -at "enum" -en "--------" -keyable 1 $footCtrl[0];
setAttr -lock true ($footCtrl[0]+".oo");
addAttr -ln "lower_amp" -keyable 1 -at double -dv 1 $footCtrl[0];
addAttr -ln "lower_sinPhase" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_transY" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_transZ" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_rotoX" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_rotoY" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_rotoZ" -keyable 1 -at double -dv 0 $footCtrl[0];
//upper offsets
addAttr -ln "ooo" -at "enum" -en "--------" -keyable 1 $footCtrl[0];
setAttr -lock true ($footCtrl[0]+".ooo");
addAttr -ln "upper_y_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_z_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_xRot_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_yRot_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "upper_zRot_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
//lower offsets
addAttr -ln "oooo" -at "enum" -en "--------" -keyable 1 $footCtrl[0];
setAttr -lock true ($footCtrl[0]+".oooo");
addAttr -ln "lower_y_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_z_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_xRot_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_yRot_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
addAttr -ln "lower_zRot_sinOffset" -keyable 1 -at double -dv 0 $footCtrl[0];
___________________________________________________________________________
//CONNECT CONTROLLER TO THE MICRO CURVES
//select the micro curves, can select them all, set the leftLeg and rightLeg strings!
string $ctrlNameSel[]=`ls -sl`;
print $ctrlNameSel[0];
float $ctrlOffset=0;
float $ctrlAmp=1;
string $leftLeg="abc_lLegSwitchC";
string $rightLeg="abc_rLegSwitchC";
string $ctrlUse="none";
string $region="none";
//looping
for ($ctrl in $ctrlNameSel){
if(`gmatch $ctrl "*1C*"`){
//top Node, set offsetVal
$ctrlOffset=0;
$ctrlAmp=0.55;
}
else if(`gmatch $ctrl "*2C*"`){
//middle Node, set offsetVal
$ctrlOffset=1.65;
$ctrlAmp=1;
}
else if (`gmatch $ctrl "*3C*"`){
//bottom Node, set offsetVal
$ctrlOffset=2.2;
$ctrlAmp=0.4;
}
//WHICH PART
if(`gmatch $ctrl "*_rLower*"`){
$ctrlUse=$rightLeg;
$region="lower";
}
else if(`gmatch $ctrl "*_rUpper*"`){
$ctrlUse=$rightLeg;
$region="upper";
}
if(`gmatch $ctrl "*_lLower*"`){
$ctrlUse=$leftLeg;
$region="lower";
}
else if(`gmatch $ctrl "*_lUpper*"`){
$ctrlUse=$leftLeg;
$region="upper";
}
select $ctrl;
string $newGroup=`group -name ($ctrl+"_sinGrp")`;
string $offsetVal="float $offset="+$ctrlOffset+";\n";
string $ctrlAmpStr="float $amp="+$ctrlAmp+";\n";
//translate
//string $sinTYVal=$newGroup+".translateY=sin("+$ctrlUse+"."+$region+"_sinPhase+$offset+" +$ctrlUse+ "." +$region+ "_y_sinOffset)*$amp * "+$ctrlUse+"."+$region+"_transY;\n";
string $sinTYVal=$newGroup+".translateY=sin("+$ctrlUse+"."+$region+"_sinPhase+$offset+" +$ctrlUse+ "." +$region+ "_y_sinOffset)*$amp * "+$ctrlUse+"."+$region+"_transY * "+$ctrlUse+"."+$region+"_amp;\n";
string $sinTZVal=$newGroup+".translateZ=sin("+$ctrlUse+"."+$region+"_sinPhase+$offset+"+$ctrlUse+"."+$region+"_z_sinOffset)*$amp * "+$ctrlUse+"."+$region+"_transZ * "+$ctrlUse+"."+$region+"_amp;\n";
string $sinRXVal=$newGroup+".rotateX=sin("+$ctrlUse+"."+$region+"_sinPhase+$offset+"+$ctrlUse+"."+$region+"_xRot_sinOffset)*$amp * "+$ctrlUse+"."+$region+"_rotoX * "+$ctrlUse+"."+$region+"_amp;\n";
string $sinRYVal=$newGroup+".rotateY=sin("+$ctrlUse+"."+$region+"_sinPhase+$offset+"+$ctrlUse+"."+$region+"_yRot_sinOffset)*$amp * "+$ctrlUse+"."+$region+"_rotoY * "+$ctrlUse+"."+$region+"_amp;\n";
string $sinRZVal=$newGroup+".rotateZ=sin("+$ctrlUse+"."+$region+"_sinPhase+$offset+"+$ctrlUse+"."+$region+"_zRot_sinOffset)*$amp * "+$ctrlUse+"."+$region+"_rotoZ * "+$ctrlUse+"."+$region+"_amp;\n";
string $expressionVal=$offsetVal + $ctrlAmpStr +$sinTYVal + $sinTZVal + $sinRXVal +$sinRYVal + $sinRZVal;
// lower_xRot_sinOffset
expression -s $expressionVal;
select -cl;
}
______________________________________________________________________________
//REMOVE ATTRIBUTES FROM CONTROLLER
//select the controller (one by one)
//sets things to zero first, then deletes them
string $footCtrl[]=`ls -sl`;
print $footCtrl[0];
//remove upper controls, set to 0
setAttr -lock false ($footCtrl[0]+".o");
deleteAttr -at "o";
setAttr ($footCtrl[0]+".upper_amp") 0;
deleteAttr -at "upper_amp";
deleteAttr -at "upper_sinPhase";
deleteAttr -at "upper_transY";
deleteAttr -at "upper_transZ";
deleteAttr -at "upper_rotoX";
deleteAttr -at "upper_rotoY";
deleteAttr -at "upper_rotoZ";
//lower controls
setAttr -lock false ($footCtrl[0]+".oo");
deleteAttr -at "oo";
setAttr ($footCtrl[0]+".lower_amp") 0;
deleteAttr -at "lower_amp";
deleteAttr -at "lower_sinPhase";
deleteAttr -at "lower_transY";
deleteAttr -at "lower_transZ";
deleteAttr -at "lower_rotoX";
deleteAttr -at "lower_rotoY";
deleteAttr -at "lower_rotoZ";
//upper offsets
setAttr -lock false ($footCtrl[0]+".ooo");
deleteAttr -at "ooo";
deleteAttr -at "upper_y_sinOffset";
deleteAttr -at "upper_z_sinOffset";
deleteAttr -at "upper_xRot_sinOffset";
deleteAttr -at "upper_yRot_sinOffset";
deleteAttr -at "upper_zRot_sinOffset";
//lower offsets
setAttr -lock false ($footCtrl[0]+".oooo");
deleteAttr -at "oooo";
deleteAttr -at "lower_y_sinOffset";
deleteAttr -at "lower_z_sinOffset";
deleteAttr -at "lower_xRot_sinOffset";
deleteAttr -at "lower_yRot_sinOffset";
deleteAttr -at "lower_zRot_sinOffset";
__________________________________________________________________________
//DELETE SIN GROUPS FROM THE RIG
//just run it, no need to select (deletes all sin groups though)
string $ctrlSelected[]=`ls "*_sinGrp*"`;
for($group in $ctrlSelected){
select $group;
print ($group+"\n");
ungroup;
}