summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSofox <sofoxx@gmail.com>2023-11-26 17:13:35 +0000
committerSofox <sofoxx@gmail.com>2024-03-05 23:40:26 +0000
commitf249667dc8d490d25624122d8a05e229af61ef62 (patch)
tree504629d3c76ec9da6d8bf50485884816941e732e /core
parent7d80635fce1d0c44fa69d4d8cf3da40fa998f9c7 (diff)
downloadredot-engine-f249667dc8d490d25624122d8a05e229af61ef62.tar.gz
Fixed MERGE_ALL commit from repeating actions
Diffstat (limited to 'core')
-rw-r--r--core/object/undo_redo.cpp16
-rw-r--r--core/object/undo_redo.h1
2 files changed, 16 insertions, 1 deletions
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp
index 569e6ae19f..6a1385e268 100644
--- a/core/object/undo_redo.cpp
+++ b/core/object/undo_redo.cpp
@@ -71,7 +71,14 @@ bool UndoRedo::_redo(bool p_execute) {
}
current_action++;
- _process_operation_list(actions.write[current_action].do_ops.front(), p_execute);
+
+ List<Operation>::Element *start_doops_element = actions.write[current_action].do_ops.front();
+ while (merge_total > 0 && start_doops_element) {
+ start_doops_element = start_doops_element->next();
+ merge_total--;
+ }
+
+ _process_operation_list(start_doops_element, p_execute);
version++;
emit_signal(SNAME("version_changed"));
@@ -104,6 +111,12 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode, bool p_back
}
}
+ if (p_mode == MERGE_ALL) {
+ merge_total = actions.write[current_action + 1].do_ops.size();
+ } else {
+ merge_total = 0;
+ }
+
actions.write[actions.size() - 1].last_tick = ticks;
// Revert reverse from previous commit.
@@ -121,6 +134,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode, bool p_back
actions.push_back(new_action);
merge_mode = MERGE_DISABLE;
+ merge_total = 0;
}
}
diff --git a/core/object/undo_redo.h b/core/object/undo_redo.h
index 62aebff877..19d178635c 100644
--- a/core/object/undo_redo.h
+++ b/core/object/undo_redo.h
@@ -84,6 +84,7 @@ private:
MergeMode merge_mode = MERGE_DISABLE;
bool merging = false;
uint64_t version = 1;
+ int merge_total = 0;
void _pop_history_tail();
void _process_operation_list(List<Operation>::Element *E, bool p_execute);