getWeights and setWeights on lattices through API

48 views
Skip to first unread message

Daniele Dolci

unread,
Nov 26, 2020, 7:36:49 AM11/26/20
to Python Programming for Autodesk Maya
Hi guys! 

I am working on a little tool to optimize the speed of importing and exporting weights of many deformers on a large number of geometries. I got it to work for the skincluster using the MFnSkinCluster, and I was looking into the MFnWeightGeometryFilter  for the other type of deformers but I soon realized it doesn't work for every deformer.

In particular, with a simple cluster, this works:
from maya import cmds
import maya.OpenMaya as om
import maya.OpenMayaAnim as oma

deformer = "DEFORMER_NAME"
mSel = om.MSelectionList()
mSel.add(deformer)
deformerObj = om.MObject()
mSel.getDependNode(0, deformerObj)
deformerFn = oma.MFnWeightGeometryFilter(deformerObj)

deformerFn.setWeight(.............)


However if I try this with a lattice I get a kInvalidParameter error

I tried to look into MFnLatticeDeformer but it seems like it does not have setWeight methods. 

Do you have any idea? I guess it is a trivial problem with an obvious solution and hopefully I just need fresh eyes to look at the problem...

Thanks in advance guys!
Cheers,
Daniele
Reply all
Reply to author
Forward
0 new messages