Parent-child relations not getting exported/saved when saving scene? [PLAYGROUND reproduction]

Here is a playground : https://playground.babylonjs.com/#SA6QBM#8

It’s a bit clunky but when it works you can see the same behavior.

Basically imagine that I want to do something like the Sims design a room feature. I want to be able to save and load the room while having the ability to pick each object individually. I’m encountering many problems with this process and I’m trying to outline them below.

Currently it seems that the act of picking meshes that are made from various submeshes is hard to get right. I don’t know what is the correct workflow to follow so please if you have any guidelines to provide will be greatly appreciated.

The preservation of the parent child relationships is crucial cause I’m using it to move models that are made of multiple meshes(like the ones found in various free forums).

Some meshes that are joined as one in blender work correctly since they don’t need a parent but some of them even though they appear as one in blender they have many submeshes/primitives in babylon.

I even tried deleting the materials but still the occurrence persists.

This is how the scene looks when I load my chillchair.glb file.

This is how it looks when I save and then reload the scene.babylon file from the above step.

It seems that the parent-child relations disappear when reimporting.

The code that I’m using for saving the scene is this : Save Your Scene - Babylon.js Documentation

Screenshots from the playground that shows the same behavior :


[EDIT] I tried pressing the export scene to glb using the inspector and it seems that this method saves the actual hierarchy of the scene, but I need to investigate further.

Currenly I’m trying to use the

GLTF2Export.GLBAsync(scene, “fileName”).then((glb) => {

  glb.downloadFiles();

});

But doesn’t seem to work correctly with just that. The meshes at the bottom get converted to transformnodes only using this piece of code.

image

Basically the functionality of the “export glb” button of the inspector seems to satisfy me so how can I get it my code ?

The problem was unrelated to what I was writing in the original post.

It had to do with import { GLTF2Export } from '@babylonjs/serializers/glTF'; not being used correctly as the serializers were not installed in the correct location and something was missing while I wasn’t getting any error.

I will leave the post for showing what losing your mind because of unexpected behaviours and weird things get in your mind after not taking a break for a while.

You are all wonderful and Babylon is awesome still.:pray:

3 Likes

/love :smiley: