【发布时间】:2014-05-07 02:21:41
【问题描述】:
我正在尝试从 python maya api 中的目标网格中找到一个 blendshape 变形器。我很确定我必须遍历依赖关系图才能获得 blendshape。
这就是我正在尝试的:
import maya.OpenMaya as OpenMaya
import maya.OpenMayaAnim as OpenMayaAnim
#Name of our targetmesh.
targetMesh = "pSphere1"
#Add selection.
mSel = OpenMaya.MSelectionList()
mSel.add(targetMesh, True)
#Get MObj
mObj = OpenMaya.MObject()
mSel.getDependNode(0, mObj)
#Make iterator.
itDG = OpenMaya.MItDependencyGraph(mObj,
OpenMaya.MFn.kBlendShape,
OpenMaya.MItDependencyGraph.kUpstream)
while not itDG.isDone():
oCurrentItem = itDG.currentItem()
blndSkin = OpenMayaAnim.MFnBlendShapeDeformer(oCurrentItem)
print blndSkin
break
很遗憾,我没有获得 blendshape 变形器。
与 maya.cmds 相同的示例:
import maya.cmds as cmds
targetMesh = "pSphere1"
history = cmds.listHistory(targetMesh, future=True)
blndshape = cmds.ls(history, type="blendShape")
print blndshape
任何帮助将不胜感激!
【问题讨论】: