Add GLOBAL_GET cached macros.

GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.

Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
This commit is contained in:
lawnjelly
2025-04-29 14:48:52 +01:00
parent 8edf97e342
commit f8f350a32a
48 changed files with 110 additions and 77 deletions

View File

@@ -1661,7 +1661,7 @@ void Viewport::_gui_show_tooltip_at(const Point2i &p_pos) {
}
Size2 scale = get_popup_base_transform().get_scale();
real_t popup_scale = MIN(scale.x, scale.y);
Point2 tooltip_offset = GLOBAL_GET("display/mouse_cursor/tooltip_position_offset");
Point2 tooltip_offset = GLOBAL_GET_CACHED(Point2, "display/mouse_cursor/tooltip_position_offset");
tooltip_offset *= popup_scale;
Rect2 r(gui.tooltip_pos + tooltip_offset, gui.tooltip_popup->get_contents_minimum_size());
Rect2i vr;