Renaming imported nodes?

Renaming imported nodes?

Anonymous
Not applicable
486 Views
2 Replies
Message 1 of 3

Renaming imported nodes?

Anonymous
Not applicable
I´m trying to make a script for rename imported objects automatically following certain rules, and I have problems with that using a stereo camera rig I made...


The code:
$imp = `file -import -type "mayaAscii" -ra true -rpr "cam" -options "v=0" -returnNewNodes -pr -loadReferenceDepth "all" "/192.168.41.11/proyectos/SECRETO MEDALLON/Useless/assets/tools/camara/rig_camara.ma"`;
select $imp;

for( $node in `ls -sl` )
{
rename $node ( `substitute "cam__scn" $node "cam_001"` );
}


I import the file with the "-returnNewNodes" flag for have the list of the imported nodes, then I use this result to, select the imported nodes, and rename it.

It works for the first 2 items in the hierarchy of the rig but for the others don´t change anything and show an the error: // Error: No object matches name //

Do somebody know why?
I attached the camera rig file to check if the problem is in this file
http://dl.dropbox.com/u/42611656/rig_camara.ma
0 Likes
Accepted solutions (1)
487 Views
2 Replies
Replies (2)
Message 2 of 3

lee.dunham
Collaborator
Collaborator
Accepted solution
im having issues with the substitute command, need to check what they are,

in the mean time, try the searchReplaceNames command instead.

$imp = `file -import -type "mayaAscii" -ra true -rpr "cam" -options "v=0" -returnNewNodes -pr -loadReferenceDepth "all" "/192.168.41.11/proyectos/SECRETO MEDALLON/Useless/assets/tools/camara/rig_camara.ma"`;
select $imp;
searchReplaceNames "cam__scn" "cam_001" "selected";
0 Likes
Message 3 of 3

Anonymous
Not applicable
That´s working very well man!

Thanks a lot.

😉
0 Likes