XPlane2Blender
XPlane2Blender copied to clipboard
Parent of newly added out-of-collection-bone does not resort its children
- Create an animated empty in no collection
- Create a root collection with 4 meshs, A, B, C, D. D's parent is the out of collection empty
- Give them the weights {"A":0, "B":99, "C":20, D:"1"}
- You would expect to have them output as
A
,D
,C
,B
, however you'll see it export asA
,C
,B
,D
. In fact D could be anything at all and it wouldn't matter in two ways: D will actually have XPlaneBone parents of the empty mesh, and then the root, and also the fact that when recursed backwards, the last new bones's parent doesn't resort its children.
So, what we need to do is, I think, sort everything recursively after the tree is completed. Since the weight mechanism only matters during export, not mid-collection, this is okay and much simpler code. I don't think the performance will take a large hit iterating through all the bones and we don't even need to do it recursively, since each list of bone children is independent of other lists of children.
One thing we will do is give the to-connect
bone's weight the leaf's weight since that is what the user is thinking about - and co-ordinating the side effects of using the out of collection object's weight is too much brain power with too many bad out comes for having to adjust it.
- [ ] Unit test describing the above, including a long chain of out of collection cases
- [ ] Code to sort everything
- [ ] Code to use the leaf's weight instead of the out of collection parent