Hey,
This method does iterate through shapes in the scene, but it doesn't seem
to have too much overhead.
import string
shapes = cmds.ls(shapes=True) # List shapes in scene
nonUniqueShapes = [n for n in shapes if '|' in n] # Find all non-unique
shape nodes
nonUniqueShapes.sort(key=lambda x : x.count('|'), reverse=True) # Reverse
list (children first)
for shape in nonUniqueShapes: # Rename
cmds.rename(shape, '{0}#'.format(shape.rpartition('|')[-1].rstrip(string.
digits)))
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/45fd8098-1280-45a4-8040-db2318675aab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.