Merge pull request #88106 from Calinou/editor-dev-build-show-update-spinner

Show update spinner by default in `dev_build=yes` editor builds
This commit is contained in:
Rémi Verschelde 2024-02-12 13:34:38 +01:00
commit 08b4dddf4c
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 23 additions and 5 deletions

View file

@ -613,7 +613,12 @@
</member>
<member name="interface/editor/show_internal_errors_in_toast_notifications" type="int" setter="" getter="">
If enabled, displays internal engine errors in toast notifications (toggleable by clicking the "bell" icon at the bottom of the editor). No matter the value of this setting, non-internal engine errors will always be visible in toast notifications.
The default [b]Auto[/b] value will only enable this if the editor was compiled with the [code]dev=yes[/code] option (the default is [code]dev=no[/code]).
The default [b]Auto[/b] value will only enable this if the editor was compiled with the [code]dev_build=yes[/code] SCons option (the default is [code]dev_build=no[/code]).
</member>
<member name="interface/editor/show_update_spinner" type="int" setter="" getter="">
If enabled, displays an icon in the top-right corner of the editor that spins when the editor redraws a frame. This can be used to diagnose situations where the engine is constantly redrawing, which should be avoided as this increases CPU and GPU utilization for no good reason. To further troubleshoot these situations, start the editor with the [code]--debug-canvas-item-redraw[/code] [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url].
Consider enabling this if you are developing editor plugins to ensure they only make the editor redraw when required.
The default [b]Auto[/b] value will only enable this if the editor was compiled with the [code]dev_build=yes[/code] SCons option (the default is [code]dev_build=no[/code]).
</member>
<member name="interface/editor/single_window_mode" type="bool" setter="" getter="">
If [code]true[/code], embed modal windows such as docks inside the main editor window. When single-window mode is enabled, tooltips will also be embedded inside the main editor window, which means they can't be displayed outside of the editor window.

View file

@ -610,7 +610,7 @@ void EditorNode::_notification(int p_what) {
update_spinner_step_frame = frame + 1;
// Update the icon itself only when the spinner is visible.
if (EDITOR_GET("interface/editor/show_update_spinner")) {
if (_should_display_update_spinner()) {
update_spinner->set_icon(theme->get_icon("Progress" + itos(update_spinner_step + 1), EditorStringName(EditorIcons)));
}
}
@ -798,7 +798,7 @@ void EditorNode::_notification(int p_what) {
}
void EditorNode::_update_update_spinner() {
update_spinner->set_visible(!RenderingServer::get_singleton()->canvas_item_get_debug_redraw() && EDITOR_GET("interface/editor/show_update_spinner"));
update_spinner->set_visible(!RenderingServer::get_singleton()->canvas_item_get_debug_redraw() && _should_display_update_spinner());
const bool update_continuously = EDITOR_GET("interface/editor/update_continuously");
PopupMenu *update_popup = update_spinner->get_popup();
@ -2913,7 +2913,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_update_update_spinner();
} break;
case SETTINGS_UPDATE_SPINNER_HIDE: {
EditorSettings::get_singleton()->set("interface/editor/show_update_spinner", false);
EditorSettings::get_singleton()->set("interface/editor/show_update_spinner", 2); // Disabled
_update_update_spinner();
} break;
case SETTINGS_PREFERENCES: {
@ -4632,6 +4632,16 @@ 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<Texture2D> EditorNode::_file_dialog_get_icon(const String &p_path) {
EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem_path(p_path.get_base_dir());
if (efsd) {
@ -6476,7 +6486,6 @@ EditorNode::EditorNode() {
register_exporters();
EDITOR_DEF("interface/editor/save_on_focus_loss", false);
EDITOR_DEF("interface/editor/show_update_spinner", false);
EDITOR_DEF("interface/editor/update_continuously", false);
EDITOR_DEF("interface/editor/localize_settings", true);
EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", true);

View file

@ -488,6 +488,8 @@ 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)) {

View file

@ -452,8 +452,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
#ifdef DEV_ENABLED
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/show_internal_errors_in_toast_notifications", 0, "Auto (Enabled),Enabled,Disabled")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/show_update_spinner", 0, "Auto (Enabled),Enabled,Disabled")
#else
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/show_internal_errors_in_toast_notifications", 0, "Auto (Disabled),Enabled,Disabled")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/show_update_spinner", 0, "Auto (Disabled),Enabled,Disabled")
#endif
// Inspector