# create a cloth node
cmds.createNode("nCloth")
# connect time node
cmds.connectAttr("time1.outTime", nCloth + ".currentTime")
# connect your mesh to the ncloth
cmds.connectAttr(mesh + ".worldMesh", nCloth + ".inputMesh")
# create an output shape that will be the simulation mesh
outMesh = cmds.createNode("mesh", parent=tform, name=outMeshName)
cmds.connectAttr(nCloth + ".outputMesh", outMesh + ".inMesh")
# connect the startframe
cmds.connectAttr(nucleus + ".startFrame", nCloth + ".startFrame")
# Connect the cloth node to the nucleus with an available ID
cmds.connectAttr(nCloth + ".currentState", nucleus +".inputActive[{}]".format(nindex), f=1)
cmds.connectAttr(nCloth + ".startState", nucleus + ".inputActiveStart[{}]", f=1)
# force the refresh when used in batch
cmds.getAttr(cloth + ".forceDynamics")
@itypewithmyhands为您提供了查找MEL程序内部内容的方法
请注意,控制用户选择需要进行大量检查,主要是:
因此,这些是复制基本cloth网络的必要步骤。请注意,您还必须创建nucleus,可能需要检查基础网格是否变形,您可能需要将输入网格设置为中间形状。。。等
如果在Maya脚本编辑器的
MEL
选项卡中运行此命令,将获得:简单地浏览一下
createNCloth.mel
脚本,它看起来有些复杂。您可以通过maya.mel
模块从python中自己调用此脚本,不幸的是,这通常是一些专门的Maya集成的方式请记住
createNCloth(<worldSpace>)
程序希望选择网格,而不允许将对象作为参数传递相关问题 更多 >
编程相关推荐