commands.py 文件源码

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

项目:config 作者: mindbender-studio 项目源码 文件源码
def combine(nodes):
    """Produce a new mesh with the contents of `nodes`

    Arguments:
        nodes (list): Path to shapes

    """

    unite = cmds.createNode("polyUnite", n=nodes[0] + "_polyUnite")

    count = 0
    for node in nodes:
        # Are we dealing with transforms, or shapes directly?
        shapes = cmds.listRelatives(node, shapes=True) or [node]

        for shape in shapes:
            try:
                cmds.connectAttr(shape + ".outMesh",
                                 unite + ".inputPoly[%s]" % count, force=True)
                cmds.connectAttr(shape + ".worldMatrix",
                                 unite + ".inputMat[%s]" % count, force=True)
                count += 1

            except Exception:
                cmds.warning("'%s' is not a polygonal mesh" % shape)

    if count:
        output = cmds.createNode("mesh", n=nodes[0] + "_combinedShape")
        cmds.connectAttr(unite + ".output", output + ".inMesh", force=True)
        return output

    else:
        cmds.delete(unite)
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号