Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to return the number of object with the same name with Mel?

How to return the number of object with the same name with Mel?

NioKasgami
Observer Observer
1,156 Views
2 Replies
Message 1 of 3

How to return the number of object with the same name with Mel?

NioKasgami
Observer
Observer

Hello,

 

My name is Nicolas and I'm currently a 3D animation senior student at la Cité collégial and one of my final project for my 3D animation technology class is to make a Tool for Maya using Mel.

 

For say I do have programming knowledge so you don't have to worry to use programming term while explaining to me 🙂 

 

So the point of my tool is to make a Sphere who have a "good" retopology. Since we know that the default maya sphere doesn't respect the 3D topology convention. So I'm making a cube then smooth it. Simple although I want to allow user setting on the number of division etc

 

and one of the options is to automatically rename sphere based on a convention naming which is : 

ObjectName_ObjectNumber_MESH

 

Doing concatenating is quite simple. Although, I'm stuck to one point.

 

"How to know how many object of the same name they have in the scene"

 

I want to be able to count the number of object who share the same name then apply it to the naming.

 

I do know that Maya does it automatically but the point of the final project is to make a tool work like the way I intended it to be. This the only part where I struggle.

 

I would be grateful if you can help me for this part

 

Thanks for your further answer!

Nicolas

0 Likes
1,157 Views
2 Replies
Replies (2)
Message 2 of 3

rajasekaransurjen
Collaborator
Collaborator

hi,

This will help.

 

https://www.highend3d.com/maya/script/ninja-rename-for-maya

 

Best regards,

Rajasekaran Surjen.

0 Likes
Message 3 of 3

rajasekaransurjen
Collaborator
Collaborator

Hi,

Try this.

 

 

from maya import cmds
all = cmds.ls (tr=1, sn=1, fl=1)
for obj in all:
    if (obj.find("|")>=0):
        print obj

0 Likes