Merge pull request #97013 from Hilderin/fix-load-errors-popup-empty

Fix empty load errors popup
This commit is contained in:
Rémi Verschelde 2024-09-24 12:57:04 +02:00
commit fc960cdf80
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 13 additions and 9 deletions

View File

@ -1202,7 +1202,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));
}
@ -3931,7 +3931,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;
@ -3954,10 +3954,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://")) {
@ -4935,6 +4931,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()) {
@ -5915,7 +5917,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);
@ -6441,7 +6443,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) {
@ -7848,6 +7850,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);

View File

@ -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;
@ -778,7 +779,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<StringName, Variant> get_modified_properties_for_node(Node *p_node, bool p_node_references_only);