Maya deformerWeights command multiple shapes

I’m trying to figure out how deformerWeights() works with multiple shapes and one deformer.

Eg: I have ffd1 applied on pCone1 and pCube1. I’m exporting and imoprting the painted weights with:

import os
import maya.cmds as mc

home_dir = os.environ["HOME"]

path= os.path.join(home_dir, "weights")
if not os.path.exists(path):
# Export
mc.deformerWeights("weights.json", export=True, deformer="ffd1", fm="JSON", path=path, shape=['pCubeShape1', 'pConeShape1'])

# import
mc.deformerWeights("weights.json", im=True, deformer="ffd1", fm="JSON", path=path)

The data in json file is correct but I get Maya crash when import it. So what is the way guys you use to handle this?
Or maybe I should just write my own import/exporter?

1 Like

I don’t have a solution. I just know that deformerWeights() was messed up for me too in Maya 2018. I was attempting to use it for deltaMush, and I seem to remember it was either crashing, mangling the weights, or both.

I ended up writing a pretty awful script that set the deltaMush.weightList[idx] manually for each vertex. Unfortunately, the only comment I left myself at the time was:

# deformerWeights is busted... Set the weights manually......

Were you able to run this correctly when there is an FFD on only one single shape?

1 Like

Thanks Chris for your reply.
Yes, with one shape it works but in my case and I think for everyone who do rigs it’s useless. I don’t understand why it writes data and then can’t apply it. It is quite frustrating
At least now I know that I need to write my own tool.