Prevent Transform Nodes from Serializing

I am trying to save a scene without assets that I have loaded in. I am using an AssetContainer and setting doNotSerialize on the rootNodes, meshes, and materials. When I reload the serialized scene, and look at inspector, The meshes and materials are missing as expected, but I can still see transform nodes for the assets I loaded. Is there a way to prevent these transform nodes from serializing?

I reproduced this in PG - Babylon.js Playground.

Transform Nodes currently serialize to I GUESS prevent losing hierarchy and parenting if we were not serializing them. It is usually not an issue as they do not pollute the visual output.

I agree that it can be misleading, @Deltakosh, do you think we should remove their hierarchy if flagged ?

Well that will make sense yes :slight_smile:

I will fix that for next nightly

1 Like

Is this change in NPM yet? I tried 4.1.0-alpha.23 but I saw the same result. Just wanted to make sure I wasn’t missing something.

it is in
it should work now

if not please provide a repro because it works on my tests :slight_smile:

https://www.babylonjs-playground.com/#QLEAAX#4. It seems to be related to the GLTF file. I tried it with a couple of GLTF files from others and got the expected result. But when I try it with the one in the playground (which was exported from 3D Studio Max), the transform node persists in the saved scene. Perhaps it has to do with the hierarchy of the nodes in the GLTF? Any assistance is appreciated.

I think you should also flags the transform nodes right?

I did in a previous version, but I removed it because it did not look like it was necessary. With the change, it appears to exclude the transform node if the mesh is excluded. In any case, I uncommented it and got the same result - https://www.babylonjs-playground.com/#QLEAAX#5.

This seems to work:
https://www.babylonjs-playground.com/#QLEAAX#7

rootNodes is always empty in assetContainer as this is only used for scenes

I’m still seeing transform nodes in the inspector when I load the scene from data - https://www.babylonjs-playground.com/#QLEAAX#8

because you are probably getting the wrong scene in the inspector :slight_smile:
https://www.babylonjs-playground.com/#QLEAAX#9

I figured it would inspect the scene returned from createScene. If I explicitly show the debugLayer for the loaded scene, then I see the transform nodes in the inspector - https://www.babylonjs-playground.com/#QLEAAX#12. I don’t see the transform nodes in the empty scene you added, but I’m trying to inspect the loaded scene and would like to not see empty transform nodes.

Yeah you are right…There is still something wrong…Let me check that

OK I’ve got it!! My gosh! thanks for your patience

It will be live in a hour or so

No worries. Thanks for the support and the quick fix.