eval( "source \"Y:/Projects/PaperRockSwords/flockingCode/kevinscode/insertPoisson.mel\"" ); file -f -new; $rowsize = 12; $columns = 5; $boundX = 60; $boundZ = 100; $armyOffset = 10; playbackOptions -max 1000; string $circleName = "GuyRock"; string $squareName = "GuyBlock"; string $CircleGuy = "CircleGuy_grp"; string $SquareGuy = "SquareGuy_grp"; string $circleChar = "CircleGuy"; string $squareChar = "SquareGuy"; float $x; int $n; $n = 1; $xstart = 10; $zstart = 10; $xstart2 = -10; $zstart2 = 10; $guyno = 50; $row = 1; int $numberOfGuys = $rowsize * $columns; $spacing = 5; // import walk clips file -import -type "mayaAscii" -rpr "Circle_Walk" -options "v=0;p=17" -pr "Y:/Projects/PaperRockSwords/ProductionFiles/AnimationClips/JustClips/Circle_Walk.ma"; rename "WalkSource" "CircleWalk"; file -import -type "mayaAscii" -rpr "Square_Walk" -options "v=0;p=17" -pr "Y:/Projects/PaperRockSwords/ProductionFiles/AnimationClips/JustClips/Square_Walk.ma"; rename "SquareWalkSource" "SquareWalk"; // import square character pv_performAction "Y:/Projects/PaperRockSwords/ProductionFiles/Models/060218_SquareCHAR.mb" "mayaBinary"; file -import -type "mayaBinary" -rpr "060218_SquareCHAR" -options "v=0" -pr "Y:/Projects/PaperRockSwords/ProductionFiles/Models/060218_SquareCHAR.mb"; // import circle guy pv_performAction "Y:/Projects/PaperRockSwords/ProductionFiles/Models/060302_CircleCHAR.mb" "mayaBinary"; file -import -type "mayaBinary" -rpr "060216_CircleCHAR" -options "v=0" -pr "Y:/Projects/PaperRockSwords/ProductionFiles/Models/060302_CircleCHAR.mb"; $n = 0; // copy guys for($j=0;$j<$columns;$j++) { for($i=0;$i<$rowsize;$i++) { float $randX = rand($boundX) - $armyOffset; float $randZ = rand($boundZ); float $randRot = rand(360); $n++; string $new_group[]; select -r $CircleGuy; $new_grp = `duplicate -rr -un`; rename ($new_grp[0]) ($circleName + $n); int $rand = -1*rand(31); clip -copy "CircleWalk"; string $walkclip_circle[] = `clip -pasteInstance -aa -sc 1 -startTime $rand -mapMethod byAttrName ($circleChar + $n)`; setAttr ($walkclip_circle[0] + ".postCycle") 100; setAttr ($walkclip_circle[0] + ".weightStyle") 1; addAttr -ln Battleflag -sn ib -at short -min 0 -max 10 -dv 0.0 -keyable true; addAttr -ln Target -sn tg -dt "string" -keyable true; addAttr -ln Velocity -sn vl -at double -dv .5 -keyable true; addAttr -ln char -sn ch -dt "string"; setAttr ($circleName + $n + ".char") -type "string" ($circleChar + $n); select -r ($circleChar + $n); addAttr -ln clipdone -at short -dv 1 -keyable true; addAttr -ln currentclip -dt "string" -keyable true; setAttr ($circleChar + $n + ".currentclip") -type "string" ($walkclip_circle[0]); addAttr -ln grp -dt "string"; setAttr ($circleChar + $n + ".grp") -type "string" ($circleName + $n); float $overlap = insertPoisson($randX, $randZ); while($overlap == 1) { $randX = rand($boundX) - $armyOffset; $randZ = rand($boundZ); $overlap = insertPoisson($randX, $randZ); } setAttr ($circleName + $n + ".rotateY") 90; setAttr ($circleName + $n + ".translateX") ($randX); setAttr ($circleName + $n + ".translateZ") $randZ; } } $n=0; string $guys[] = `select "Guy*"`; print("size of guys after first loop = " + (size($guys)) + "\n"); for($j=0;$j<$columns;$j++) { for($i=0;$i<$rowsize;$i++) { float $randX = rand($boundX) + $armyOffset; float $randZ = rand($boundZ); float $randRot = rand(360); $n++; select -r $SquareGuy; $new_grp = `duplicate -rr -un`; string $rig = $new_grp[0] + "|SquareGuyRig_grp"; rename $rig ($squareName + $n); select -r ($squareName + $n); addAttr -ln Battleflag -sn ib -at short -min 0 -max 10 -dv 0.0 -keyable true; addAttr -ln Target -sn tg -dt "string" -keyable true; addAttr -ln Velocity -sn vl -at double -dv .5 -keyable true; int $rand = -1*rand(31); clip -copy "SquareWalk"; string $walkclip_square[] = `clip -pasteInstance -aa -sc 1 -startTime $rand -mapMethod byAttrName ($squareChar + $n)`; setAttr ($walkclip_square[0] + ".postCycle") 100; setAttr ($walkclip_square[0] + ".weightStyle") 1; addAttr -ln char -sn ch -dt "string"; setAttr ($squareName + $n + ".char") -type "string" ($squareChar + $n); select -r ($squareChar + $n); addAttr -ln clipdone -at short -dv 1 -keyable true; addAttr -ln currentclip -dt "string" -keyable true; setAttr ($squareChar + $n + ".currentclip") -type "string" ($walkclip_square[0]); addAttr -ln grp -dt "string"; setAttr ($squareChar + $n + ".grp") -type "string" ($squareName + $n); float $overlap = insertPoisson($randX, $randZ); while($overlap == 1) { $randX = rand($boundX) + $armyOffset; $randZ = rand($boundZ); $overlap = insertPoisson($randX, $randZ); } setAttr ($squareName + $n + ".rotateY") -90; setAttr ($squareName + $n + ".translateX") ($randX); setAttr ($squareName + $n + ".translateZ") $randZ; } } delete $CircleGuy; delete $SquareGuy; string $expString; $expString = "string $objects[] = `ls \"Guy*\"`;\n"; $expString += "for($i=0;$i