Hi
New of Babylonjs.
I’m developing a web tool for a research project, importing geometry from gltf format.
In order to link meshes to a database containing data of corresponding objects, I’m trying to use the mesh name assigning them a unique id.
Unfortunately when I import the geometry, the name of meshes seems to be converted in a Nodexxx format.
Is there some way to mantain in babylonjs scene, the name assigned in gltf file?
Thank you JohnK for the welcome and your answer.
Your example works fine.
Something different happens with my .glb files (I implement them by using SharpGltf libraries).
BTW importing them in online editors (i.e. https://www.gltfeditor.com/) names are correctly managed while in babylonjs sandbox or using my file in your example they are substituted with a nodexxx++ rule.
Unfortunately I cannot share a file here, because of my new member status.
Is there a way to share a .glb file for futher investigation?
Chose inspector from options (gear) menu, then expand NODES branch, then under-scored root branch, then next root branch, and discover (and click-on) a mesh named mesh_id26. (The same “renaming” format/problem as @bernat is stating. He is correct… and likely .glb only.)
So, I Wingnut, verify and validate his issue. I see it. Feel free to load OTHER .glb playgrounds from the demo’s list - test those. Same problems… mesh being renamed, like bernat states.
ONLY for .glb, and NOT gltf… (it seems). @bernat, stay tuned… experts are nearby… we see what you see. Let’s ping BJS superstar and all-around nice person @sebavan. He’ll know stuff for sure.
Off-topic aside: Did ya’ll see @sebavan working “daily Q&A duty” lately? He’s an excellent Q&A forum custodian, eh? SO nice, and SO smart. (Hugs to sebavan… AND JohnK… and DK… and a bunch of others. Ya’ll rock.
Personal note to friends: I'll be back to help eventually, I hope. I think I need to *change residence*... a 2nd time... in < 3 months. OUCH! Trailer home I bought... maybe NOT FIT to live-in. It might be out-gassing formaldehyde and making me sick (I can't sleep, 3-7 nightmares/lucid-dreams per night cuz... no deep sleep. Trying EVERYTHING.) SO... I'm arranging an (emergency) move to $$apartment$$... in an area of Wisconsin that has few/none available. Expensive, and I might need to re-sell/destroy house trailer. MY problem cuz... I bought "as is". OMG! STRESS HELL! Will I die of poisoning... before new apartment is available? Let's watch and see. :/
End of self-whining. PM me at will, friends. Wingy in deep crap. Got rescue ideas?
Hi Wingnut, sorry for your home issues, (formaldehyde is not a good night friend and even carcinogenic but it is easily measurable with a cheap instrument, may be u can investigate a little).
Yes, the strange behavior in name parsing is limited to binary glb format. Unfortunately it is the only way to link objects between applications without disturbing extras.
JohnK, I verified the file is parsed correctly in threejs. I can send u my .glb by email because I’m not able to share it here.
ok. I added a very light .glb sample on github.
I obtained it by parsing the very knotty IFC STEP/Express format used for Building Information Modeling.
It seems the GLTF loader does not use the property name of the mesh when creating the mesh but uses the name property of the node containing the mesh instead.
As in your file the nodes don’t have names, meshes end up with default names.
What we could do, maybe, is to use IMesh.name (the name of the mesh in the gltf file) as the name of the mesh (if provided - if not, we would still use the name of the node), and put the name of the node in the id property of the babylon mesh.
That would be a breaking change, however. To avoid a breaking change, we could put IMesh.name in the mesh.id property.
What we could do, maybe, is to use IMesh.name (the name of the mesh in the gltf file) as the name of the mesh (if provided - if not, we would still use the name of the node), and put the name of the node in the id property of the babylon mesh.
The glTF loader used to do this in an early version. The issue with this is that it’s inconsistent. Sometimes glTF meshes will have names and sometimes it won’t. Since the mapping between glTF and Babylon are not 1:1 (e.g. glTF node/mesh/primitives becomes Babylon transform node + child meshes), I don’t see a clean solution to this. We can maybe store the mesh names in metadata?
I think the best solution maybe to add a loader extension that will assign the names in a specific way for this particular scenario?
@bghgary you’r completely right.
I investigated and also noticed that meshes with multiple primitives have no name (though the primitives are named).
I updated my naming policy and now everything works fine.
For the sake of clarity I added an updated version of the .glb file in the same github.
Anyway, to me an extension of the gltf importer naming policy could be adopted here (i.e. using the automatic naming only for meshes with empty value).
BTW thank you all for the quick response and investigation. I’m glad to be a member of a such reactive community.