Fixes prompt closes the wrong scene when exiting
This commit is contained in:
parent
0aea0d0b39
commit
93f00c0303
1 changed files with 10 additions and 7 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue