diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-12-09 09:40:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-09 09:40:56 +0100 |
commit | 1d075c34e453be148f045b52942084beb9d19ee2 (patch) | |
tree | 57a094d9905a28ead2af5bb569b98b11c9b5957a /editor | |
parent | d7b2940eb6293dfc136c379c55c852cf6898c74d (diff) | |
parent | 93f00c0303f919a7eeea16306f1fa4f516543621 (diff) |
Merge pull request #34144 from timothyqiu/closing
Fixes prompt closes the wrong scene on quit
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ab41019ac3..383514164a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2049,14 +2049,17 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER: case FILE_CLOSE: { - if (!p_confirmed && (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER)) { + if (!p_confirmed) { tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false); - String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename(); - save_confirmation->get_ok()->set_text(TTR("Save & Close")); - save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); - save_confirmation->popup_centered_minsize(); - break; - } else { + + if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) { + String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename(); + save_confirmation->get_ok()->set_text(TTR("Save & Close")); + save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); + save_confirmation->popup_centered_minsize(); + break; + } + } else if (p_option == FILE_CLOSE) { tab_closing = editor_data.get_edited_scene(); } if (!editor_data.get_edited_scene_root(tab_closing)) { |