Tuesday, January 24, 2012

Joint Labeling Mel Script

This is outdated but I'll keep it here as mel reference..

Please refer to my Maya-Python function for Joint Labeling.

// This script joint labels your selected left joints. The script is very easy to modify to label the right and center joints as well.
// The script is name dependent. Currently my joints are named jntName_lf.
// It will strip out jnt and _lf from the name. If your joints are named differently feel free to modify it below in the Subsitute Command.
// If you have any questions feel free to email me at AndrewChan1985@gmail.com, or leave a comment below. Cheers!

string $mySelJnts[] = `ls -sl`;
for ($jnt in $mySelJnts)
// center jnts use 0.
// left jnts use 1.
// right jnts use 2.
setAttr ($jnt + ".side") 1;
// currently sets the type to other.
setAttr ($jnt + ".type") 18;
// strips out the name of the joint so have matching label names
string $jntNewName;
$jntNewName = `substitute "jnt" $jnt ""`;
$jntNewName = `substitute "_lf" $jntNewName ""`;
setAttr -type "string" ($jnt+".otherType") $jntNewName;

No comments: