Cloned Source Is Null

Yo @Deltakosh … Every few builds this bugs creeps back in there. I listed it a few times before in older forums. But the cloned mesh source property is null. It should be the source mesh that you cloned from.

Can you please look in that again :slight_smile:

Please provide a repro in the PG because I cannot not reproduce the error

Same here, can’t repro.
https://playground.babylonjs.com/#UKNERM#70

1 Like

Yo @Deltakosh … Made A Playground

Sample Play ground using meshes from GLB:

Notice i am clone a mesh called: “Cube 1”

That has the null clone source… Check the console.log trace

But if i change clone “Cube” (another mesh in scene… that one clones just fine)

Really weird

Sample Playground:

https://playground.babylonjs.com/#UKNERM#71

Yo @Deltakosh and @bghgary … I figured it all out.

First of all the GLTF loader loads nodes as TransformNodes, Meshes or InstanceMeshes
if it is an InstanceMesh it WONT have a source field. So cloned.source will be null or undefined. But it does have a sourceMesh field. So thats good to know.

Also… the GLTF support Mesh Instances (Exporting using the same GLTF Mesh ID). For prefabs (Designed to be used as a source for full deep cloning and create instances from)
i simply ALWAYS generate a new GLTF Mesh ID… Again this is only for PREFABS… When are always DISABLED and used for DEEP CLONING.

Working Smooth, now that i know whats the what :slight_smile:

3 Likes

Ok that’s good news!!!

Thank you! @MackeyK24 your answer helped me.