GLTF / GLB export will fail on nodes with non-string name

Hey,


I have lost houuuurs on this issue :see_no_evil_monkey: but finally I could find out it came from node naming issue


Following the documentation, a TransformNode should be given a string as name :
https://doc.babylonjs.com/typedoc/classes/BABYLON.TransformNode#constructor

Nevertheless, it will accept a number without any warning, and without conversion (originaly came from a Revit export unique ID on my side… :smirking_face:)
In that case, the exported GLB will be broken playground repro here.

Eventhough, the sandbox is able to open it, Blender is not able to open it (crashes), and also the official khronos group glTF Validator claims it’s broken.


Maybe forcing the TransformNode name to convert to string would be an issue (retrocompatibility) but at least I think it should be forced on GLB export

1 Like

I think this is ā€œdelegatedā€ to TypeScript. There, it correctly complains:

This is basically true for all function parameters (and whatnot) if you decide to handle type checking via Typescritp rather than actual Javascript code. :face_with_head_bandage:

1 Like

Yeah I know that the type could be checked, but I think anyway the exporter should never export some broken file without any warning… It should either convert to string, or skip these nodes with a warning :slight_smile:

1 Like

cc @alexchuber as we may want to add a check here

2 Likes

GG for finding that one !!!

This makes sense, but my first reaction was: ā€œOh wow… how many other fields are going to need this same treatment?ā€ :sweat_smile:

We’ll probably uncover them as we go, but it might also be worth adding a broader schema‑validation pass using something like zod to catch all these issues. I’m not sure whether that would be overkill, nor if it should run by default.

Do you all have a preference? Manual checks vs. using zod? Fix the issue vs. warn? Opt‑in vs. default?