Skip to content

Commit e2155eb

Browse files
authored
Merge pull request godotengine#77537 from henriquelalves/feature/ei_save_all_scenes
Expose `save_all_scenes` method to EditorInterface
2 parents f316504 + 5918041 commit e2155eb

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

doc/classes/EditorInterface.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,24 @@
270270
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.
271271
</description>
272272
</method>
273+
<method name="save_all_scenes">
274+
<return type="void" />
275+
<description>
276+
Saves all opened scenes in the editor.
277+
</description>
278+
</method>
273279
<method name="save_scene">
274280
<return type="int" enum="Error" />
275281
<description>
276-
Saves the scene. Returns either [constant OK] or [constant ERR_CANT_CREATE].
282+
Saves the currently active scene. Returns either [constant OK] or [constant ERR_CANT_CREATE].
277283
</description>
278284
</method>
279285
<method name="save_scene_as">
280286
<return type="void" />
281287
<param index="0" name="path" type="String" />
282288
<param index="1" name="with_preview" type="bool" default="true" />
283289
<description>
284-
Saves the scene as a file at [param path].
290+
Saves the currently active scene as a file at [param path].
285291
</description>
286292
</method>
287293
<method name="select_file">

editor/editor_interface.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ void EditorInterface::mark_scene_as_unsaved() {
346346
EditorUndoRedoManager::get_singleton()->set_history_as_unsaved(EditorNode::get_editor_data().get_current_edited_scene_history_id());
347347
}
348348

349+
void EditorInterface::save_all_scenes() {
350+
EditorNode::get_singleton()->save_all_scenes();
351+
}
352+
349353
// Scene playback.
350354

351355
void EditorInterface::play_main_scene() {
@@ -446,6 +450,7 @@ void EditorInterface::_bind_methods() {
446450

447451
ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene);
448452
ClassDB::bind_method(D_METHOD("save_scene_as", "path", "with_preview"), &EditorInterface::save_scene_as, DEFVAL(true));
453+
ClassDB::bind_method(D_METHOD("save_all_scenes"), &EditorInterface::save_all_scenes);
449454

450455
ClassDB::bind_method(D_METHOD("mark_scene_as_unsaved"), &EditorInterface::mark_scene_as_unsaved);
451456

editor/editor_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class EditorInterface : public Object {
133133
Error save_scene();
134134
void save_scene_as(const String &p_scene, bool p_with_preview = true);
135135
void mark_scene_as_unsaved();
136+
void save_all_scenes();
136137

137138
// Scene playback.
138139

0 commit comments

Comments
 (0)