How to serialize (save) part of scene

I am working on a simple online editor, where it’s possible to compose a simple scene. The scene is then saved and saved on our server, and it’s possible to show the cool 3D scene on a web page. So far so good…

Our problem is we do not wont to serialize the hole scene only part of it. We have a grid and different cameras in the “editor”.

We have collected all the imported meshes in a TransformNode (content), but there seems to be a problem when we try to serialize the content:

SceneSerializer.SerializeMesh(content, true, true)

One of our meshes is composed of two meshes, the problem is the child meshes parent is null after it’s serialized.

What is the best way to serialize part of a scene and load in another scene? Is there another way to accomplish this?

[UPDATE]
Here is a link to a playground that shows my problem:
https://playground.babylonjs.com/#NV6ZNQ#2

After a bit more inspection it seems my problem is that SerializeMesh does not serialize the hole mesh three?

Later on we might have multiple root meshes, like a duck and flamingo. It would be nice to create a single .babylon file with both meshes.

Adding @Drigax FYI

@dnrn would be great if you could share a quick playground ? as it would definitely help to troubleshoot faster

You can call scene.serialize() and just before set mesh.doNotSerialize= true on the meshes you want to ignore

4 Likes

Badabum!
This is exactly what I’m looking for!!

2 Likes