Just so people in a similar position don’t have to spend nearly as much time as me to get this basic functionality, here is a simple editor script that draws on screen a coordinate on a GridMap you have selected:
@tool
extends EditorPlugin
const P_HOLDER_SYSTEM_FONT = preload("uid://cqmrhx0ybf4ux")
var grid_map_editor: GridMapEditorPlugin
func _enable_plugin() -> void:
set_process(true)
func _handles(object: Object) -> bool:
if object is GridMap:
var root = get_editor_interface().get_resource_filesystem().get_node("/root")
grid_map_editor = root.find_children("", "GridMapEditorPlugin", true, false)[0]
return true
return false
func _process(delta: float) -> void:
update_overlays()
pass
func _forward_3d_draw_over_viewport(viewport_control: Control) -> void:
var sel = grid_map_editor.get_selected_cells()
if sel.size() <= 0: return
var pos = viewport_control.get_begin()
pos.y = viewport_control.size.y -5
pos.x += 5
viewport_control.draw_string(P_HOLDER_SYSTEM_FONT, pos, str(sel[0]),HORIZONTAL_ALIGNMENT_LEFT)
#viewport_control.draw_circle(pos,200, Color.RED)
If you wanna copy/paste you’ll have to change the font line and whatever, probably other things too
I was trying to mimic the functionality already native in TileMap, but you have to select instead of working on hover and I couldn’t make it update only when it has to so it’s just on _process but it satisfies my needs for now.