From b32acc57f355c6937ee7d5543399b9864937f730 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Wed, 29 Dec 2021 23:34:31 +0300 Subject: [PATCH] Make the theme editor correctly stop updating after it was hidden --- editor/plugins/theme_editor_preview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 912d0f3a764..a3a989c1c4e 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -36,6 +36,8 @@ #include "editor/editor_scale.h" +constexpr double REFRESH_TIMER = 1.5; + void ThemeEditorPreview::set_preview_theme(const Ref &p_theme) { preview_content->set_theme(p_theme); } @@ -66,7 +68,7 @@ void ThemeEditorPreview::_refresh_interval() { } void ThemeEditorPreview::_preview_visibility_changed() { - set_process(is_visible()); + set_process(is_visible_in_tree()); } void ThemeEditorPreview::_picker_button_cbk() { @@ -192,7 +194,7 @@ void ThemeEditorPreview::_notification(int p_what) { case NOTIFICATION_PROCESS: { time_left -= get_process_delta_time(); if (time_left < 0) { - time_left = 1.5; + time_left = REFRESH_TIMER; _refresh_interval(); } } break;