Material names change after re-exporting the same Blender model (same filenames) — unexpected renaming on hot reload

When I bake and re-export a Blender model to my Defold project folder (overwriting the same model and texture filenames), Defold hot-reloads the asset—but the material names inside the model change. In other DCCs/engines the material names remain stable if I don’t rename them in Blender. In Defold they appear to be regenerated/renumbered, which breaks my expectations and any name-based references.

in other soft it looks like this:

in Defold

3 Likes

Material names are stored in the glb file on export from Blender.
Are you sure the materials/material names were the same in Blender on the second export?

According to the last image, this does not seem to be the case. Defold detected materials that are no longer present, highlighted in blue, and one that is new, “Cube.001Baked.004”.

Defold seems to remove underscores from material names though.:face_with_monocle:

1 Like

and what about the uppercase first letter of properties that don’t have an uppercase first letter; disconcerting.

2 Likes

I don’t recall renaming material names afaik. Would you mind sharing your model here so I can take a look?

Mathias - are you talking to me?

1 Like

Even if you don’t :slightly_smiling_face:

Defold removes underscores from material names - in the editor.

Just a cube with “yellow_material”, exported to Defold from Blender.

The glb file, opened in Defold, shows the name with the underscore, as expected:

glb

So does the model file:

BUT: the material name in the editor has no underscore.

1 Like

Ah, thanks. Yeah, the editor tries to “beautify” the name there. You could add a ticket on github!

4 Likes

i think yes, because i have another soft with this model opened, so it hot reload and everything is ok. I`ll make an example step by step today.

1 Like

My guess is your other software takes what it finds in the glb file and simply overwrites old files.

In contrast, Defold needs you to manually remove redunant materials (the ones highlighted in blue) and if there is a new material, to add the path to the material file (and after that, the texture).

Maybe try this out with a simple cube in Blender - add some materials, export. Don’t rename any material, add a different image but with the same name as before, export again. All should be fine.
Next, change or rename or add a new material - export and see what happens. If you open the model file, you should see that the old materials are listed here - Defold waits for your input in the editor and only then changes the file.

At least that is my working theory of what is happening to you.:slightly_smiling_face:

2 Likes

yeah, it seems like you are right. I will try few times more, but the problem is not in Defold, it`s gltf settings problem, that could be fixed by scripts for now. Thanks, i will update with any news on this topic.

4 Likes

Done!

Beautify names in the editor in a consistent way · Issue #11158 · defold/defold

@iotahum: Cheers for posting your observation, it was vital for the ticket.

3 Likes