Hello,
I'd like to apply twistedbone weights to polygon2d from GDscript but am having problems.
If i paint the weights in the editor, the Polygon2D's bones property will be array that looks like this: [twistedbone1,[1,1,1,1,1,1], twistedbone2,[0,0,0,0,0]] and I thought it would be trivial to set in code. But when I try to do it, weird things occur. In fact, this happens:
var bones_array = [skeleton.get_child(0), weights]
polygon.bones = bones_array
print(bones_array)
Result:
[Twisted_Bone2D:[Bone2D:24122], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
print(polygon.bones)
Result:
[[Bone2D:24122], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
Then when I open the weight paint screen, the right hand column that shows the bones only displays [Bone2D, instead of the usual TwistedBone_1. Weights appear set, but when i rotate the twistedbone in the editor, the polygon doesnt move with it.
So, to summarize, it seems like the TwistedBone, when set into the polygon.bones array, is being turned into [Bone2D]. Is there any way around this? I'd be fine with just a hack to get it to work.
Cheers