mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
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:
@@ -715,7 +715,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
||||
if (allow_search && k.is_valid() && k->get_unicode() && k->is_pressed()) {
|
||||
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
||||
uint64_t diff = now - search_time_msec;
|
||||
uint64_t max_interval = uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec"));
|
||||
uint64_t max_interval = uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec"));
|
||||
search_time_msec = now;
|
||||
|
||||
if (diff > max_interval) {
|
||||
@@ -2905,7 +2905,7 @@ String PopupMenu::get_tooltip(const Point2 &p_pos) const {
|
||||
PackedStringArray PopupMenu::get_configuration_warnings() const {
|
||||
PackedStringArray warnings = Popup::get_configuration_warnings();
|
||||
|
||||
if (!DisplayServer::get_singleton()->is_window_transparency_available() && !GLOBAL_GET("display/window/subwindows/embed_subwindows")) {
|
||||
if (!DisplayServer::get_singleton()->is_window_transparency_available() && !GLOBAL_GET_CACHED(bool, "display/window/subwindows/embed_subwindows")) {
|
||||
Ref<StyleBoxFlat> sb = theme_cache.panel_style;
|
||||
if (sb.is_valid() && (sb->get_shadow_size() > 0 || sb->get_corner_radius(CORNER_TOP_LEFT) > 0 || sb->get_corner_radius(CORNER_TOP_RIGHT) > 0 || sb->get_corner_radius(CORNER_BOTTOM_LEFT) > 0 || sb->get_corner_radius(CORNER_BOTTOM_RIGHT) > 0)) {
|
||||
warnings.push_back(RTR("The current theme style has shadows and/or rounded corners for popups, but those won't display correctly if \"display/window/per_pixel_transparency/allowed\" isn't enabled in the Project Settings, nor if it isn't supported."));
|
||||
|
||||
Reference in New Issue
Block a user