/*********************************************************************************************/ // creep version 2.93 // // author: Volker Heisterberg [volk@renderwahnsinn.de] // // description: script to make tendrils grow along a curve with intuitive animation controls // // usage: - select rail curve, then run creep from the command line // - to be able to walk along the clusterControllers (squares) hotkeys are created // for the following commands: // ctrl + left -> pickWalk_le // ctrl + right -> pickWalk_ri // - to select all square controllers from the actual selection down press // ctrl + insert // // date of latest changes: 26.12.07 // // Version History: // V 1.0: Script Job Approach // V 1.1: Connections // V 1.2: Not precise enough // V 1.3: enough precision // V 1.4: Prevent flipping // V 1.5: pickWalk_re and pickWalk_le to walk along the controller circles // V 1.6: square-controllers stay at curve // V 1.7: drop clusters :-) // V 1.7.1: got rid of annoying warning // V 1.8: changed renaming to work with namespaces // V 1.9: constant volume for the shape // V 2.0: various fixes // V 2.1: aim locators // V 2.2: evaluate pointOnCurve for aim position (thanks to Damien Fagnou) // V 2.3: damien´s solution ... didn´t work // V 2.4: fixing problems with referenced curves // V 2.5: comparing distances (thanks to Holger Schönberger) and using shading nodes // instead of expressions // V 2.6: create scriptNode to fix dg-update problems for rendering // V 2.7: new approach: felix balbas anti-flipping technique (thanks to Felix Balbas) // V 2.8: creep still seems to flip in some situations, so I added the posibility to // adjust the up vector from the controller // V 2.9: new feature: creep can blend to a dynamic curve // V 2.91: new shortcut: select all under lying squares // V 2.92: up_vectors beneath controllers and clusterAnimator is now integrated // V 2.93: works now in maya 2008 ... and only! For older versions use creep 2.92! /*********************************************************************************************/ global proc clusterAnimatorCreep() { string $selectedCurve[] = `ls -sl`; if (size($selectedCurve)==0) { error ("Select a curve for this script to work!"); } string $nodeType = `nodeType $selectedCurve[0]`; if ($nodeType=="transform") { pickWalk -d down; $selectedCurve = `ls -sl`; $nodeType = `nodeType $selectedCurve[0]`; } if ($nodeType!="nurbsCurve") { error ("Select a curve for this script to work!"); } // get curve transform string $transforms[] = `listTransforms $selectedCurve[0]`; string $curveName = $transforms[0]; int $cvCount = 2 + `getAttr ($selectedCurve[0] + ".spans")`; string $clusterList[]; for ($i=0; $i<=$cvCount; $i++) { select -r ($selectedCurve[0] + ".cv[" + $i + "]"); string $clusterFeedback[] = `cluster -bf -rel`; $clusterList[$i] = $clusterFeedback[1]; } // create controller shape string $circle[] = `circle -c 0 0 0 -nr 1 0 0 -sw 360 -r 1 -d 1 -ut 0 -tol 0.01 -s 12 -ch 1`; select -cl; int $i=1; while ($i<12) { select -add ($circle[0] + ".cv[" + $i + "]"); $i=$i+2; } scale -r -p 0cm 0cm 0cm 0.613246 0.613246 0.613246 ; select -cl; string $controllerList[]; $controllerList[0] = `rename $circle[0] ($curveName + "_rotateController_0")`; for ($i=0; $i<=$cvCount; $i++) { vector $position = `xform -q -t ($curveName + ".cv[" + $i + "]")`; // duplicate star-shape and rename if ($i!=$cvCount) { string $copy[] = `duplicate $controllerList[$i]`; // parent -w $copy[0]; $controllerList[$i+1] = `rename $copy[0] ($curveName + "_rotateController_" + ($i + 1))`; } setAttr ($controllerList[$i] + ".translateX") ($position.x); setAttr ($controllerList[$i] + ".translateY") ($position.y); setAttr ($controllerList[$i] + ".translateZ") ($position.z); if ($i>0) aimConstraint -offset 0 0 0 -weight 1 -aimVector 1 0 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 $controllerList[$i] $controllerList[$i-1]; if ($i==$cvCount) aimConstraint -offset 0 0 0 -weight 1 -aimVector 1 0 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 $controllerList[$i-1] $controllerList[$i]; } for ($i=0; $i<=$cvCount; $i++) { select -r $controllerList[$i]; addAttr -ln connection_re -dt "string" ($controllerList[$i]); addAttr -ln connection_le -dt "string" ($controllerList[$i]); if ($i>0) { string $connectionSource = `connectionInfo -sfd ($controllerList[$i-1] + ".rotateY")`; string $constraint[]; tokenize $connectionSource "." $constraint; delete ($constraint[0]); //order controllers parent $controllerList[$i] $controllerList[$i-1]; //create Connections for pickWalk if ($i==1) { connectAttr ($controllerList[$i] +".message") ($controllerList[$i-1] + ".connection_re"); } if ($i>1) { connectAttr ($controllerList[$i-2] +".message") ($controllerList[$i-1] +".connection_le"); connectAttr ($controllerList[$i] +".message") ($controllerList[$i-1] +".connection_re"); } if ($i==($cvCount)) { connectAttr ($controllerList[$i-1] +".message") ($controllerList[$i] +".connection_le"); // delete last aim constrain $connectionSource = `connectionInfo -sfd ($controllerList[$i] + ".rotateY")`; tokenize $connectionSource "." $constraint; delete ($constraint[0]); } } } string $locatorList[]; for ($i=0; $i<=$cvCount; $i++) { vector $position = `xform -q -t -ws $controllerList[$i]`; string $sl[] = `spaceLocator -p ($position.x) ($position.y) ($position.z)`; $locatorList[$i] = $sl[0]; xform -cp; makeIdentity -apply true -t 1 -r 0 -s 0 -n 0 $locatorList[$i]; pointConstraint -offset 0 0 0 -weight 1 $controllerList[$i] $locatorList[$i]; connectAttr -f ($locatorList[$i] + ".translate") ($clusterList[$i] + ".translate"); } // group controllers /*select -cl; for ($i=0; $i<=$cvCount; $i++) { select -add $controllerList[$i]; } group; string $controllerGroup = `rename ("controllerGroup_" + $curveName)`;*/ //group clusters; select -cl; for ($i=0; $i<=$cvCount; $i++) { select -add $clusterList[$i]; } string $clusterGroup = `group -n ($curveName + "_clusterGroup")`; setAttr -lock true ($clusterGroup + ".visibility") 0; //group locators; select -cl; for ($i=0; $i<=$cvCount; $i++) { select -add $locatorList[$i]; } string $locatorGroup = `group -n ($curveName + "_locatorGroup")`; setAttr -lock true ($locatorGroup + ".visibility") 0; // group everything select -add $clusterGroup; select -add $controllerList[0]; group -n ($curveName + "_clusterAnimator"); select -cl; } global proc createCreepHotkeys() { //auto-create hotkey nameCommand -annotation "Pick Walk right" -command "pickWalk_ri" pickWalk_right; hotkey -k "Right" -ctl -name "pickWalk_right"; nameCommand -annotation "Pick Walk left" -command "pickWalk_le" pickWalk_left; hotkey -k "Left" -ctl -name "pickWalk_left"; nameCommand -annotation "select All Underlying Squares" -command "selectAllUnderlyingSquares" selectAllUnderlyingSquares; hotkey -k "Insert" -ctl -name "selectAllUnderlyingSquares"; } global proc creep() { cycleCheck -e off; string $selection[] = `ls -sl`; // check for correct selection if (size($selection)==0) { error "You need to select a curve for this script to work!"; } string $targetCurve = $selection[0]; select -r $targetCurve; // strip namespace; string $buffer[]; tokenize $targetCurve ":" $buffer; int $i = size($buffer); string $targetCurveName = $buffer[($i-1)]; pickWalk -d down; string $targetCurveShape[] = `ls -sl`; string $checkType = `nodeType $targetCurveShape[0]`; if ($checkType!="nurbsCurve") { error "Wrong selection, you need to select a curve for this script to work!"; } // clusterAnimator int $spansSC = getAttr ($targetCurve + ".spans"); int $cvSC = $spansSC + 3; rebuildCurve -rpo 1 -rt 0 -end 1 -kr 2 -kcp 0 -kep 1 -kt 1 -s 0 -d 3 -ch 1 -tol 0.01 ($targetCurve); select -r $targetCurve; clusterAnimatorCreep(); // now create a new curve with the same number of spans $command = "curve -d 3 -p 0 0 0 -p 0 0 1 -p 0 0 2 -p 0 0 3"; for ($i=0; $i<(2*$spansSC+2); $i++) { $command = $command + " -p 0 0 " + ($i+1); } eval($command); $sourceCurve = `rename ("float_" + $targetCurveName)`; pickWalk -d down; $sourceCurveShape = `ls -sl`; createNode implicitSphere; pickWalk -d up; string $controller; $controller = `rename ("creepController_" + $targetCurveName)`; //add percent value to $controller addAttr -at "float" -min 0.001 -max 200 -dv 1 -ln percent $controller; setAttr -keyable true ($controller + ".percent"); string $pOC[]; float $percent = `getAttr ($controller + ".percent")`; // global up_vector controller addAttr -ln upVector -at double3 ($controller); addAttr -ln upVectorX -at double -p upVector ($controller); addAttr -ln upVectorY -at double -p upVector ($controller); addAttr -ln upVectorZ -at double -p upVector ($controller); setAttr -type double3 ($controller + ".upVector") 0 0 0; setAttr -e -keyable true ($controller + ".upVector"); setAttr -e -keyable true ($controller + ".upVectorX"); setAttr -e -keyable true ($controller + ".upVectorY"); setAttr -e -keyable true ($controller + ".upVectorZ"); setAttr ($controller + ".upVectorY") 1; //setAttr ($controller + ".upVectorZ") 1; arcLengthDimension ($targetCurve + ".u[" + $spansSC + "]"); rename ("adl_" + $targetCurveName); pickWalk -d down; string $temp[] = `ls -sl`; string $adl = $temp[0]; setAttr ($adl + ".visibility") 0; for ($i=0; $i<(2*$cvSC); $i++) { float $value; if ($i<3) { if ($i==0) $value = $percent/100*(float($i)); if ($i==1) $value = $percent/100*0.166; if ($i==2) $value = $percent/100*0.332; } else { if ($i<(2*$cvSC-5)) { $value = $percent/100*((float($i)-2)/2); } else { if ($i==(2*$cvSC-5)) $value = $percent/100 * ($spansSC-0.6); if ($i==(2*$cvSC-4)) $value = $percent/100 * ($spansSC-0.3); if ($i==(2*$cvSC-3)) $value = $percent/100 * ($spansSC); } } $pOC[$i] = `createNode pointOnCurveInfo`; $mD = `shadingNode -asUtility multiplyDivide`; $mD3 = `shadingNode -asUtility multiplyDivide`; $mD2 = `shadingNode -asUtility multiplyDivide`; setAttr ($mD2 + ".operation") 2; connectAttr -f ($adl + ".arcLength") ($mD2 + ".input2X"); float $al_value = `getAttr ($adl + ".arcLength")`; setAttr ($mD2 + ".input1X") ($al_value); connectAttr -f ($mD2 + ".outputX") ($mD3 + ".input1X"); connectAttr -f ($controller + ".percent") ($mD3 + ".input2X"); connectAttr -f ($mD3 + ".outputX") ($mD + ".input1X"); connectAttr -f ($targetCurveShape[0] + ".worldSpace[0]") ($pOC[$i] + ".inputCurve"); setAttr ($mD + ".input2X") ($value); string $clamp = `shadingNode -asUtility clamp`; connectAttr -f ($mD + ".outputX") ($clamp + ".inputR"); setAttr ($clamp + ".maxR") ((float)$spansSC-0.01); connectAttr -f ($clamp + ".outputR") ($pOC[$i] + ".parameter"); } // move source-curve cvs for ($i=0; $i<(2*$cvSC); $i++) { connectAttr ($pOC[$i] + ".positionX") ($sourceCurve + ".controlPoints[" + $i + "].xValue"); connectAttr ($pOC[$i] + ".positionY") ($sourceCurve + ".controlPoints[" + $i + "].yValue"); connectAttr ($pOC[$i] + ".positionZ") ($sourceCurve + ".controlPoints[" + $i + "].zValue"); } // leiden revisited string $circleField[]; string $circleControlField[]; string $circleShapeField[]; string $locatorField[]; string $upLocatorField[]; string $expressionField[]; for ($i=0; $i<(2*$cvSC-2); $i++) { string $pOC2 = `createNode pointOnCurveInfo`; if ($i==(2*$cvSC-3)) { setAttr ($pOC2 + ".pr") ($i-0.1); } else setAttr ($pOC2 + ".pr") ($i); connectAttr -f ($sourceCurveShape[0] + ".worldSpace[0]") ($pOC2 + ".inputCurve"); circle -ch 0 -c 0 0 0 -nr 0 1 0 -sw 360 -r 0.05 -d 3 -ut 0 -tol 0.01 -s 8; string $circle = `rename leidenCircle`; setAttr ($circle + ".rotateOrder") 1; $circleField[$i] = $circle; pickWalk -d down; string $selection[] = `ls -sl`; string $circleShape = $selection[0]; $circleShapeField[$i] = $circleShape; // controller-Circle circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 0.15 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1; string $controllerCircle = `rename leidenControlCircle`; setAttr ($controllerCircle + ".rotateOrder") 1; $circleControlField[$i] = $controllerCircle; connectAttr ($controllerCircle + ".scaleX") ($circle + ".scaleX"); connectAttr ($controllerCircle + ".scaleY") ($circle + ".scaleY"); connectAttr ($controllerCircle + ".scaleZ") ($circle + ".scaleZ"); // locator as a aim target string $locatorAim[] = `spaceLocator -p 0 0 0 -n ("locAim_" + $targetCurveName + "_" + $i)`; $locatorField[$i] = $locatorAim[0]; select -r ($controllerCircle); select -tgl ($locatorAim[0]); // locator as a up object string $locatorUp[] = `spaceLocator -p 0 0 0 -n ("locUp_" + $targetCurveName + "_" + $i)`; $upLocatorField[$i] = $locatorUp[0]; pointConstraint -o 1 1 1 -w 1 ($controllerCircle) ($locatorUp[0]); // v 2.92 changes parent ($locatorUp[0]) ($controllerCircle); setAttr -lock 1 ($locatorUp[0] + ".visibility") 0; // v 2.92 changes end // create Aim constraint // position locators string $pMA = `shadingNode -asUtility plusMinusAverage`; string $pMA = `shadingNode -asUtility plusMinusAverage`; connectAttr ($pOC2 + ".position") ($pMA + ".input3D[0]"); connectAttr ($pOC2 + ".tangent") ($pMA + ".input3D[1]"); connectAttr ($pMA + ".output3D") ($locatorAim[0] + ".translate"); // test string $aC[] = `aimConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "object" -worldUpVector 0 1 0 -worldUpObject $locatorUp[0] $locatorAim[0] $circle`; // up vector of aimConstraint shouldn´t be the same as the aim (or tangent) vector /*string $dv = `shadingNode -asUtility vectorProduct`; setAttr ($dv + ".input1Y") 1; setAttr ($dv + ".normalizeOutput") 1; connectAttr -f ($pOC2 + ".tangent") ($dv + ".input2"); connectAttr -f ($dv + ".outputX") ($aC[0] + ".upVectorZ");*/ // test end // connect the upVector - controller connectAttr -f ($controller + ".upVector") ($aC[0] + ".upVector"); // connectAttr -f ($circle + ".rotateX") ($controllerCircle + ".rotateX"); connectAttr -f ($circle + ".rotateY") ($controllerCircle + ".rotateY"); connectAttr -f ($circle + ".rotateZ") ($controllerCircle + ".rotateZ"); connectAttr ($pOC2 + ".position") ($circle + ".translate"); connectAttr ($circle + ".translate") ($controllerCircle + ".translate"); select -r $circle; select -add $controllerCircle; setAttr -e -lock true -keyable false ($controllerCircle+ ".translateX"); setAttr -e -lock true -keyable false ($controllerCircle+ ".translateY"); setAttr -e -lock true -keyable false ($controllerCircle+ ".rotateX"); setAttr -e -lock true -keyable false ($controllerCircle+ ".rotateY"); setAttr -e -lock true -keyable false ($controllerCircle+ ".translateZ"); setAttr -e -lock true -keyable false ($controllerCircle+ ".rotateZ"); } // dynamic curve blending // copy float curve string $dynCurve[] = `duplicate -rr -ic $sourceCurve`; select -r $dynCurve[0]; makeCurvesDynamicHairs(0,0,0); string $hss[] = `ls -sl`; string $tempo[] = `connectionInfo -dfs ($hss[0] + ".outputHair[0]")`; string $fs[]; tokenize ($tempo[0]) "." $fs; clear($tempo); $tempo = `connectionInfo -dfs ($fs[0] + ".outCurve")`; string $dynCur[]; tokenize $tempo[0] "." $dynCur; string $bSNode[] = `blendShape -frontOfChain $dynCur[0] $sourceCurve`; // set hairSystem attributes setAttr ($hss[0] + ".gravity") 0; setAttr ($hss[0] + ".drag") 0.1; setAttr ($hss[0] + ".damp") 200; setAttr ($hss[0] + ".stiffness") 0.85; setAttr ($hss[0] + ".turbulenceStrength") 0.2; setAttr ($hss[0] + ".startFrame") (`playbackOptions -q -ast`); setAttr ($hss[0] + ".turbulenceFrequency") 1; // setAttr ($fs[0] + ".pointLock") 1; //loft circles $command = "loft -ch 1 -u 1 -c 0 -ar 0 -d 3 -ss 1 -rn 0 -po 0 -rsn true "; for ($i=0; $i<(2*$cvSC-2); $i++) { $command += $circleShapeField[$i] + " "; } eval($command); string $leidenSurface = `rename ("leidenSurface_" + $targetCurveName)`; string $clusterField[]; string $clusterControlField[]; string $clusterControlGroupField[]; // cluster erzeugen for ($i=0; $i<($cvSC); $i++) { // controller-square erzeugen circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 0.5 -d 1 -ut 0 -tol 0.01 -s 4 -ch 1; $clusterControlField[$i] = `rename ("ClusterController" + $i)`; setAttr -keyable false -channelBox false ("ClusterController" + $i + ".sx"); setAttr -keyable false -channelBox false ("ClusterController" + $i + ".sy"); setAttr -keyable false -channelBox false ("ClusterController" + $i + ".sz"); setAttr -keyable false -channelBox false ("ClusterController" + $i + ".rx"); setAttr -keyable false -channelBox false ("ClusterController" + $i + ".ry"); setAttr -keyable false -channelBox false ("ClusterController" + $i + ".rz"); setAttr -keyable false -channelBox false ("ClusterController" + $i + ".v"); group; $clusterControlGroupField[$i] = `rename ("ClusterControllerGroup" + $i)`; $clusterControlField[$i] = $clusterControlGroupField[$i] + "|" + $clusterControlField[$i]; //create Connections for pickWalk addAttr -ln connection_re -dt "string" ($clusterControlField[$i]); addAttr -ln connection_le -dt "string" ($clusterControlField[$i]); if ($i==1) { connectAttr ($clusterControlField[$i] +".message") ($clusterControlField[$i-1] + ".connection_re"); } if ($i>1) { connectAttr ($clusterControlField[$i-2] +".message") ($clusterControlField[$i-1] +".connection_le"); connectAttr ($clusterControlField[$i] +".message") ($clusterControlField[$i-1] +".connection_re"); } if ($i==($cvSC-1)) { connectAttr ($clusterControlField[$i-1] +".message") ($clusterControlField[$i] +".connection_le"); } string $pOC3 = `createNode pointOnCurveInfo`; // I´d really like to know why this is necessary ??? if ($i==0) setAttr ($pOC3 + ".pr") (0.001); else { if ($cvSC>4) { if ($i==1) { setAttr ($pOC3 + ".pr") (0.333); } else { if ($i==($cvSC-1)) setAttr ($pOC3 + ".pr") ($i - 2); else { if ($i==($cvSC-2)) setAttr ($pOC3 + ".pr") ($i - 1.333); else setAttr ($pOC3 + ".pr") ($i-1); } } } else { if($i==1) setAttr ($pOC3 + ".pr") (0.33); if($i==2) setAttr ($pOC3 + ".pr") (0.66); if($i==3) setAttr ($pOC3 + ".pr") (1); } } connectAttr -f ($targetCurveShape[0] + ".worldSpace[0]") ($pOC3 + ".inputCurve"); // neuer Ansatz: string $pMA = `shadingNode -asUtility plusMinusAverage`; setAttr ($pMA + ".operation") 2; connectAttr ($pOC3 + ".position") ($pMA + ".input3D[0]"); connectAttr ($clusterControlField[$i] + ".translate") ($pMA + ".input3D[1]"); connectAttr ($pMA + ".output3D") ($clusterControlGroupField[$i] + ".translate"); // tangentConstraint select -r $targetCurve; select -tgl $clusterControlField[$i]; tangentConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "objectrotation" -worldUpVector 0 1 0 -worldUpObject ($targetCurve); // color setAttr ($clusterControlField[$i] + ".overrideEnabled") 1; setAttr ($clusterControlField[$i] + ".overrideColor") 31; // connect cluster with controller //set Attr $xV = getAttr ($targetCurveShape[0] + ".controlPoints[" + $i + "].xValue"); setAttr ($clusterControlField[$i] + ".translateX") ($xV); setAttr ($clusterControlField[$i] + ".translateY") (getAttr ($targetCurveShape[0] + ".controlPoints[" + $i + "].yValue")); setAttr ($clusterControlField[$i] + ".translateZ") (getAttr ($targetCurveShape[0] + ".controlPoints[" + $i + "].zValue")); //connect connectAttr -f ($clusterControlField[$i] + ".translateX") ($targetCurveShape[0] + ".controlPoints[" + $i + "].xValue"); connectAttr -f ($clusterControlField[$i] + ".translateY") ($targetCurveShape[0] + ".controlPoints[" + $i + "].yValue"); connectAttr -f ($clusterControlField[$i] + ".translateZ") ($targetCurveShape[0] + ".controlPoints[" + $i +"].zValue"); } //clean up //position the controller connectAttr ($circleField[0] + ".translate") ($controller + ".translate"); //clean up controller attributes setAttr -e -lock true -keyable false ($controller+ ".translateX"); setAttr -e -lock true -keyable false ($controller+ ".translateY"); setAttr -e -lock true -keyable false ($controller+ ".translateZ"); setAttr -e -lock true -keyable false ($controller+ ".rotateX"); setAttr -e -lock true -keyable false ($controller+ ".rotateY"); setAttr -e -lock true -keyable false ($controller+ ".rotateZ"); setAttr -e -lock true -keyable false ($controller+ ".visibility"); //group and hide the circles select -cl; for ($i=0; $i<(2*$cvSC-2); $i++) { select -add ($circleField[$i]); } group; $circleGroup = `rename ("circleGroup_" + $targetCurveName)`; HideSelectedObjects; //group the circleControllers for ($i=0; $i<(2*$cvSC-2); $i++) { select -add ($circleControlField[$i]); } group; $circleControllerGroup = `rename ("circleControllerGroup_" + $targetCurveName)`; //group the clusterControllers for ($i=0; $i<($spansSC+3); $i++) { select -add ($clusterControlGroupField[$i]); } group; $clusterControllers = `rename ("clusterControllers_" + $targetCurveName)`; select -cl; //group the aim locators for ($i=0; $i<(2*$cvSC-2); $i++) { select -add ($locatorField[$i]); } string $locatorGroup = `group -n ("locatorAims_" + $targetCurveName)`; setAttr -lock 1 ($locatorGroup + ".visibility") 0; // ... and the up locators /*for ($i=0; $i<(2*$cvSC-2); $i++) { select -add ($upLocatorField[$i]); } $locatorGroup = `group -n ("locatorUps_" + $targetCurveName)`; setAttr -lock 1 ($locatorGroup + ".visibility") 0;*/ // add attributes to the controller addAttr -ln dynamicAmount -at double -min 0 -max 100 $controller; setAttr -e -keyable true ($controller + ".dynamicAmount") 0; addAttr -ln dynamicStart -at long $controller; setAttr -e -keyable true ($controller + ".dynamicStart") (`playbackOptions -q -ast`); addAttr -ln turbulence -at double -min 0 $controller; setAttr -e -keyable true ($controller + ".turbulence") 0.2; addAttr -ln controlCircles -at bool $controller; setAttr -e -keyable true ($controller + ".controlCircles") 1; addAttr -ln creepShape -at bool $controller; setAttr -e -keyable true ($controller + ".creepShape") 1; addAttr -ln controlSquares -at bool $controller; setAttr -e -keyable true ($controller + ".controlSquares") 1; addAttr -ln controlStars -at bool $controller; setAttr -e -keyable true ($controller + ".controlStars") 1; $mD_da = `shadingNode -asUtility multiplyDivide`; setAttr ($mD_da + ".input2X") 100; setAttr ($mD_da + ".operation") 2; setAttr ($mD_da + ".input2X") 100; // connections connectAttr -f ($controller + ".dynamicAmount") ($mD_da + ".input1X"); connectAttr -f ($mD_da + ".outputX") ($bSNode[0] + "." + $dynCur[0]); connectAttr -f ($controller + ".dynamicStart") ($hss[0] + ".startFrame"); connectAttr -f ($controller + ".turbulence") ($hss[0] + ".turbulenceStrength"); // connect these attributes connectAttr -f ($controller + ".controlCircles") ($circleControllerGroup + ".visibility"); connectAttr -f ($controller + ".creepShape") ($leidenSurface + ".visibility"); connectAttr -f ($controller + ".controlSquares") ($clusterControllers + ".visibility"); connectAttr -f ($controller + ".controlStars") ($targetCurve + "_clusterAnimator.visibility"); // group dynamic stuff select -r ($hss[0]); string $hss_dag[] = `listTransforms ($hss[0])`; select -add ($hss_dag[0] + "Follicles"); select -add ($hss_dag[0] + "OutputCurves"); group -n ("dynamic_creep_" + $targetCurveName); setAttr -lock 1 ("dynamic_creep_" + $targetCurveName + ".visibility") 0; //group em all setAttr ($leidenSurface + ".inheritsTransform") 0; select -cl; select -add ("dynamic_creep_" + $targetCurveName); select -add $controller; select -add $leidenSurface; select -add $sourceCurve; select -add $locatorGroup; select -add $circleGroup; select -add $circleControllerGroup; select -add ($targetCurve + "_clusterAnimator"); //select -add $clusterGroup; select -add $clusterControllers; group -n ("creep_" + $targetCurveName); select ("creep_" + $targetCurveName + "|" + $controller); //auto-create hotkey nameCommand -annotation "Pick Walk right" -command "pickWalk_ri" pickWalk_right; hotkey -k "Right" -ctl -name "pickWalk_right"; nameCommand -annotation "Pick Walk left" -command "pickWalk_le" pickWalk_left; hotkey -k "Left" -ctl -name "pickWalk_left"; nameCommand -annotation "select All Underlying Squares" -command "selectAllUnderlyingSquares" selectAllUnderlyingSquares; hotkey -k "Insert" -ctl -name "selectAllUnderlyingSquares"; } global proc pickWalk_ri() { string $current[] = `ls -sl`; string $next = `connectionInfo -sourceFromDestination ($current[0] + ".connection_re")`; if ($next!="") { string $selectMe[]; tokenize($next, ".", $selectMe); select -r ($selectMe[0]); } } global proc pickWalk_le() { string $current[] = `ls -sl`; string $next = `connectionInfo -sourceFromDestination ($current[0] + ".connection_le")`; if ($next!="") { string $selectMe[]; tokenize($next, ".", $selectMe); select -r ($selectMe[0]); } } global proc selectAllUnderlyingSquares() { string $current[]= `ls -sl`; select -cl; string $selectMe[] = $current; string $next = `connectionInfo -sourceFromDestination ($current[0] + ".connection_re")`; while ($next!="") { $next = `connectionInfo -sourceFromDestination ($selectMe[0] + ".connection_re")`; print ($next); if ($next!="") { tokenize($next, ".", $selectMe); select -add ($selectMe[0]); } } print ("$current=" + $current[0]); select -add ($current[0]); }