godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.46k stars 21.07k forks source link

Picking Gridmap tiles doesn't work correctly with a search filter applied #70870

Closed rubberduck9999 closed 1 year ago

rubberduck9999 commented 1 year ago

Godot version

4.0 Beta 10

System information

Windows 10

Issue description

when picking tiles from a gridmap and you have a search filter applied, it often doesn't do anything, instead I get an index out of bounds error in the console scene/gui/item_list.cpp:424 - Index p_current = 8 is out of bounds (items.size() = 4).

Steps to reproduce

  1. Open a project using a gridmap like the platformer demo, or create one.
  2. Search for specific tiles inside the tile selection.
  3. Try to pick a tile inside the 3D viewport with that you want to paint (maybe you don't want to reset the filter and do a long search there)

In some cases it works, but mostly it doesn't work (depending on the tile you picked and what you searched for) Also I am not sure, but I have the feeling that in a few cases it picks the wrong tile, instead of throwing an error

Minimal reproduction project

Any project that uses a gridmap, for example the platformer demo from the demo projects repo

KoBeWi commented 1 year ago

Picking tile should clear the filter probably.

rubberduck9999 commented 1 year ago

Maybe, but what happens often to me is, that I want to place specific tiles using a filter, and then see a single tile I forgot to place or I placed wrong, which brings me a bit out of the workflow. But it could work too, currently I need to reset the filter and then search for it again. Another Idea I had in my mind is just to pick the tile, even if it is not in the list at the moment.

Anyway it often happens to me when picking a tile, the preview selected tile in the select area doesn't match the actual tile I paint with. I don't know if this is related to the filter issue, maybe a tile could be highlighted when it is part of the filter or that no tile is selected there. I am still thinking if this idea is good and I don't know how the gridmap internally works.