godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Display the MeshLibrary item ID in the GridMap editor #5866

Open Kryppers opened 1 year ago

Kryppers commented 1 year ago

Describe the project you are working on

A dungeon crawler puzzle game

Describe the problem or limitation you are having in your project

Finding the Item number of a particular tilemap tile for use in code was tricky without opening the tilemap and expanding boxes until I visually found the right tile.

From what I gather, the tiles in the preview are displayed in alphabetical order, and not by their item ID.

My alternative was to open the mesh library.tres itself and expand boxes until I found the right asset.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

If the item number for a tile was visible when mousing over the tile in the preview window, then I could quickly visually locate the tile and read it's item ID from the preview window instead.

Alternatively a means to sort by ID would allow me to at least count through them to ascertain the item number, although this isn't as convenient.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

image

If this enhancement will not be used often, can it be worked around with a few lines of script?

I can't see how a script would help me visually identify the tile mesh. I'm not confident enough with code to be able to provide a solution here.

Is there a reason why this should be core and not an add-on in the asset library?

it's my impression that this is basic navigation of the feature set, rather than the content that would be appropriate for an add-on.

smix8 commented 1 year ago

GridMap displays the ID by default. If you set a custom name inside the MeshLibrary for the item it displays the custom name instead.

Hiiamwilliam commented 1 year ago

You can get the index with the following:

# gets the index
var cell_index = gridmap.mesh_library.find_item_by_name("name_of_item")
# then use it like
gridmap.set_cell_item(x, y, z, cell_index)

Which is kinda inconvenient, but meh. I'd like sorting by index (integer) instead of ID (string) though. Technically I could achieve this by renaming every item in the desired order, but that's annoying.

skullauc commented 12 months ago

GridMap displays the ID by default. If you set a custom name inside the MeshLibrary for the item it displays the custom name instead.

No, it doesn't.

skullauc commented 12 months ago

It's really very inconvenient It would be really nice and would spare tons of time and work to display the IDs as a hint or on some panel in a left upper corner of each tile or so, or at least in the list view mode as a column

KakkoWojtylla commented 3 months ago

hey, i had a similar problem for some time, while working with big meshlib files, and i found a really simple solution that should work for both of us, its literally a single line change in the godot src the only diference is that with this change, the item id would be visible in both the item preview name and hovering as an added "(ID)"

change the line 893 on the file grid_map_editor_plugin.cpp from: String name = mesh_library->get_item_name(id); to String name = mesh_library->get_item_name(id) + " (" + String::num(id) + ")";

the result on the preview window is from this: image to this: image

take a look at my issue #10233, see if it fits your needs aswell hope we get this QOL change to godot soon =)

Calinou commented 3 months ago

I would prefer the item ID being visible in the main label as well, as it's more friendly to touch-based input (such as the Android editor).