summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Alexsander <michaelalexsander@protonmail.com>2021-12-24 01:19:24 -0300
committerMichael Alexsander <michaelalexsander@protonmail.com>2021-12-24 01:19:24 -0300
commit6033711379a73d952073e6818c1b5c635f57dc28 (patch)
treeb24e70f52a37b65b705e400fee19ad29f3075445
parent0f6a6ca5be1d674a6dfce03684bbf469d77e5e63 (diff)
Fix undo/redo operations in Input Map
-rw-r--r--editor/action_map_editor.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index a8d3bfcc90..da49c7c46c 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -742,7 +742,7 @@ void ActionMapEditor::_event_config_confirmed() {
Ref<InputEvent> ev = event_config_dialog->get_event();
Dictionary new_action = current_action.duplicate();
- Array events = new_action["events"];
+ Array events = new_action["events"].duplicate();
if (current_action_event_index == -1) {
// Add new event
@@ -819,7 +819,6 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i
current_action_event_index = -1;
event_config_dialog->popup_and_configure();
-
} break;
case ActionMapEditor::BUTTON_EDIT_EVENT: {
// Action and Action name is located on the parent of the event.
@@ -832,7 +831,6 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i
if (ie.is_valid()) {
event_config_dialog->popup_and_configure(ie);
}
-
} break;
case ActionMapEditor::BUTTON_REMOVE_ACTION: {
// Send removed action name
@@ -841,12 +839,12 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i
} break;
case ActionMapEditor::BUTTON_REMOVE_EVENT: {
// Remove event and send updated action
- Dictionary action = item->get_parent()->get_meta("__action");
+ Dictionary action = item->get_parent()->get_meta("__action").duplicate();
String action_name = item->get_parent()->get_meta("__name");
int event_index = item->get_meta("__index");
- Array events = action["events"];
+ Array events = action["events"].duplicate();
events.remove_at(event_index);
action["events"] = events;