Browse Source

Merge pull request #56327 from pycbouh/editor-theme-goes-brrr-but-then-halts

Make the theme editor correctly stop updating after it was hidden
Rémi Verschelde 3 years ago
parent
commit
20563b081b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      editor/plugins/theme_editor_preview.cpp

+ 4 - 2
editor/plugins/theme_editor_preview.cpp

@@ -36,6 +36,8 @@
 
 
 #include "editor/editor_scale.h"
 #include "editor/editor_scale.h"
 
 
+constexpr double REFRESH_TIMER = 1.5;
+
 void ThemeEditorPreview::set_preview_theme(const Ref<Theme> &p_theme) {
 void ThemeEditorPreview::set_preview_theme(const Ref<Theme> &p_theme) {
 	preview_content->set_theme(p_theme);
 	preview_content->set_theme(p_theme);
 }
 }
@@ -66,7 +68,7 @@ void ThemeEditorPreview::_refresh_interval() {
 }
 }
 
 
 void ThemeEditorPreview::_preview_visibility_changed() {
 void ThemeEditorPreview::_preview_visibility_changed() {
-	set_process(is_visible());
+	set_process(is_visible_in_tree());
 }
 }
 
 
 void ThemeEditorPreview::_picker_button_cbk() {
 void ThemeEditorPreview::_picker_button_cbk() {
@@ -200,7 +202,7 @@ void ThemeEditorPreview::_notification(int p_what) {
 		case NOTIFICATION_PROCESS: {
 		case NOTIFICATION_PROCESS: {
 			time_left -= get_process_delta_time();
 			time_left -= get_process_delta_time();
 			if (time_left < 0) {
 			if (time_left < 0) {
-				time_left = 1.5;
+				time_left = REFRESH_TIMER;
 				_refresh_interval();
 				_refresh_interval();
 			}
 			}
 		} break;
 		} break;