Merge pull request #53705 from e8newallm/53668

Fixed editor attempting to save a blank scene with save all scenes
This commit is contained in:
Rémi Verschelde 2021-10-12 22:35:10 +02:00 committed by GitHub
commit b747063050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -1776,19 +1776,25 @@ void EditorNode::restart_editor() {
} }
void EditorNode::_save_all_scenes() { void EditorNode::_save_all_scenes() {
bool all_saved = true;
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
Node *scene = editor_data.get_edited_scene_root(i); Node *scene = editor_data.get_edited_scene_root(i);
if (scene && scene->get_scene_file_path() != "" && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) { if (scene) {
if (scene->get_scene_file_path() != "" && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) {
if (i != editor_data.get_edited_scene()) { if (i != editor_data.get_edited_scene()) {
_save_scene(scene->get_scene_file_path(), i); _save_scene(scene->get_scene_file_path(), i);
} else { } else {
_save_scene_with_preview(scene->get_scene_file_path()); _save_scene_with_preview(scene->get_scene_file_path());
} }
} else { } else {
show_warning(TTR("Could not save one or more scenes!"), TTR("Save All Scenes")); all_saved = false;
}
} }
} }
if (!all_saved) {
show_warning(TTR("Could not save one or more scenes!"), TTR("Save All Scenes"));
}
_save_default_environment(); _save_default_environment();
} }