Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Renaming imported nodes?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
437 Views, 2 Replies

Renaming imported nodes?

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
2 REPLIES 2
Message 2 of 3
lee.dunham
in reply to: Anonymous

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";
Message 3 of 3
Anonymous
in reply to: lee.dunham

That´s working very well man!

Thanks a lot.

😉

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report