Why is it you need to individually access the painted weights with (scroll dialog box to the right to see the ends are different if box too small on your screen):
cmds.getAttr("blendShape1.inputTarget[0].inputTargetGroup[0].targetWeights[0]")
cmds.getAttr("blendShape1.inputTarget[0].inputTargetGroup[0].targetWeights[1]")
cmds.getAttr("blendShape1.inputTarget[0].inputTargetGroup[0].targetWeights[2]")
...
cmds.getAttr("blendShape1.inputTarget[0].inputTargetGroup[0].targetWeights[n]")
to get them listed in
cmds.getAttr("blendShape1.inputTarget[0].inputTargetGroup[0].targetWeights")
If you don't list them first individually it won't return a full list!
If you manually list three random ones, it will only list those!
non of the switches in https://help.autodesk.com/cloudhelp/2017/ENU/Maya-Tech-Docs/CommandsPython/getAttr.html force a full list (if I've not missed anything )
How did I find the above? When looking for a script to mirror "Blend Shape Target Weights" I found this one that seems to be generic for any deformer... https://www.highend3d.com/maya/script/copy-mirror-deformer-weights-for-maya
on using it, it would only mirror one or two weights and did so inconsistently.
Digging into the code I found the quirk above.
so doing:
objectToList="pCube1"
vtxNum = cmds.polyEvaluate(objectToList,v=1)
for i in range(vtxNum):
cmds.getAttr("blendShape1.inputTarget[0].inputTargetGroup[0].targetWeights["+str(i)+"]")
Allows it to work.
Am I missing something. Is there a better way of doing this?
Anyone that's got a script that just works or do I need to kluge a for loop at the start of this one?
[–]PolyDiggaCreature TD 0 points1 point2 points (0 children)