diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 759c2a1410..f1683a2752 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -861,21 +861,19 @@ void EditorNode::_notification(int p_what) { scene_tabs->update_scene_tabs(); } - // Update the animation frame of the update spinner. - uint64_t frame = Engine::get_singleton()->get_frames_drawn(); - uint64_t tick = OS::get_singleton()->get_ticks_msec(); + if (update_spinner->is_visible()) { + // Update the animation frame of the update spinner. + uint64_t frame = Engine::get_singleton()->get_frames_drawn(); + uint64_t tick = OS::get_singleton()->get_ticks_msec(); - if (frame != update_spinner_step_frame && (tick - update_spinner_step_msec) > (1000 / 8)) { - update_spinner_step++; - if (update_spinner_step >= 8) { - update_spinner_step = 0; - } + if (frame != update_spinner_step_frame && (tick - update_spinner_step_msec) > (1000 / 8)) { + update_spinner_step++; + if (update_spinner_step >= 8) { + update_spinner_step = 0; + } - update_spinner_step_msec = tick; - update_spinner_step_frame = frame + 1; - - // Update the icon itself only when the spinner is visible. - if (_should_display_update_spinner()) { + update_spinner_step_msec = tick; + update_spinner_step_frame = frame + 1; update_spinner->set_button_icon(theme->get_icon("Progress" + itos(update_spinner_step + 1), EditorStringName(EditorIcons))); } } @@ -1154,9 +1152,25 @@ void EditorNode::_notification(int p_what) { } void EditorNode::_update_update_spinner() { - update_spinner->set_visible(!RenderingServer::get_singleton()->canvas_item_get_debug_redraw() && _should_display_update_spinner()); + bool should_display_spinner = false; + if (!RenderingServer::get_singleton()->canvas_item_get_debug_redraw()) { +#ifdef DEV_ENABLED + const bool in_dev = true; +#else + const bool in_dev = false; +#endif + const int show_update_spinner_setting = EDITOR_GET("interface/editor/show_update_spinner"); + should_display_spinner = (show_update_spinner_setting == 0 && in_dev) || show_update_spinner_setting == 1; + } + update_spinner->set_visible(should_display_spinner); const bool update_continuously = EDITOR_GET("interface/editor/update_continuously"); + OS::get_singleton()->set_low_processor_usage_mode(!update_continuously); + + if (!update_spinner->is_visible()) { + return; + } + PopupMenu *update_popup = update_spinner->get_popup(); update_popup->set_item_checked(update_popup->get_item_index(SPINNER_UPDATE_CONTINUOUSLY), update_continuously); update_popup->set_item_checked(update_popup->get_item_index(SPINNER_UPDATE_WHEN_CHANGED), !update_continuously); @@ -1174,8 +1188,6 @@ void EditorNode::_update_update_spinner() { update_spinner->set_tooltip_text(TTRC("Spins when the editor window redraws.")); update_spinner->set_self_modulate(Color(1, 1, 1)); } - - OS::get_singleton()->set_low_processor_usage_mode(!update_continuously); } void EditorNode::_execute_upgrades() { @@ -6025,16 +6037,6 @@ String EditorNode::_get_system_info() const { return String(" - ").join(info); } -bool EditorNode::_should_display_update_spinner() const { -#ifdef DEV_ENABLED - const bool in_dev = true; -#else - const bool in_dev = false; -#endif - const int show_update_spinner_setting = EDITOR_GET("interface/editor/show_update_spinner"); - return (show_update_spinner_setting == 0 && in_dev) || show_update_spinner_setting == 1; -} - Ref EditorNode::_file_dialog_get_icon(const String &p_path) { EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem_path(p_path.get_base_dir()); if (efsd) { diff --git a/editor/editor_node.h b/editor/editor_node.h index 61223564e5..60a429feb8 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -498,8 +498,6 @@ private: String _get_system_info() const; - bool _should_display_update_spinner() const; - static void _dependency_error_report(const String &p_path, const String &p_dep, const String &p_type) { DEV_ASSERT(Thread::get_caller_id() == Thread::get_main_id()); if (!singleton->dependency_errors.has(p_path)) {