Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple gridmaps in same scene cause issues with mesh selection #64126

Closed
elvisish opened this issue Aug 8, 2022 · 3 comments · Fixed by #64188
Closed

Multiple gridmaps in same scene cause issues with mesh selection #64126

elvisish opened this issue Aug 8, 2022 · 3 comments · Fixed by #64188

Comments

@elvisish
Copy link

elvisish commented Aug 8, 2022

Godot version

3.5.rc7

System information

Windows 10

Issue description

If using multiple gridmaps in the same scene and switching between them, the editor will try to pick the MeshLibrary item from the previously selected gridmap's meshlibrary and choose it in the newly selected gridmap. If it doesn't have the mesh item, it will display an error:

scene/gui/item_list.cpp:237 - Index p_idx = 1 is out of bounds (items.size() = 1).
Requested for nonexistent MeshLibrary item '4'.

It will also no longer allow you to select a new mesh item from the meshlibrary until you go back to the previous gridmap and select an item number the other gridmap has.

The chosen item should be separated between each gridmap, so switching between them keeps the item chosen last independently.

Steps to reproduce

  1. Add two gridmaps to a scene
  2. Have them both use separate MeshLibraries of different sizes
  3. Pick an item from one gridmap meshlibrary for painting with and switch to the other gridmap
  4. Godot will attempt to select the previously chosen item from the other gridmap in the newly chosen gridmap, and won't allow you to pick the correct item.

Minimal reproduction project

No response

@rburing
Copy link
Member

rburing commented Aug 9, 2022

The problem seems to be here:

if (selected != -1 && mesh_library_palette->get_item_count() > 0) {
mesh_library_palette->select(selected);
}

Note the upper bound is not checked before selecting.

It would be better UX to store one index per MeshLibrary, but where should the indices be saved?

cc @YeldhamDev

@YeldhamDev YeldhamDev added this to the 4.0 milestone Aug 9, 2022
@YeldhamDev
Copy link
Member

It will also no longer allow you to select a new mesh item from the meshlibrary until you go back to the previous gridmap and select an item number the other gridmap has.

I can't reproduce that part. Both master and the latest stable still allow to select another item.

It would be better UX to store one index per MeshLibrary, but where should the indices be saved?

I think for now it should just check the upper bound and select that instead, as memorizing the index is more of a feature than a bug.

@elvisish
Copy link
Author

elvisish commented Aug 9, 2022

It will also no longer allow you to select a new mesh item from the meshlibrary until you go back to the previous gridmap and select an item number the other gridmap has.

I can't reproduce that part. Both master and the latest stable still allow to select another item.

Try playing around for a while, it seems to happen randomly. I have to restart Godot when it happens, or else I have to pick the corresponding lowest possible index in the other gridmap's meshlibrary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants