good,my proc goes wrong,but I have no idea to solve it.
please do it like this,you should have a circle with an attribute "caterpillar".
then input 8 in the UI.and last press the "create" button blow.
maya sync will tell you that......
sos...
the procedure is :
////////////////////////////////////////////////////////////////////////////////////////*author:David Shower ? All Rights Reserved.. created in :8/11/2013 Descriptions: the procedure is for rigging any caterpillars automatically, but at first the script needs a curve which is alignd with the caterpillar but at first the script needs a curve which is alignd with the ca model, and it would be best that the curve is 3 cubic degree, making sure that the CVs is evenly distributed in the curve. Note that maybe you should add an attribute called "move" for the aligned curve. Note that maybe you should add an attribute called "move" curvefor the aligned curve. Direction:@#$@$@@@.....*/autoRigCaterWindow;global proc autoRigCaterWindow(){/////////////////////////////////////////////////////////// string $directions[] = {"none","left","right","front","rear"};///////////////////////////////////////////////////////////////////////////////////// if(window -q -exists ds\_autoRigWin
) deleteUI ds_autoRigWin; window -title "Auto Rig Caterpillar,V1.0." -iconName "cat" ds_autoRigWin; columnLayout; separator -width 306 -style "out"; setParent..; rowColumnLayout -numberOfColumns 3; separator -height 40 -horizontal false -style "out"; text -align "left" -font "boldLabelFont" -label "the setup machine for script automatically for rigging\ncaterpillar.\n\nSynopsis:it would be best that the curve is 3 cubic de\n-gree.making sure that the CVs is evenly distributed i\n-n the curve,because we have more excuted about th\n-e curve."; separator -height 40 -horizontal false -style "out"; setParent..; columnLayout -rowSpacing 4; separator -width 306 -style "out";
formLayout -nd 100 autoSetupForm; text -label "The Caterpillar Has" textA; intField -width 45 cateNumbers; text -label "Pieces" textB; text -label "Dirc :" dircLabel; optionMenuGrp dircOMG; for($item in $directions) { menuItem -label $item; } button -label "setup" -bgc 1 1 0 -width 303 -command "autoSetupMachine" rigButton;
setParent..; separator -width 306 -style "out"; text -align "left" -font "smallBoldLabelFont" -label "For Finishing It Perfectly,Please Read Me Before Setup.Reme\n-mber The Script Needs You Manually To Add A caterpillar\nAttribute.\n ----David Shower" textC; formLayout -edit -attachForm textA "left" 10 -attachForm textA "top" 3 -attachControl cateNumbers "left" 4 textA -attachForm cateNumbers "top" 1 -attachControl textB "left" 4 cateNumbers -attachForm textB "top" 3 -attachControl dircLabel "left" 27 textB -attachForm dircLabel "top" 4 -attachControl dircOMG "left" 1 dircLabel -attachNone dircOMG "right" -attachForm rigButton "left" 2 -attachControl rigButton "top" 5 cateNumbers autoSetupForm; showWindow ds_autoRigWin;};//return an option menu group's value with the procedure.global proc string getValOfDirc(){ string $valOfDirc = optionMenuGrp -q -value dircOMG
; return $valOfDirc;}
//create some locators as sampleglobal proc autoSetupMachine(){ string $curveList[] = ls -sl
; if(!size $curveList
) warning "Nothing Selected!"; else { int $i = 0; $listShapeNode = listRelatives -s $curveList[0]
;//print $listShapeNode[0] if(objectType -isType "nurbsCurve" $listShapeNode[0]
) { $directions = getValOfDirc
; setAttr ($listShapeNode[0] + ".dispCV") 1; $newName = rename $curveList[0] ($directions + "\_caterCurve")
;//rename the caterpillar curve if(attributeExists "caterpillar" $newName
) { $pociNode = createNode pointOnCurveInfo
; $newNodeName = rename $pociNode ($directions + "\_caterPoci")
; connectAttr -f ($newName + ".worldSpace") ($newNodeName + ".inputCurve"); $NonTitleNode = createNode unknown
; addAttr -ln "locators" -at message -multi -im 0; int $howManyPieces = intField -q -value cateNumbers
; for($i = 0;$i < $howManyPieces;$i++) { float $CvWorldPosition[] = xform -q -ws -t ($newName + ".cv[" + $i + "]")
; string $worldLoc[] = spaceLocator
; setAttr ($worldLoc[0] + ".tx") $CvWorldPosition[0]; setAttr ($worldLoc[0] + ".ty") $CvWorldPosition[1]; setAttr ($worldLoc[0] + ".tz") $CvWorldPosition[2]; $newLocName[0] = rename ($directions + "\_" + $worldLoc[0])
; connectAttr -na ($newLocName[0]+".message") ($NonTitleNode + ".locators"); } $treadExpr = "\"" + "$cater = " + $newName + ".caterpillar;\n" + "if($cater >= 0)\n{\n" + "int $a = 0;\n" + " for($a = 0;$a < " + $howManyPieces + ";$a++)\n" + " {\n" + "\tstring $sampleLocs = listConnections (" + $NonTitleNode + ".locators" + "[\"$a\"])
;\n" + "\tsetAttr " + $newNodeName + ".parameter" + " (" + $howManyPieces + "linstep(0," + $howManyPieces + ",($cater + $a)%" + $howManyPieces + "));\n" + "\tfloat $posVal[] = getAttr " + $newNodeName + ".position" + "
;\n" + "\t$sampleLocs" + ".translateX" + " = $posVal[0];\n" + "\t$sampleLocs" + ".translateY" + " = $posVal[1];\n" + "\t$sampleLocs" + ".translateZ" + " = $posVal[2];\n" + " }\n" + "}\n" + "\""; expression -s $treadExpr -n "treadsAnimExpr" -ae 1 -uc all; } else { print("Oppps...!!!There Has No An Attribute Called *caterpillar@#$%##$!!\n"); } } }}