rename duplicate nodes in Maya script?

1,277 views
Skip to first unread message

David Lawson

unread,
Sep 22, 2010, 1:05:25 PM9/22/10
to maya...@googlegroups.com
Hey,

Does anyone have a script that will search for and rename duplicate nodes in Maya?

stephenkmann

unread,
Sep 22, 2010, 1:13:03 PM9/22/10
to maya...@googlegroups.com
I havn't looked at it, but I bet this would do what you wanted.
finding them is the hard part
renaming is the easy..

( i have my own script but I can't release it) but the trick is
for each in scene
ls "*name*"

hth

-=s

http://www.creativecrash.com/maya/downloads/scripts-plugins/modeling/misc/c/duplicate-check

Hamish McKenzie

unread,
Sep 22, 2010, 8:18:38 PM9/22/10
to maya...@googlegroups.com
there is a method on MFnDependencyNode called "hasUniqueName". just
iterate over all dag nodes in the scene and ask whether it has a
unique name or not.

def iterNonUniqueNames():
iterNodes = MItDag() #NOTE: only dag objects can have non-unique
names... despite the fact that the hasUniqueName method lives on
MFnDependencyNode (wtf?!)

while not iterNodes.isDone():
mobject = iterNodes.currentItem()
if not MFnDependencyNode( mobject ).hasUniqueName():
yield mobject

iterNodes.next()

-h.

David Lawson

unread,
Sep 23, 2010, 4:58:19 AM9/23/10
to maya...@googlegroups.com
thanks stephen,

that seemed to work
Reply all
Reply to author
Forward
0 new messages