try import maya.cmds as cmdstransforms = cmds.ls(type='transform')deleteList = []for tran in transforms: if cmds.nodeType(tran) == 'transform': children = cmds.listRelatives(tran, c=True) if children == None: print '%s, has no childred' %(tran) deleteList.append(tran)if len(deleteList) > 0: cmds.delete(deleteList)
Run this in the python tab in your script editor. import maya.cmds as cmdstransforms = cmds.ls(type='transform')deleteList = []for tran in transforms: if cmds.nodeType(tran) == 'transform': children = cmds.listRelatives(tran, c=True) if children == None: print '%s, has no childred' %(tran) deleteList.append(tran)…
THNKR, that rarely works. Not sure what maya considers empty transforms but it's pretty picky, I think even a group within a group doesn't qualify for delete.
I usually found Optimise Scene Size works pretty well, provided you've deleted history. If you don't delete history on all your objects, the transforms which appear "empty" in the outliner may still have connections to valid objects in your scene (eg. after a Combine operation, the previous transforms are now empty but…