Monday 25 October 2010

RE: mel. Place loc on Joint

Update to previous post now ive had chance to test script, so couple of minor changes.


//script to place a locator at position of every joint in scene (if nothings selected) or at the position of every joint in heirachy underneath selection and rename to match joint.
string $mySel[]=`ls -sl` ; string $joints[]=`ls -type joint` ; if(size($mySel)==0) for($i=0;$i<(size($joints));$i++) { float $jntPos[] = `xform -q -ws -piv ($joints[$i])` ; string $loc[] = `spaceLocator -p $jntPos[0] $jntPos[1] $jntPos[2] -n (($joints[$i])+"_loc")` ; for($b =0; $b<(size($loc)); $b++) { select ($loc[$b]) ; CenterPivot ; } } } if(size($mySel)>=1) { select -hi ; string $selJoints[] = `ls -sl` ; for($a=0;$a<(size($selJoints));$a++) { float $selJntPos[] = `xform -q -ws -piv ($selJoints[$a])` ; string $loc[] = `spaceLocator -p $selJntPos[0] $selJntPos[1] $selJntPos[2] -n (($selJoints[$a])+"_loc")` ; for ($b =0;$b<(size($loc));$b++) { select ($loc[$b]) ; CenterPivot ; } } }

No comments:

Post a Comment