Godot version:
3.0.6 (self-built from commit 8ac39d886307d76c286e804e027fc39f6b5aaac6)
master (commit 8dd00ed1762c4956b3231d709ce0d01ee9b306c8)
OS/device including version:
Arch Linux (4.19.4-arch1-1-ARCH, Mesa 18.2.5-1)
Issue description:
Materials on editor-created meshes are not preserved in a MeshLibrary created via "Convert To -> MeshLibrary". It sounds very similar to what was happening in #1239, but I'm not sure it's the same issue.
Steps to reproduce:
Expected: A red plane
Result: A white plane
Minimal reproduction project:
gridmap_material_issue_example.zip
* Additional Information: *
master build printed out the following after executing Step 3:
ERROR: create_from_image: Condition ' p_image.is_null() ' is true.
At: scene/resources/texture.cpp:191.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: _write_resource: Resource was not pre cached for the resource section, bug?
At: scene/resources/scene_format_text.cpp:1369.
And the following after Step 4:
ERROR: create_from_image: Condition ' p_image.is_null() ' is true.
At: scene/resources/texture.cpp:191.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
ERROR: texture_get_data: Condition ' !texture->active ' is true. returned: Ref<Image>()
At: drivers/gles3/rasterizer_storage_gles3.cpp:1033.
From what I remember from past issues/discussions, this is caused by the MeshLibrary collecting the Mesh resources, which do not contain the overridden Materials.
There are two main ways this might be solved in:
Can confirm as well.
Godot 3.1 beta1
Seems the same problem I'm having.
What I did was:
manually added the materials directly in the MeshLibrary nodes as per image below

updated from scene removed again the materials, see below

Can confirm this is still an issue on 3.1 beta2
This is still an issue in 3.1 beta 3. Is anyone working on this? It seems like a pretty important bug for the 3d workflow.
This is still an issue in 3.1 beta 3. Is anyone working on this? It seems like a pretty important bug for the 3d workflow.
For now I found a workaround:
if you select your model .dae or .gltf, or any other compatible format, change your preset so that imports as separate objects+materials (not sure if materials is necessary)

then in the inherited scene change the material for each mesh (I also saved them as a separate file), do not use override material

If you then import into the GridMap you should have those materials, I think this is the same think @bojidar-bg was mentioning above.
Clarified this in documentation here:
https://github.com/godotengine/godot-docs/commit/f118ce32137ba57174def4e0e8290e11a3e85c9c
Also, errors shown before no longre happen, so closing this.
I don't see why this has been closed. I just started getting into Godot and this is a huge turnoff. I really don't fancy creating ten meshes that are exactly the same just because I want to use the same cube with a different texture in my gridmap.
Love Godot, but this issue, while having workarounds, is still and issue. I don't see why it has been closed either.
@meowxiik Wasn't this solved by https://github.com/godotengine/godot/pull/25522? If so, it may be a matter of documenting it more clearly.
@Calinou Huh I see. It still happens to me but I've been able to figure out a relatively unpainful workaround, so I don't really mind it anymore.
@meowxiik How does the workaround work? Maybe it could be documented :slightly_smiling_face:
@Calinou My approach was similiar to @Toshiwoz, except simpler:
DO NOT ACTUALLY USE THIS, I have just discovered changes made like this do NOT survive project reload. See the bottom for more details.
Select the MeshLib in FileSystem:

Manually edit the items in the MeshLib

All scenes containing this MeshLib update immidiatelly. So the fact it doesn't save is maybe a bug? Or if that is intended, one of those
would be handy. (My build of Godot is v3.1.1 Mono Stable Official)
I understand concerns about closing this issue. But strictly speaking this one is solved.
The problem is more the improvements needed to the feature in general, and AFAIK it will be worked on, I hoped on 3.2 but may be delayed, depending on volunteers will, and patreons + community votes (perfectly fine for me).
I abandoned completely the use of this feature for now as I found using procedurally generated mesh more fit to my project.
Most helpful comment
Love Godot, but this issue, while having workarounds, is still and issue. I don't see why it has been closed either.