commands.py 文件源码

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

项目:config 作者: mindbender-studio 项目源码 文件源码
def create_ncloth(input_mesh):
    """Replace Create nCloth menu item

    This performs the identical option of nCloth -> Create nCloth
    with the following changes.

    1. Input mesh not made intermediate
    2. Current mesh and shape named "currentMesh"

    Arguments:
        input_mesh (str): Path to shape

    """

    assert cmds.nodeType(input_mesh) == "mesh", (
        "%s was not of type mesh" % input_mesh)

    nucleus = cmds.createNode("nucleus", name="nucleus1")
    ncloth = cmds.createNode("nCloth", name="nClothShape1")
    current_mesh = cmds.createNode("mesh", name="currentMesh")

    cmds.connectAttr(input_mesh + ".worldMesh[0]", ncloth + ".inputMesh")
    cmds.connectAttr(ncloth + ".outputMesh", current_mesh + ".inMesh")
    cmds.connectAttr("time1.outTime", nucleus + ".currentTime")
    cmds.connectAttr("time1.outTime", ncloth + ".currentTime")
    cmds.connectAttr(ncloth + ".currentState", nucleus + ".inputActive[0]")
    cmds.connectAttr(ncloth + ".startState", nucleus + ".inputActiveStart[0]")
    cmds.connectAttr(nucleus + ".outputObjects[0]", ncloth + ".nextState")
    cmds.connectAttr(nucleus + ".startFrame", ncloth + ".startFrame")

    # Assign default shader
    cmds.sets(current_mesh, addElement="initialShadingGroup")

    return current_mesh
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号