如何使用Maya Python API 2.0设置Clutser Deformer权重?

时间:2017-01-19 07:08:04

标签: python maya maya-api

这是不完整的代码,我的输入在此代码中提及(群集,几何及其值)。我可以使用哪个类来设置集群权重?是否可以使用maya.api.OpenMayaAnim.MFnSkincluster来设置群集权重。

import maya.api.OpenMaya as om
import maya.api.OpenMayaAnim as oma

#inputs    
myCluster   = ['cluster1', 'clusterHandle']
meshShape   = 'pSphereShape'

vertexList  = [1,2,3,4,5]
weights     = [1.0, 0.5, 0.5, 0.5, 0.5]

#To MObject    
clusterList     = om.MSelectionList () 
clusterList.add (myCluster[0])
clusterMObject  = clusterList.getDependNode (0)

meshList        = om.MSelectionList () 
meshList.add (myCluster[0])
meshMObject     = meshList.getDependNode (0)

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

有两篇有用的帖子展示了如何使用OpenMaya.MPlug()课程代替OpenMayaAnim.MFnSkinCluster.setWeights()MFnSkinCluster.setBlendWeights()

Dealing with skinCluster weights in Maya

Setting blendShape weights through Maya API