@sebavan I agree that GLB is valid. It is not empty, If you see this in blender, it shows the Cylinder properly. Even If you look at file size, It consist of mesh data. I am proposing a solution further down. A GLB without empty node, loads on Babylonjs Sandbox, but this one gives error despite being valid.
@bghgary The solution that you provided seems to work fine. I also figured out since I posted the question. The challenge is, my GLB file has meshes in a deep nested hierarchy, To separate a mesh which is deep nested seems a big problem.
Proposed behavior :
We add a flag to export option, to include all parent nodes. It is better to keep the flag, as maintaining hierarchy for meshes is also important for lot of projects. How I implemented workaround is :
// Using the collectParent Method to get the list of all
const collectParent = (mesh, array) => {
if (mesh.parent != null) {
if (!mesh.parent._isMesh) {
}
array.push(mesh.parent.uniqueId);
collectParent(mesh.parent, array);
}
}
// element below is mesh that I am trying to export.
const meshCollection = [element.uniqueId]
if (element.parent != null) {
collectParent(element, meshCollection );
}
and then inside shouldExportNode
, I am then checking if node.uniqueId
exists in meshCollection
array created above.