maya嵌入python_Maya:独立和嵌入式mod中的不同行为

在这种情况下,我认为实际上是面包店的旗帜。我能够在maya单机版中使用:import maya.mel

import maya.cmds as cmds

cmds.file(new=True, f=True)

cmds.polyCube()

cmds.polyPlane(sx = 21, sy = 22)

cmds.xform(t= (.0005, .015, .0005)) # note units - my maya is working in meters...

mel.eval("createNCloth 0;")

maya.mel.eval("createNCloth 0;")

cmds.select('pCube1')

maya.mel.eval("makeCollideNCloth")

cmds.playbackOptions(animationStartTime=0)

cmds.playbackOptions(animationEndTime=100)

cmds.play(f=True)

cmds.bakeResults('pPlane1', simulation=True, t=(1,20), disableImplicitControl=True, sb = 1, shape=True, cp=True )

# use openMaya to set the frame - cmds.currentTime does not

# stick in standalone:

import maya.OpenMaya as om

om.MGlobal.viewFrame(20)

# delete the cloth solution

cmds.delete('nCloth1', 'nRigid1')

# delete the orphaned shape

cmds.delete('pPlaneShape1')

cmds.file(rename = "C:/test/cloth.mb")

cmds.file(save=True)

我注意到的两个问题是需要在“烘焙结果”(bake results)中设置“形状”(shape)和“控制点”(control point)标志,以及在删除cloth解算器后需要将烘焙形状从原始几何体中分离出来。在本例中,删除布料和刚体而不删除pPlaneShape1会使原始平面的副本悬空。您可能需要删除并查看结果,以了解此场景中的操作。在

你可能感兴趣的:(maya嵌入python)