diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-02-25 14:20:38 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 14:20:38 -0300 |
commit | d360931e1fa9689a9994d64d8e8e8cc0b727e2f0 (patch) | |
tree | e6c79ec290c1ebc8ec08d147c7a563aac71cd20e /core | |
parent | 4a9c0ed8d9ca42e198cb8f8fdf3a60c08bad4fef (diff) | |
parent | dcf6c4a368c4ac8c0db1c61a6ffe5c3b5e437337 (diff) |
Merge pull request #26280 from YeldhamDev/revert_merge_all_fix
Revert "Fix 'UndoRedo's 'MERGE_ALL' mode repeating instructions when quickly commiting actions"
Diffstat (limited to 'core')
-rw-r--r-- | core/undo_redo.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index 40ccd95758..00894b41d8 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -63,37 +63,43 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) { _discard_redo(); // Check if the merge operation is valid - if (p_mode == MERGE_ENDS && actions.size() && actions[actions.size() - 1].name == p_name && actions[actions.size() - 1].last_tick + 800 > ticks) { + if (p_mode != MERGE_DISABLE && actions.size() && actions[actions.size() - 1].name == p_name && actions[actions.size() - 1].last_tick + 800 > ticks) { current_action = actions.size() - 2; - // Clear all do ops from last action, and delete all object references - List<Operation>::Element *E = actions.write[current_action + 1].do_ops.front(); + if (p_mode == MERGE_ENDS) { - while (E) { + // Clear all do ops from last action, and delete all object references + List<Operation>::Element *E = actions.write[current_action + 1].do_ops.front(); - if (E->get().type == Operation::TYPE_REFERENCE) { + while (E) { - Object *obj = ObjectDB::get_instance(E->get().object); + if (E->get().type == Operation::TYPE_REFERENCE) { - if (obj) - memdelete(obj); - } + Object *obj = ObjectDB::get_instance(E->get().object); + + if (obj) + memdelete(obj); + } - E = E->next(); - actions.write[current_action + 1].do_ops.pop_front(); + E = E->next(); + actions.write[current_action + 1].do_ops.pop_front(); + } } actions.write[actions.size() - 1].last_tick = ticks; + + merge_mode = p_mode; + } else { Action new_action; new_action.name = p_name; new_action.last_tick = ticks; actions.push_back(new_action); - } - merge_mode = p_mode; + merge_mode = MERGE_DISABLE; + } } action_level++; |