From 8ef2e3d76c17303eae61d4cd89e6ac972275fe43 Mon Sep 17 00:00:00 2001 From: Henrique Alves Date: Fri, 26 May 2023 23:23:06 -0300 Subject: [PATCH] Add `save_all_scenes` method to Editor Interface Update documentation (squash) fix docs (squash) Improve docs --- doc/classes/EditorInterface.xml | 10 ++++++++-- editor/editor_interface.cpp | 5 +++++ editor/editor_interface.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index f8002c260f3b..06b72fceb74b 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -262,10 +262,16 @@ Restarts the editor. This closes the editor and then opens the same project. If [param save] is [code]true[/code], the project will be saved before restarting. + + + + Saves all opened scenes in the editor. + + - Saves the scene. Returns either [constant OK] or [constant ERR_CANT_CREATE]. + Saves the currently active scene. Returns either [constant OK] or [constant ERR_CANT_CREATE]. @@ -273,7 +279,7 @@ - Saves the scene as a file at [param path]. + Saves the currently active scene as a file at [param path]. diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp index d9d9dc01c0d7..6b5f8e27aca3 100644 --- a/editor/editor_interface.cpp +++ b/editor/editor_interface.cpp @@ -337,6 +337,10 @@ void EditorInterface::mark_scene_as_unsaved() { EditorUndoRedoManager::get_singleton()->set_history_as_unsaved(EditorNode::get_editor_data().get_current_edited_scene_history_id()); } +void EditorInterface::save_all_scenes() { + EditorNode::get_singleton()->save_all_scenes(); +} + // Scene playback. void EditorInterface::play_main_scene() { @@ -434,6 +438,7 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene); ClassDB::bind_method(D_METHOD("save_scene_as", "path", "with_preview"), &EditorInterface::save_scene_as, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("save_all_scenes"), &EditorInterface::save_all_scenes); ClassDB::bind_method(D_METHOD("mark_scene_as_unsaved"), &EditorInterface::mark_scene_as_unsaved); diff --git a/editor/editor_interface.h b/editor/editor_interface.h index f7e8cf8d4c60..a348023e4d97 100644 --- a/editor/editor_interface.h +++ b/editor/editor_interface.h @@ -130,6 +130,7 @@ class EditorInterface : public Object { Error save_scene(); void save_scene_as(const String &p_scene, bool p_with_preview = true); void mark_scene_as_unsaved(); + void save_all_scenes(); // Scene playback.