zbw_clash.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:zTools 作者: zethwillie 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号