How to get, serialize and deserialize non-linear deformer squash weights in python (Maya)

25 views Asked by At

I am new here, I am looking for an answer that did not manage to find so far.

I need to get the nonlinear squash deformer weights, serialize and deserialize them.

I was trying to get and set the weights like this but it doesn't work. it looks it gets the weights list but then it doesn't apply them.

# get weights
vertices = cmds.polyEvaluate('C_body_PLY', v=1) - 1
deformerNode = 'squash1'
weight = cmds.getAttr('{0}.weightList[0].weights[0:{1}]'.format(deformerNode, vertices))
# set weights
cmds.setAttr('{0}.weightList[0].weights[0:{1}]'.format(deformerNode, vertices), *weight, size=len(weight))

Is there anyone who knows how to do it?

0

There are 0 answers