im new to api, but attempting to write a plugin to transfter cluster membership and weights from one poly object to another. ive written in as a python script but is slow so id like to convert it to python api.
the problem im running into is using MFnWeightGeometryFilter.
should i be able to specify and object in that function: cluster = OpenMayaAnim.MFnWeightGeometryFilter(obj) ?
becuase i get and error: 'Object is incompatible with this method'
for starters, im trying to convert the following code from the maya example plugin, clusterWeightFunction.cpp...
MSelectionList list;
MGlobal::getActiveSelectionList(list);
// Get the cluster
MFnWeightGeometryFilter cluster;
MObject dgNode;
list.getDependNode(0, dgNode);
if (!cluster.setObject(dgNode))
return MS::kFailure;
// Get the object
MDagPath dagPath;
MObject component;
list.getDagPath(1, dagPath, component);
heres what i get:
import maya.OpenMaya as OpenMaya
import maya.OpenMayaAnim as OpenMayaAnim
list = OpenMaya.MSelectionList()
OpenMaya.MGlobal.getActiveSelectionList(list)
cluster = OpenMayaAnim.MFnWeightGeometryFilter()
dgNode = OpenMaya.MObject()
list.getDependNode(0,dgNode)
if not (cluster.setObject(dgNode)):
print 'error'
dagPath = OpenMaya.MDagPath()
component = OpenMaya.MObject()
list.getDagPath(1, dagPath, component)
again, i get this error: 'Object is incompatible with this method'
any ideas what im doing wrong? thanks.