Hello,guys.Happy time!!!A script about rigging the caterpillar treads automactically.by far everything goes fine but the procedure can not describe an expression,which is embeded in the script,in the expression editor.now the partion of the script will show you:
$treadExpr = "\"" + "$cater = " + $newName + ".caterpillar;\n" +
"if($cater >= 0)\n{\n" + "int $a = 0;\n" +
" for($a = 0;$a < " + $howManyPieces + ";$a++)\n" +
" {\n" +
" string $sampleLocs = `listConnections (" + $NonTitleNode + ".locators" + "[\"$a\"])`;\n" +
" setAttr " + $newNodeName + ".parameter" + " (" + $howManyPieces + "*linstep(0," + $howManyPieces + ",($cater + $a)%" + $howManyPieces + "));\n" +
" float $posVal[] = `getAttr " + $newNodeName + ".position" + "`;\n" +
" $sampleLocs" + ".translateX" + " = $posVal[0];\n" +
" $sampleLocs" + ".translateY" + " = $posVal[1];\n" +
" $sampleLocs" + ".translateZ" + " = $posVal[2];\n" +
" }\n" +
"}\n" + "\"";
expression -s $treadExpr -n "treadsAnimExpr" -ae 1 -uc all;
this is a part.
I want to rig the treads automatically with it,and use a node called pointOnCurveInfo to finish it.but it gets here,the wrong runs out.
// Error: Attribute not found or variable missing '$': unknown1.locators[$a] // // Error: $sampleLocs.translateX = $posVal[0]; // // Error: Line 9.23: Syntax error // // Error: $sampleLocs.translateY = $posVal[1]; // // Error: Line 10.23: Syntax error // // Error: $sampleLocs.translateZ = $posVal[2]; // // Error: Line 11.23: Syntax error //
now I can't deal with it,so can you tell me ,thank you ,looking forward to your answer,thanks a lot.