GridMap enumerates MeshItems out of control, does anyone understand this ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Inces

I am trying to create different sets of MeshLibraries for my GridMap, utilizing the same script and collision. FOr example walls and floors for jungle,desert,dungeon and so on. After finalizing script for random terrain generation I discovered, that there is now way I can control what index is going to be assigned to each mesh after importing scene to Mesh Library. I tried alphabetical order, child order, adding piece by piece - everytime Gridmap does some horseshit and enumeration is like random. Even when items are aligned in correct order in Editors UI - they still get indexes like 0,3,4,1… This is bad for me, because I expected script to recognize walls and floors by the index, and now it seems impossible. Every new mesh library I create using the same amount of different meshes gets different indexes for each of them.

Did anyone find a way around this ? Or am I doing something wrong with converting ?

:bust_in_silhouette: Reply From: Inces

I found it out finally, GridMap in Godot3 is really bad compared to TIleMap…

It occurs, that when You create MeshLibrary based on saved scene, formerly inherited from glb file - the order of items and their indexes depend on child order of the scene. However if You create Mesh Library using unsaved inherited scene or glb file itself - only then order of items depend on their order in Blender, no matter how You changed it in the Godot Editor !!!

This was terribly irritating to track down, I have now like 30 test mesh libraries in my project. Other bugs of gridmap were omnipresent : contents of overwritten meshlibrary is never erased, You have to create brand new one. Item preview in editor is often swapped for the item You already deleted. This node is a nightmare. I hope it is fixed in Godot4