I'd like to name my meshes based on their applied material names. Is there any script available to do such a thing or could some scripting wizard be kind enough to create such a script?
Thanks,
Material based mesh renaming
-
- Moderator
- Posts: 169
- Joined: 26 Oct 2009, 10:04
Material based mesh renaming
- Zafar Iqbal
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: Material based mesh renaming
Something simple like this Python snippet? Appends the material name to the existing object name.
One or more geometries need to be selected, it obviously doesn't do error checking (costs extra! )
Throw it into a custom command, if needed
Use at own risk, obviously, I spent about 30 seconds testing this code...
Code: Select all
howmany = Application.Selection.Count
for i in range(0, howmany):
thisobj = Application.Selection(i)
thismat = thisobj.Material.Name
thisobj.Name = str(thisobj.Name) + "_" + str(thismat)
Throw it into a custom command, if needed
Use at own risk, obviously, I spent about 30 seconds testing this code...
Stay safe, sane & healthy!
-
- Moderator
- Posts: 169
- Joined: 26 Oct 2009, 10:04
Re: Material based mesh renaming
Awesome. Thanks a bunch for this, it worked like a charm and super fast on the 139 objects I just tried it on, all from different models/hierarchy levels.
Thanks
Thanks
- Zafar Iqbal
Who is online
Users browsing this forum: No registered users and 28 guests