getWeights and setWeights on lattices through API

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()
deformerObj = om.MObject()
mSel.getDependNode(0, deformerObj)
deformerFn = oma.MFnWeightGeometryFilter(deformerObj)


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!