Hey Babylonjs Forum!!
I upgraded the babylonjs version to 7.40.3
.
And I found the GLTF2Export.GLTFAsync
function shouldExportNode
not includes all nodes, just root node
Is this a breaking change or just a bug?
Hello @JoeyKo , how are you doing?
I will double check. Can you provide a Playground with an example?
@srzerbetto Hereâs the PG
@alexchuber , maybe we have a bug in the Serializer?
Actually, I think the problem is on the ânode.isDescendantOfâ call. This method only returns true for the âRootNodeâ node. The other nodes that it prints are the ones directly bellow âRootNodeâ, they are because the Serializer investigates if it should export them or not, but the result of ânode.isDescendantOfâ for those nodes is false. Therefore, the Serializer will not continue to parse the nodes down the tree.
I think this is expected, right? If a node should not be exported, that also means its children should not be exported.
Iâm sure itâs not about the node.isDescendantOf
call.
I just downgraded babylonjs to version 7.32.5
, with the same code, the console shows all nodes.
Or you can just test in the current PG, switch version from latest
to 6.49.0
, And the console shows all nodes.
Here, printing the value of node.isDescendantOf(root), it shows it returns false for those nodes.
Available Mesh SeaGulf | Babylon.js Playground
When changing to 6.49.0 it returns true.
Actually, I think you are right. The current behavior is, we start parsing the scene from the root. Since âcgmszj_rootâ is not âisDescendantOfâ the root node (itâs actually its parent), we donât continue to parse down the tree.
This was probably not the behavior the older version of the Serializer was doing. It was either traversing the tree in a different order, or continuing to parse children nodes even when the parent should not be exported.
We can look into a fix for this The only issue I foresee is how we collapse camera and lights into their parents. I think thatâs the main reason we skip the children of skipped nodes.
Allow exporting children of skipped nodes in glTF exporter by alexchuber · Pull Request #16017 · BabylonJS/Babylon.js · GitHub should address this. Feel free to take a look and test the snapshot playground
@alexchuber @srzerbetto Really appreciate you taking care of it so fast.