Merge pull request #83024 from SaracenOne/dependency_menu_fix

Fix dependency menu not showing up if scene failed to load.
This commit is contained in:
Rémi Verschelde 2023-10-09 23:23:59 +02:00
commit 0e547bccd5
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 11 additions and 10 deletions

View File

@ -3732,16 +3732,6 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
Error err; Error err;
Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", ResourceFormatLoader::CACHE_MODE_REPLACE, &err); Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", ResourceFormatLoader::CACHE_MODE_REPLACE, &err);
if (!sdata.is_valid()) {
_dialog_display_load_error(lpath, err);
opening_prev = false;
if (prev != -1) {
_set_current_scene(prev);
editor_data.remove_scene(idx);
}
return ERR_FILE_NOT_FOUND;
}
if (!p_ignore_broken_deps && dependency_errors.has(lpath)) { if (!p_ignore_broken_deps && dependency_errors.has(lpath)) {
current_menu_option = -1; current_menu_option = -1;
@ -3759,6 +3749,17 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
return ERR_FILE_MISSING_DEPENDENCIES; return ERR_FILE_MISSING_DEPENDENCIES;
} }
if (!sdata.is_valid()) {
_dialog_display_load_error(lpath, err);
opening_prev = false;
if (prev != -1) {
_set_current_scene(prev);
editor_data.remove_scene(idx);
}
return ERR_FILE_NOT_FOUND;
}
dependency_errors.erase(lpath); // At least not self path. dependency_errors.erase(lpath); // At least not self path.
for (KeyValue<String, HashSet<String>> &E : dependency_errors) { for (KeyValue<String, HashSet<String>> &E : dependency_errors) {