Repository: godotengine/godot (language: cpp)

Issue:
`Save all Scenes` doesn't prompt to save scenes that have not been saved to a file
### Tested versions

4.4.beta3

### System information

Godot v4.4.beta3 - Android - Single-window, 1 monitor - Vulkan (Mobile) - integrated Mali-G57 MC2 -  (8 threads)

### Issue description

When clicking `File > Save all Scenes`, the editor won't prompt to select a file name for saving scenes that are not saved to a file.

https://github.com/user-attachments/assets/d9011c1e-ee50-4d88-8530-f62dc863bd77

### Steps to reproduce

Open a new scene. Add a root node and click `File > Save all Scenes`. The scene won't be saved

### Minimal reproduction project (MRP)

N/A


Discussion / hints:
CC @KoBeWi 

Fix patch:
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 91ec8e9bcdcc..3dda49250bc3 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2054,7 +2054,7 @@ void EditorNode::restart_editor(bool p_goto_project_manager) {
 }
 
 void EditorNode::_save_all_scenes() {
-	bool all_saved = true;
+	scenes_to_save_as.clear(); // In case saving was canceled before.
 	for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
 		if (!_is_scene_unsaved(i)) {
 			continue;
@@ -2064,8 +2064,8 @@ void EditorNode::_save_all_scenes() {
 		ERR_FAIL_NULL(scene);
 
 		const String &scene_path = scene->get_scene_file_path();
-		if (!scene_path.is_empty() && !DirAccess::exists(scene_path.get_base_dir())) {
-			all_saved = false;
+		if (scene_path.is_empty() || !DirAccess::exists(scene_path.get_base_dir())) {
+			scenes_to_save_as.push_back(i);
 			continue;
 		}
 
@@ -2075,11 +2075,11 @@ void EditorNode::_save_all_scenes() {
 			_save_scene(scene_path, i);
 		}
 	}
+	save_default_environment();
 
-	if (!all_saved) {
-		show_warning(TTR("Could not save one or more scenes!"), TTR("Save All Scenes"));
+	if (!scenes_to_save_as.is_empty()) {
+		_proceed_save_asing_scene_tabs();
 	}
-	save_default_environment();
 }
 
 void EditorNode::_mark_unsaved_scenes() {
@@ -2146,8 +2146,9 @@ void EditorNode::_dialog_action(String p_file) {
 		case FILE_CLOSE:
 		case SCENE_TAB_CLOSE:
 		case FILE_SAVE_SCENE:
+		case FILE_MULTI_SAVE_AS_SCENE:
 		case FILE_SAVE_AS_SCENE: {
-			int scene_idx = (current_menu_option == FILE_SAVE_SCENE || current_menu_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
+			int scene_idx = (current_menu_option == FILE_SAVE_SCENE || current_menu_option == FILE_SAVE_AS_SCENE || current_menu_option == FILE_MULTI_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
 
 			if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
 				bool same_open_scene = false;
@@ -2175,6 +2176,10 @@ void EditorNode::_dialog_action(String p_file) {
 				}
 			}
 
+			if (current_menu_option == FILE_MULTI_SAVE_AS_SCENE) {
+				_proceed_save_asing_scene_tabs();
+			}
+
 		} break;
 
 		case FILE_SAVE_AND_RUN: {
@@ -2853,8 +2858,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
 			}
 			[[fallthrough]];
 		}
+		case FILE_MULTI_SAVE_AS_SCENE:
 		case FILE_SAVE_AS_SCENE: {
-			int scene_idx = (p_option == FILE_SAVE_SCENE || p_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
+			int scene_idx = (p_option == FILE_SAVE_SCENE || p_option == FILE_SAVE_AS_SCENE || p_option == FILE_MULTI_SAVE_AS_SCENE) ? -1 : tab_closing_idx;
 
 			Node *scene = editor_data.get_edited_scene_root(scene_idx);
 
@@ -5694,6 +5700,16 @@ void EditorNode::_proceed_closing_scene_tabs() {
 	_scene_tab_closed(tab_idx);
 }
 
+void EditorNode::_proceed_save_asing_scene_tabs() {
+	if (scenes_to_save_as.is_empty()) {
+		return;
+	}
+	int scene_idx = scenes_to_save_as.front()->get();
+	scenes_to_save_as.pop_front();
+	_set_current_scene(scene_idx);
+	_menu_option_confirm(FILE_MULTI_SAVE_AS_SCENE, false);
+}
+
 bool EditorNode::_is_closing_editor() const {
 	return tab_closing_menu_option == FILE_QUIT || tab_closing_menu_option == PROJECT_QUIT_TO_PROJECT_MANAGER || tab_closing_menu_option == PROJECT_RELOAD_CURRENT_PROJECT;
 }
diff --git a/editor/editor_node.h b/editor/editor_node.h
index cf1a0b11c9b3..bc50bd1d827a 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -140,6 +140,7 @@ class EditorNode : public Node {
 		FILE_SAVE_SCENE,
 		FILE_SAVE_AS_SCENE,
 		FILE_SAVE_ALL_SCENES,
+		FILE_MULTI_SAVE_AS_SCENE,
 		FILE_QUICK_OPEN,
 		FILE_QUICK_OPEN_SCENE,
 		FILE_QUICK_OPEN_SCRIPT,
@@ -295,6 +296,7 @@ class EditorNode : public Node {
 
 	int tab_closing_idx = 0;
 	List<String> tabs_to_close;
+	List<int> scenes_to_save_as;
 	int tab_closing_menu_option = -1;
 
 	bool exiting = false;
@@ -611,6 +613,7 @@ class EditorNode : public Node {
 	bool _find_scene_in_use(Node *p_node, const String &p_path) const;
 
 	void _proceed_closing_scene_tabs();
+	void _proceed_save_asing_scene_tabs();
 	bool _is_closing_editor() const;
 	void _restart_editor(bool p_goto_project_manager = false);
 


Test patch: