summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-04-09 22:25:18 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-04-09 22:25:18 +0200
commit78fade3809f8b372c207f72195a8e4eae29de806 (patch)
tree8336766ece4efcef6f406aa667a4170415a3d206
parent9a9045cf7adf822bb44f5833cce1bfdc0ac43ac0 (diff)
parent09a6b5a655c937b1e92976bd3252a8b54cb1ac0f (diff)
downloadredot-engine-78fade3809f8b372c207f72195a8e4eae29de806.tar.gz
Merge pull request #89874 from jsjtxietian/path2d
Fix Path2D's add new point's UndoRedo bug
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index cc9114db39..4fff3bfb8a 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -225,17 +225,20 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
break;
case ACTION_MOVING_POINT:
- case ACTION_MOVING_NEW_POINT: {
if (original_mouse_pos != gpoint) {
- if (action == ACTION_MOVING_POINT) {
- undo_redo->create_action(TTR("Move Point in Curve"));
- undo_redo->add_undo_method(curve.ptr(), "set_point_position", action_point, moving_from);
- }
+ undo_redo->create_action(TTR("Move Point in Curve"));
+ undo_redo->add_undo_method(curve.ptr(), "set_point_position", action_point, moving_from);
undo_redo->add_do_method(curve.ptr(), "set_point_position", action_point, cpoint);
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
undo_redo->commit_action(false);
}
+ break;
+ case ACTION_MOVING_NEW_POINT: {
+ undo_redo->add_do_method(curve.ptr(), "set_point_position", action_point, cpoint);
+ undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
+ undo_redo->add_do_method(canvas_item_editor, "update_viewport");
+ undo_redo->commit_action(false);
} break;
case ACTION_MOVING_IN: {