Fixed editor attempting to save a blank scene with save all scenes

This commit is contained in:
Matthew Newall 2021-10-12 10:14:02 +00:00
parent 1bd6a2f020
commit e10d0d76bc
1 changed files with 12 additions and 6 deletions

View File

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