Sunday, 24 October 2010

mel. Place loc on joint

just thinking bout speeding up my productivity led me to just write this little script to place and rename a locator at the position of every joint in the scene (if nothing is selected) or just on the current heirachy of the selection. (i havent even tested this as im on the laptop with no maya :( ) all just from top of me head :)

its not a global proc as its meant to be assigned to a shelf button, but may include into rigging toolset currently WIP (as is an animation toolset and modelling toolset - latter already has a beta version i use at work often already, so the v01 release wont be too long and will be found on here, my website - once finished - and
//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++) { string $jointPos[] = `xform -q -ws -piv ($joints[$i])` ; string $loc = `spaceLocator -p $jointPos[0] jointPos[1] jointPos[2] (($joints[$i])+"_loc")` ; //rename (($joints[$i])+"_loc") $loc ; } } if (size($mySel) >= 1) { select -hi ; string $selJoints[] = `ls -sl` ; for ($a =0; $a<(size($selJoints)); $a++) { string $selJointPos[] = `xform -q -ws -piv ($selJoints[$a])` ; string $loc = `spaceLocator -p $selJointPos[0] selJointPos[1] selJointPos[2] (($selJoints[$a])+"_loc")` ; //rename (($selJoints[$a])+"_loc") $loc ; } }