summaryrefslogtreecommitdiffstats
path: root/editor/editor_undo_redo_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_undo_redo_manager.cpp')
-rw-r--r--editor/editor_undo_redo_manager.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/editor/editor_undo_redo_manager.cpp b/editor/editor_undo_redo_manager.cpp
index 2e96ae82fc..57e55e7bac 100644
--- a/editor/editor_undo_redo_manager.cpp
+++ b/editor/editor_undo_redo_manager.cpp
@@ -264,6 +264,22 @@ void EditorUndoRedoManager::commit_action(bool p_execute) {
history.undo_stack.push_back(pending_action);
}
+ if (history.id != GLOBAL_HISTORY) {
+ // Clear global redo, to avoid unexpected actions when redoing.
+ History &global = get_or_create_history(GLOBAL_HISTORY);
+ global.redo_stack.clear();
+ global.undo_redo->discard_redo();
+ } else {
+ // On global actions, clear redo of all scenes instead.
+ for (KeyValue<int, History> &E : history_map) {
+ if (E.key == GLOBAL_HISTORY) {
+ continue;
+ }
+ E.value.redo_stack.clear();
+ E.value.undo_redo->discard_redo();
+ }
+ }
+
pending_action = Action();
is_committing = false;
emit_signal(SNAME("history_changed"));