diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 1f08f3d7873..3d640b4d358 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -260,24 +260,25 @@ void EditorNode::_notification(int p_what) { last_checked_version = editor_data.get_undo_redo().get_version(); } - //update the circle + // update the animation frame of the update spinner uint64_t frame = Engine::get_singleton()->get_frames_drawn(); uint32_t tick = OS::get_singleton()->get_ticks_msec(); - if (frame != circle_step_frame && (tick - circle_step_msec) > (1000 / 8)) { + if (frame != update_spinner_step_frame && (tick - update_spinner_step_msec) > (1000 / 8)) { - circle_step++; - if (circle_step >= 8) - circle_step = 0; + update_spinner_step++; + if (update_spinner_step >= 8) + update_spinner_step = 0; - circle_step_msec = tick; - circle_step_frame = frame + 1; + update_spinner_step_msec = tick; + update_spinner_step_frame = frame + 1; - // update the circle itself only when its enabled - if (!update_menu->get_popup()->is_item_checked(3)) { - update_menu->set_icon(gui_base->get_icon("Progress" + itos(circle_step + 1), "EditorIcons")); + // update the icon itself only when the spinner is visible + if (EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")) { + update_spinner->set_icon(gui_base->get_icon("Progress" + itos(update_spinner_step + 1), "EditorIcons")); } } + editor_selection->update(); scene_root->set_size_override(true, Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"))); @@ -400,10 +401,8 @@ void EditorNode::_notification(int p_what) { scene_tab_add->set_icon(gui_base->get_icon("Add", "EditorIcons")); // clear_button->set_icon(gui_base->get_icon("Close", "EditorIcons")); don't have access to that node. needs to become a class property - update_menu->set_icon(gui_base->get_icon("Collapse", "EditorIcons")); dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons")); dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); - update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons")); PopupMenu *p = help_menu->get_popup(); p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_icon("HelpSearch", "EditorIcons")); @@ -412,6 +411,8 @@ void EditorNode::_notification(int p_what) { p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_icon("Instance", "EditorIcons")); p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_icon("Instance", "EditorIcons")); p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_icon("Godot", "EditorIcons")); + + _update_update_spinner(); } if (p_what == Control::NOTIFICATION_RESIZED) { @@ -419,6 +420,17 @@ void EditorNode::_notification(int p_what) { } } +void EditorNode::_update_update_spinner() { + update_spinner->set_visible(EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")); + + bool update_continuously = EditorSettings::get_singleton()->get("interface/editor/update_continuously"); + PopupMenu *update_popup = update_spinner->get_popup(); + update_popup->set_item_checked(update_popup->get_item_index(SETTINGS_UPDATE_CONTINUOUSLY), update_continuously); + update_popup->set_item_checked(update_popup->get_item_index(SETTINGS_UPDATE_WHEN_CHANGED), !update_continuously); + + OS::get_singleton()->set_low_processor_usage_mode(!update_continuously); +} + void EditorNode::_on_plugin_ready(Object *p_script, const String &p_activate_name) { Ref