Is there any way to do this?
I have a list with weight info and want to load it with just one command per point with setAttr. I’ve just found that using setAttr to set weights for all joints at the same time in one point is incredible fast. ( like 5+ times faster)
Let’s say I have this:
weightData = [0.0, 0.5, 0.5]
and I want to execute:
cmds.setAttr( ‘skinCluster.weightList[0].weights[0:100]’, 0.0, 0.5, 0.5 )
The problem is the weightData is a list, not a sequence of strings so setAttr doesn’t recognize it.
I ended up doing it with a long string and calling it with mel.eval, like this:
for i in range(len(points)):
commText = '"'+ '%s.weightList[%s].weights[%s]' % (skinCl, i, '0:' + str(len(joints)-1) )+'" ' + ' '.join(map(str, weightData[i]))
mel.eval("setAttr " + commText)
It works fine, but I was wondering if I could write it entirely in Python.
Thanks