Exported skeleton breaks hierarchy in bjs

Repro: Babylon.js Playground
comment/uncomment importmesh codes. Turn on inspector and look at the skeleton hierarchy.

Explanation: I made 2 files to illustrate the problem. skControl.babylon contains 3 cubes and 3 bones, bot, middle and top. top is parented to middle, middle is parented to bot. Then I edited the skeleton by simply deleting the middle bone and re-adding a bone and naming it middle as well. I exported this as skBug.babylon. In blender, everything is wai and animations run fine for both skeletons. In bjs, as shown in the repro above, the bone hierarchy breaks for skBug.babylon and animations get fouled up.

Based on the babylon file, the only difference lies in the order of the bones in the bones array.

skControl:
“name”:“bot”, “parentBoneIndex”:-1
“name”:“middle”,“parentBoneIndex”:0
“name”:“top”,“parentBoneIndex”:1

skBug:
“name”:“bot”, “parentBoneIndex”:-1
“name”:“top”,“parentBoneIndex”:2
“name”:“middle”,“parentBoneIndex”:0

This is the simplest repro I could do w/o bloating the json file. It appears that the parser for skBug isn’t working when the bones are ordered differently, wai ?

I cannot reproduce this, though after I re-added my bone, I set the parent to the original, then I set the child’s parent to the re-added bone.

After re-adding middle, ensure middle’s parent is set to bot, ensure top’s parent is set to middle, ie, recreate the same skeleton as previous.

Attached 2 blend files and associated .babylon json files (recreated this morning). blender 2.83, exporter 6.4.3
skBJS.zip (175.4 KB)

Since its json output, manually editing the .babylon file to reorder the bones should also repro the same, tho I have not undertaken this step since its not a normal workflow. The exporter should be wai, its the bjs parser that is behaving wierdly, imho.

Lemme know what else you need.

I actually do not even have Blender 2.83 on my system any more, just 2.92 & 2.93 beta from last week.

I have started to name exporter versions after the Blender release they were for. You were running 6.4.3 of the exporter, which is pretty current.

When I run against Blender 2.92, with the last production exporter for 2.8x, it came out fine. For 2.93, it also comes out fine. There must have been a problem with 2.83 Blender that got fixed.

For the record, the exporter relies on Blender to provide the bones in an order that list parent bones before child bones. It has worked forever.

1 Like

Thanks, that’s probably the problem. Marking as solved, cheers !