Excluding certain elements from a scene export

Is there a way to exclude certain eelements like cameras, meshes, lights from a scene export, both programmatically and from the inspector?

I have seen an exclude meshes or similar kind of thing in the docs but cannot find it nowadays.

Crude but effective, is just to delete them prior. As you would have to identify them individually anyway, deletion could bethought of as a method of identification.

1 Like

the gltf exporter has a notion of a predicate to select node to export:

https://doc.babylonjs.com/api/classes/babylon.gltf2export
https://doc.babylonjs.com/api/interfaces/babylon.iexportoptions#shouldexportnode

For .babylon file format, we have the node.doNotSerialize = true property

1 Like

Then by this method of options to gltf exporter I can achieve exclusion depending on a naming convention like checking a prefix notation.

For the .babylonjs I think that is the property you have mentioned, however,

1- Does this exclude the materials of a node (if they have that kind of relation anyway) as well. I have seen the materials have the same as well?

2- Also should I set this property myself prior to exporting?

I would say yes and yes :slight_smile:

1 Like

It was not clear to me that if I set a camera light etc mesh’s property doNotSerialize to true it does not mean that antoher exporter, say GLTF exporter will not export it. It exports. I need to use the GLTF exporter’s options to achieve that.

I wanted to clarify for the ones will think like me.

1 Like