Skip to content

Commit

Permalink
Merge pull request #89874 from jsjtxietian/path2d
Browse files Browse the repository at this point in the history
Fix Path2D's add new point's UndoRedo bug
  • Loading branch information
akien-mga committed Apr 9, 2024
2 parents 9a9045c + 09a6b5a commit 78fade3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions editor/plugins/path_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 78fade3

Please sign in to comment.