Hey guys, sorry to bother you guys but i got a really frustrating problem. What happens is i’m trying to create an animated joint system that connects to my body skeleton via through MEL. The problem is that the system doesn’t work since when i try and duplicate the Joint hierarchy and then put the name prefix in. It breaks due to having the same name. I was wondering if you guys knew any good workarounds with this issue by chance since its giving me quite a hard time.
The script
string $prefix = "ANM_";
select -hi;//if you want to rename all the children of the selected joint
string $selec[] = `ls -type "joint" -sl`;
if (size($selec) > 0 )
{
for ($each in $selec)
{
string $nodeName = `substitute ".*|" $each ""`;
string $newName = `rename $each ( $prefix + $nodeName )`;
}
}
the issue:
Thanks for the look and thanks in advance
If you use namespaces, you can just create a new namespace, set it active, and duplicate the original skeleton. You’ll get all the same names just prefixed with your namespace and a colon.
This can be tough if you have other scripts that don’t like namespaces, however.
Alternately, use the long names of the root joints to distinguish between skeletons - you can get the long name with ls -l and it will include the entire hierarchy above an object in the name, like ‘|root|pelvis|spine1|spine2|spine3|neck|head’ instead of head. Your duplicate skeletons will look the same but the first component would be different
Listen to Theodox. This is exactly why namespaces exist. Also, is is usually good practice to store the rigs in another Maya file and use references to bring them into an animation or mesh weighting scene. When you make the reference, you can specify a namespace. This way you have one rig that can be re-used numerous times. One change to that single file gets automatically propagated to all the places it is used.