GLTF importer automatically adds geometries into scene - unexpected behaviour

Discovered a strange behaviour regarding the GLTF importer. When I import a GLTF using SceneLoader.LoadAssetContainer, the importer immediately adds all the geometries of the GLTF into the scene even though i have not told the container to addAllToScene().

Even more strange is the asset container does not contain a record of the imported geometries, e.g. container.geometries == . And yet, a console log of scene.geometries clearly shows geometries were added.

I have two expectations:

  1. If I have not added anything from the asset container to the scene, I should not see the GLTF geometries in the scene.

  2. If I import a GLTF with SceneLoader.LoadAssetContainer, I expect to see the GLTF geometries in container.geometries.

I have created a simple PG to demo this:
https://playground.babylonjs.com/#VR60N0#14

I’m not sure if the above constitute as a bug and the GLTF loader to be patched.

Right now I’m applying a dirty workaround where i loop through all the container.meshes and get the geometry from each mesh to obtain a list of imported geometries for a given GLTF.

I think the bug is on the assetContainer. I will have a look asap!

Ok bug found, will be fixed in next nightly :slight_smile:
thanks!

1 Like

Hey @Deltakosh, thanks for the patch fix to the container.geometries.

I have however noticed that when container.addAllToScene(), the scene.geometries have duplicate geometries.

Adding this PG for you to check out:
https://playground.babylonjs.com/#VR60N0#15

Will be fixed in next nightly :slight_smile: