2

This is the incomplete code, my inputs are mention in this codes (cluster, geometry and its values). Which class i can use for set the cluster weights?. Is it possible to use maya.api.OpenMayaAnim.MFnSkincluster to set cluster weights.

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)

Any help would be greatly appreciated!

Subin Gopi
  • 541
  • 2
  • 12

1 Answers1

0

There are two useful posts showing how to use OpenMaya.MPlug() class instead of OpenMayaAnim.MFnSkinCluster.setWeights() and MFnSkinCluster.setBlendWeights().

Dealing with skinCluster weights in Maya

Setting blendShape weights through Maya API

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • Thank you for sharing your knowledge with me, But Actually I want to manage only the Cluster weights, I want to set cluster weights in geometry, not a skin cluster. – Subin Gopi Apr 22 '17 at 06:01