Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty load errors popup #97013

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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;
Expand All @@ -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://")) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ class EditorNode : public Node {
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;
Expand Down Expand Up @@ -771,7 +772,7 @@ class EditorNode : public Node {

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);
Expand Down
Loading