Skip to content

Commit b8255b1

Browse files
committed
Merge pull request godotengine#91555 from AlexanderFarkas/master
Remove error messages caused by Save on Focus feature
2 parents 2c8a1f0 + bc19b79 commit b8255b1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

editor/editor_node.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ void EditorNode::_notification(int p_what) {
755755
case NOTIFICATION_APPLICATION_FOCUS_OUT: {
756756
// Save on focus loss before applying the FPS limit to avoid slowing down the saving process.
757757
if (EDITOR_GET("interface/editor/save_on_focus_loss")) {
758-
_menu_option_confirm(FILE_SAVE_SCENE, false);
758+
_menu_option_confirm(FILE_SAVE_SCENE_SILENTLY, false);
759759
}
760760

761761
// Set a low FPS cap to decrease CPU/GPU usage while the editor is unfocused.
@@ -2673,6 +2673,16 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
26732673
case FILE_CLOSE: {
26742674
_scene_tab_closed(editor_data.get_edited_scene());
26752675
} break;
2676+
case FILE_SAVE_SCENE_SILENTLY: {
2677+
// Save scene without displaying progress dialog. Used to work around
2678+
// errors about parent node being busy setting up children
2679+
// when Save on Focus Loss kicks in.
2680+
Node *scene = editor_data.get_edited_scene_root();
2681+
if (scene && !scene->get_scene_file_path().is_empty() && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) {
2682+
_save_scene(scene->get_scene_file_path());
2683+
save_editor_layout_delayed();
2684+
}
2685+
} break;
26762686
case SCENE_TAB_CLOSE:
26772687
case FILE_SAVE_SCENE: {
26782688
int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing_idx;

editor/editor_node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class EditorNode : public Node {
159159
FILE_NEW_INHERITED_SCENE,
160160
FILE_OPEN_SCENE,
161161
FILE_SAVE_SCENE,
162+
FILE_SAVE_SCENE_SILENTLY,
162163
FILE_SAVE_AS_SCENE,
163164
FILE_SAVE_ALL_SCENES,
164165
FILE_SAVE_AND_RUN,

0 commit comments

Comments
 (0)