You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Discard additional redo on commiting actions
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user