diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-08 22:45:04 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-08 22:45:04 +0100 |
commit | 1722947c75b61059af5770e36a3b7c1428bdb62b (patch) | |
tree | 468538b618f2d03dbf2419044fbfaf13ac536294 | |
parent | dbd3d8a1f8cc492e9cc77933965676de794f129f (diff) | |
parent | 8256b4ea23e75001601452eb21fb745d93439bc1 (diff) |
Merge pull request #71055 from EricEzaM/66424-fix-undo-redo
Fix Undo/Redo not working until Scene menu is opened.
-rw-r--r-- | editor/editor_node.cpp | 14 | ||||
-rw-r--r-- | editor/editor_node.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 13dd03068f..4de3763670 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1123,6 +1123,12 @@ void EditorNode::_version_button_pressed() { DisplayServer::get_singleton()->clipboard_set(version_btn->get_meta(META_TEXT_TO_COPY)); } +void EditorNode::_update_undo_redo_allowed() { + Ref<EditorUndoRedoManager> undo_redo = get_undo_redo(); + file_menu->set_item_disabled(file_menu->get_item_index(EDIT_UNDO), !undo_redo->has_undo()); + file_menu->set_item_disabled(file_menu->get_item_index(EDIT_REDO), !undo_redo->has_redo()); +} + void EditorNode::_node_renamed() { if (InspectorDock::get_inspector_singleton()) { InspectorDock::get_inspector_singleton()->update_tree(); @@ -3251,10 +3257,7 @@ void EditorNode::_update_file_menu_opened() { reopen_closed_scene_sc->set_name(TTR("Reopen Closed Scene")); file_menu->set_item_disabled(file_menu->get_item_index(FILE_OPEN_PREV), previous_scenes.is_empty()); - - Ref<EditorUndoRedoManager> undo_redo = editor_data.get_undo_redo(); - file_menu->set_item_disabled(file_menu->get_item_index(EDIT_UNDO), !undo_redo->has_undo()); - file_menu->set_item_disabled(file_menu->get_item_index(EDIT_REDO), !undo_redo->has_redo()); + _update_undo_redo_allowed(); } void EditorNode::_update_file_menu_closed() { @@ -6053,6 +6056,9 @@ EditorNode::EditorNode() { singleton = this; + get_undo_redo()->connect("version_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed)); + get_undo_redo()->connect("history_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed)); + TranslationServer::get_singleton()->set_enabled(false); // Load settings. if (!EditorSettings::get_singleton()) { diff --git a/editor/editor_node.h b/editor/editor_node.h index f3dad8e223..ae951808d5 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -577,6 +577,8 @@ private: void _titlebar_resized(); void _version_button_pressed(); + void _update_undo_redo_allowed(); + int _save_external_resources(); bool _validate_scene_recursive(const String &p_filename, Node *p_node); |