Rename multiple objects with one name...

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 11 November 2006   #1
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 November 2006   #2
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:

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 November 2006   #3
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

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
Society of Digital Artists

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

All times are GMT. The time now is 11:26 PM.

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