Skip to content

Commit

Permalink
Merge pull request #56328 from pycbouh/editor-theme-goes-brrr-but-the…
Browse files Browse the repository at this point in the history
…n-halts-3.x

[3.x] Make the theme editor correctly stop updating after it was hidden
  • Loading branch information
akien-mga authored Jan 3, 2022
2 parents ccbfe85 + b32acc5 commit 5228c06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions editor/plugins/theme_editor_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#include "editor/editor_scale.h"

constexpr double REFRESH_TIMER = 1.5;

void ThemeEditorPreview::set_preview_theme(const Ref<Theme> &p_theme) {
preview_content->set_theme(p_theme);
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5228c06

Please sign in to comment.