godotengine / godot

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

Gridmap gizmo positioned randomly #77195

Open rcorre opened 1 year ago

rcorre commented 1 year ago

Godot version

4.0.2.stable.arch_linux

System information

Linux

Issue description

The orange grid gizmo for a gridmap in the editor appears centered at a seemingly random spot every time you select a GridMap 1684406625

Steps to reproduce

  1. Create a gridmap
  2. Zoom out, find the grid (may be very far away)
  3. Select another node
  4. Select the GridMap
  5. See the grid gizmo is now in a different spot

Minimal reproduction project

N/A, just add a GridMap to an empty project

smix8 commented 1 year ago

Can't reproduce in master. Even with multiple GridMap nodes in the same scene the visuals center at the correct position with one frame delay.

smix8 commented 1 year ago

After further testing I noticed this happens randomly sometimes when the grid axis are edited.

caseyjoy commented 1 year ago

I think this might be a duplicate of https://github.com/godotengine/godot/issues/57068, which causes it to try to move the grid to the last valid position the mouse was in (in some cases you can see the tile placement still at that position), but only after certain actions like selecting the GridMap, adjusting the floor, etc. In the code, some grid_map_editor functions are calling update_grid(), which I think is making it look like it's moving randomly whenever those get called.

I added a PR for that bug, so hopefully that addresses this as well.