Skip to content

Commit b7d5f97

Browse files
committed
Focus Don't Save in Reload Saved Scene and don't save unmodified scenes
1 parent f96868d commit b7d5f97

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
@@ -3012,16 +3012,19 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
30123012
break;
30133013
}
30143014

3015-
if (unsaved_cache && !p_confirmed) {
3016-
confirmation->set_ok_button_text(TTR("Save & Reload"));
3017-
unsaved_message = _get_unsaved_scene_dialog_text(scene_filename, started_timestamp);
3018-
confirmation->set_text(unsaved_message + "\n\n" + TTR("Save before reloading the scene?"));
3019-
confirmation->popup_centered();
3020-
break;
3015+
if (unsaved_cache) {
3016+
if (!p_confirmed) {
3017+
confirmation->set_ok_button_text(TTRC("Save & Reload"));
3018+
unsaved_message = _get_unsaved_scene_dialog_text(scene_filename, started_timestamp);
3019+
confirmation->set_text(unsaved_message + "\n\n" + TTR("Save before reloading the scene?"));
3020+
confirmation->popup_centered();
3021+
confirmation_button->grab_focus();
3022+
break;
3023+
} else {
3024+
_save_scene_with_preview(scene_filename);
3025+
}
30213026
}
30223027

3023-
_save_scene_with_preview(scene_filename);
3024-
30253028
_discard_changes();
30263029
} break;
30273030

@@ -7814,7 +7817,7 @@ EditorNode::EditorNode() {
78147817
gui_base->add_child(orphan_resources);
78157818

78167819
confirmation = memnew(ConfirmationDialog);
7817-
confirmation->add_button(TTRC("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
7820+
confirmation_button = confirmation->add_button(TTRC("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
78187821
gui_base->add_child(confirmation);
78197822
confirmation->set_min_size(Vector2(450.0 * EDSCALE, 0));
78207823
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
@@ -352,6 +352,7 @@ class EditorNode : public Node {
352352
Node *_last_instantiated_scene = nullptr;
353353

354354
ConfirmationDialog *confirmation = nullptr;
355+
Button *confirmation_button = nullptr;
355356
ConfirmationDialog *save_confirmation = nullptr;
356357
ConfirmationDialog *import_confirmation = nullptr;
357358
ConfirmationDialog *pick_main_scene = nullptr;

0 commit comments

Comments
 (0)