From 430e5658f16d5519bf7863d15e1f434139f8bd37 Mon Sep 17 00:00:00 2001 From: Hilderin <81109165+Hilderin@users.noreply.github.com> Date: Sat, 14 Sep 2024 15:11:42 -0400 Subject: [PATCH] Fix empty load errors popup --- editor/editor_node.cpp | 19 +++++++++++-------- editor/editor_node.h | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 66fd2cf904e..9b614c9e83f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1206,7 +1206,7 @@ void EditorNode::_reload_modified_scenes() { editor_data.set_edited_scene(i); _remove_edited_scene(false); - Error err = load_scene(filename, false, false, true, false, true); + Error err = load_scene(filename, false, false, false, true); if (err != OK) { ERR_PRINT(vformat("Failed to load scene: %s", filename)); } @@ -3843,7 +3843,7 @@ int EditorNode::new_scene() { return idx; } -Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, bool p_set_inherited, bool p_clear_errors, bool p_force_open_imported, bool p_silent_change_tab) { +Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, bool p_set_inherited, bool p_force_open_imported, bool p_silent_change_tab) { if (!is_inside_tree()) { defer_load_scene = p_scene; return OK; @@ -3866,10 +3866,6 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b } } - if (p_clear_errors && !load_errors_queued_to_display) { - load_errors->clear(); - } - String lpath = ProjectSettings::get_singleton()->localize_path(p_scene); if (!lpath.begins_with("res://")) { @@ -4845,6 +4841,12 @@ void EditorNode::_progress_dialog_visibility_changed() { } } +void EditorNode::_load_error_dialog_visibility_changed() { + if (!load_error_dialog->is_visible()) { + load_errors->clear(); + } +} + String EditorNode::_get_system_info() const { String distribution_name = OS::get_singleton()->get_distribution_name(); if (distribution_name.is_empty()) { @@ -5800,7 +5802,7 @@ void EditorNode::reload_scene(const String &p_path) { // Reload scene. _remove_scene(scene_idx, false); - load_scene(p_path, true, false, true, true); + load_scene(p_path, true, false, true); // Adjust index so tab is back a the previous position. editor_data.move_edited_scene_to_index(scene_idx); @@ -6326,7 +6328,7 @@ void EditorNode::_inherit_imported(const String &p_action) { } void EditorNode::_open_imported() { - load_scene(open_import_request, true, false, true, true); + load_scene(open_import_request, true, false, true); } void EditorNode::dim_editor(bool p_dimming) { @@ -7711,6 +7713,7 @@ EditorNode::EditorNode() { load_error_dialog->set_unparent_when_invisible(true); load_error_dialog->add_child(load_errors); load_error_dialog->set_title(TTR("Load Errors")); + load_error_dialog->connect(SceneStringName(visibility_changed), callable_mp(this, &EditorNode::_load_error_dialog_visibility_changed)); execute_outputs = memnew(RichTextLabel); execute_outputs->set_selection_enabled(true); diff --git a/editor/editor_node.h b/editor/editor_node.h index 4127dd1539d..b0c254e9854 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -660,6 +660,7 @@ private: void _remove_all_not_owned_children(Node *p_node, Node *p_owner); void _progress_dialog_visibility_changed(); + void _load_error_dialog_visibility_changed(); protected: friend class FileSystemDock; @@ -771,7 +772,7 @@ public: void fix_dependencies(const String &p_for_file); int new_scene(); - Error load_scene(const String &p_scene, bool p_ignore_broken_deps = false, bool p_set_inherited = false, bool p_clear_errors = true, bool p_force_open_imported = false, bool p_silent_change_tab = false); + Error load_scene(const String &p_scene, bool p_ignore_broken_deps = false, bool p_set_inherited = false, bool p_force_open_imported = false, bool p_silent_change_tab = false); Error load_resource(const String &p_resource, bool p_ignore_broken_deps = false); HashMap get_modified_properties_for_node(Node *p_node, bool p_node_references_only);