Fix 'UndoRedo's 'MERGE_ALL' mode repeating instructions when quickly commiting actions
It seems that the merge operation validation is only useful to the 'MERGE_ENDS' mode, causing problems when in 'MERGE_ALL'. Fixes #26118.
This commit is contained in:
parent
a01dca79e2
commit
79f1d8b4fb
1 changed files with 13 additions and 19 deletions
|
@ -63,12 +63,10 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
|
||||||
_discard_redo();
|
_discard_redo();
|
||||||
|
|
||||||
// Check if the merge operation is valid
|
// Check if the merge operation is valid
|
||||||
if (p_mode != MERGE_DISABLE && actions.size() && actions[actions.size() - 1].name == p_name && actions[actions.size() - 1].last_tick + 800 > ticks) {
|
if (p_mode == MERGE_ENDS && actions.size() && actions[actions.size() - 1].name == p_name && actions[actions.size() - 1].last_tick + 800 > ticks) {
|
||||||
|
|
||||||
current_action = actions.size() - 2;
|
current_action = actions.size() - 2;
|
||||||
|
|
||||||
if (p_mode == MERGE_ENDS) {
|
|
||||||
|
|
||||||
// Clear all do ops from last action, and delete all object references
|
// Clear all do ops from last action, and delete all object references
|
||||||
List<Operation>::Element *E = actions.write[current_action + 1].do_ops.front();
|
List<Operation>::Element *E = actions.write[current_action + 1].do_ops.front();
|
||||||
|
|
||||||
|
@ -85,21 +83,17 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
|
||||||
E = E->next();
|
E = E->next();
|
||||||
actions.write[current_action + 1].do_ops.pop_front();
|
actions.write[current_action + 1].do_ops.pop_front();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
actions.write[actions.size() - 1].last_tick = ticks;
|
actions.write[actions.size() - 1].last_tick = ticks;
|
||||||
|
|
||||||
merge_mode = p_mode;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Action new_action;
|
Action new_action;
|
||||||
new_action.name = p_name;
|
new_action.name = p_name;
|
||||||
new_action.last_tick = ticks;
|
new_action.last_tick = ticks;
|
||||||
actions.push_back(new_action);
|
actions.push_back(new_action);
|
||||||
|
|
||||||
merge_mode = MERGE_DISABLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
merge_mode = p_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
action_level++;
|
action_level++;
|
||||||
|
|
Loading…
Reference in a new issue