SerializeMesh is not keeping parent-child hierarchy

I am trying to SerializeMesh a mesh with children and then read it back using ImportMesh. It is working correctly when I create meshes such as Sphere, Box etc. The parent-child relationship is retained. However, if I SerializeMesh a mesh of a glb file, say, Duck.glb, then parent-child relationship is no longer retained. I have observed TransformNodes are not getting serialized. Please refer to play ground example https://www.babylonjs-playground.com/#TX92RN#1
Note, I am using SerializeMesh(rootMesh, true, true) in both the cases.
Is it not supposed to work or I am doing something wrong ?

@carolhmj do you have a bit of bandwith to look into this one ? looks like a bug ?

Yup let me take a look

Thanks for the report, a PR with the fix is here: [SceneSerializer] Fix SerializeMesh method to account for non-mesh ob… by carolhmj · Pull Request #14041 · BabylonJS/Babylon.js (github.com) :slight_smile:

2 Likes

That’s fast ! Thank you.

We pride ourselves on our speed! :saluting_face:

1 Like