def detectClashes(fixClashes=True):
"""
look in the scene and returns a list of names that clash (transform only, as shapes will get taken care of by
renaming or another pass of cleaning shapes)
"""
clashingNames = []
mayaResolvedName = {}
allDagNodes = cmds.ls(dag=1) # get all dag nodes
for node in allDagNodes:
if cmds.objectType(node) == "transform": # only transforms
if len(node.split("|")) > 1: # is it a dupe (split by "|")
clashingNames.append(node.split("|")[-1]) # add it to the list
clashes = set(clashingNames) # get rid of dupes, so only one of each name
print "\n==========================="
print "Clashing objects: {}".format(list(clashes))
if fixClashes and clashes:
fixFirstClash(clashes, 0)
elif clashes and not fixClashes:
for clash in clashes:
print "CLASH -->", clash
print cmds.ls(clash)
if not clashes:
cmds.warning("No transform clashes found")
# return(list(clashes))
评论列表
文章目录