mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Safer way to update animation if changed, fixes #26670
This commit is contained in:
@@ -250,8 +250,9 @@ void UndoRedo::commit_action() {
|
||||
if (action_level > 0)
|
||||
return; //still nested
|
||||
|
||||
commiting++;
|
||||
redo(); // perform action
|
||||
|
||||
commiting--;
|
||||
if (callback && actions.size() > 0) {
|
||||
callback(callback_ud, actions[actions.size() - 1].name);
|
||||
}
|
||||
@@ -326,12 +327,10 @@ bool UndoRedo::redo() {
|
||||
if ((current_action + 1) >= actions.size())
|
||||
return false; //nothing to redo
|
||||
|
||||
commiting++;
|
||||
current_action++;
|
||||
|
||||
_process_operation_list(actions.write[current_action].do_ops.front());
|
||||
version++;
|
||||
commiting--;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -341,11 +340,9 @@ bool UndoRedo::undo() {
|
||||
ERR_FAIL_COND_V(action_level > 0, false);
|
||||
if (current_action < 0)
|
||||
return false; //nothing to redo
|
||||
commiting++;
|
||||
_process_operation_list(actions.write[current_action].undo_ops.front());
|
||||
current_action--;
|
||||
version--;
|
||||
commiting--;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user