mesh.material of a runtime imported model have a persistent ID of any sort?
like for example, an imported model has a persistent “name” for each of the children in the hierarchy
(just persistent, consistent, not necessarily unique)
_ marks it as “internal” and non-API and while unlikely to change, there’s no guarantee).
This index currently matches the index in the materials table (not the id, but the count from 1 from the start, 0 is an invalid/null material placeholder). If you create a new material, e.g. with
.clone() you’ll find this index to increment by 1 over the last highest index.
In case you mean for the editor, the Materials have a “file link” which will be the name in every Wonderland Engine project the scene was imported into.
Loading the same model a few times will return a different material._index ? Since their material will be loaded into the table multiple times?
The capability I seek is a way to identify a material in an imported model at runtime. Ideally, a material.name or even a texture/image name so I can “mark” /“tag” it in Blender so that WLE can handle it at runtime
At runtime, yes. In the editor there currently is no way to load the model twice. Duplicating it will reuse the same material instance (using the name index).
There’s definitely some useful API missing for the runtime GLTF import there. As a (terrible) workaround, you may want to use a certain color code (like 255, 0, 254) to identify the material.
Colour codes might have to do for now.