CGTalk > Software Specific Forums > Autodesk Maya > Maya Programming
To minimize the ads you see on this page create a CGTalk account and log in HERE
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 11-20-2006, 06:57 AM   #1
StefanStavrev
Art Crazy
 
StefanStavrev's Avatar
portfolio
Stefan Stavrev
Macedonia
 
Join Date: Jun 2006
Posts: 325
Send a message via Yahoo to StefanStavrev
Rename multiple objects with one name...

I wrote this script to rename multiple selected objects with one name plus apropriate integer.

For example i set the name to stefan , the first selected object will be stefan,the second stefan1,then stefan2,stefan3 ....

A problem eoccurs when i rename parented objects.For example, i have two cubes in my scene.One is parent and one i child.By excecuting this script they both receive stefan.
By the way i select them firts as separate objects.Here is the script :

//////////////////////////////////////////////////////

proc renameObjectsOneName() {
string $sel[] = `ls -sl`;
for($each in $sel) {
string $Text = `textField -q -text textfield1`;
rename $each $Text;
}
}

//////////////////////////////////////////////////////

You have any idea how to make it work with parented objects too ?
 
Old 11-20-2006, 10:19 AM   #2
grantimus
Frequenter
 
grantimus's Avatar
portfolio
Grant Heath
technical artist
iWorlds Simulations
Sandy, USA
 
Join Date: Apr 2002
Posts: 138
Send a message via AIM to grantimus Send a message via MSN to grantimus
With the rename command, Maya does not automatically add 1,2,3 etc. to an objects name if that object already exits. In the rename command you'll have to tell it what that integer should be.

Try this:

Code:
proc renameObjectsOneName() { string $sel[] = `ls -sl`; for($i=0;$i<size($sel);$i++) { string $Text = `textField -q -text textfield1`; rename $sel[$i] ($Text + $i); } }


Also keep in mind that if you have the parent selected, Maya will hightlight the parent and child. However, the ls command will only return the parent. Make sure that you really do have everything selected.
 
Old 11-20-2006, 10:19 AM   #3
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:16 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.