Skip to content

Commit 17f78cd

Browse files
committed
Focus Don't Save in Reload Saved Scene and don't save unmodified scenes
1 parent 7e4f6bd commit 17f78cd

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

editor/editor_node.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,16 +2998,19 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
29982998
break;
29992999
}
30003000

3001-
if (unsaved_cache && !p_confirmed) {
3002-
confirmation->set_ok_button_text(TTR("Save & Reload"));
3003-
unsaved_message = _get_unsaved_scene_dialog_text(scene_filename, started_timestamp);
3004-
confirmation->set_text(unsaved_message + "\n\n" + TTR("Save before reloading the scene?"));
3005-
confirmation->popup_centered();
3006-
break;
3001+
if (unsaved_cache) {
3002+
if (!p_confirmed) {
3003+
confirmation->set_ok_button_text(TTRC("Save & Reload"));
3004+
unsaved_message = _get_unsaved_scene_dialog_text(scene_filename, started_timestamp);
3005+
confirmation->set_text(unsaved_message + "\n\n" + TTR("Save before reloading the scene?"));
3006+
confirmation->popup_centered();
3007+
confirmation_button->grab_focus();
3008+
break;
3009+
} else {
3010+
_save_scene_with_preview(scene_filename);
3011+
}
30073012
}
30083013

3009-
_save_scene_with_preview(scene_filename);
3010-
30113014
_discard_changes();
30123015
} break;
30133016

@@ -7788,7 +7791,7 @@ EditorNode::EditorNode() {
77887791
gui_base->add_child(orphan_resources);
77897792

77907793
confirmation = memnew(ConfirmationDialog);
7791-
confirmation->add_button(TTRC("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
7794+
confirmation_button = confirmation->add_button(TTRC("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
77927795
gui_base->add_child(confirmation);
77937796
confirmation->set_min_size(Vector2(450.0 * EDSCALE, 0));
77947797
confirmation->connect(SceneStringName(confirmed), callable_mp(this, &EditorNode::_menu_confirm_current));

editor/editor_node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ class EditorNode : public Node {
350350
Node *_last_instantiated_scene = nullptr;
351351

352352
ConfirmationDialog *confirmation = nullptr;
353+
Button *confirmation_button = nullptr;
353354
ConfirmationDialog *save_confirmation = nullptr;
354355
ConfirmationDialog *import_confirmation = nullptr;
355356
ConfirmationDialog *pick_main_scene = nullptr;

0 commit comments

Comments
 (0)