Skip to content

Commit 78fade3

Browse files
committed
Merge pull request godotengine#89874 from jsjtxietian/path2d
Fix Path2D's add new point's UndoRedo bug
2 parents 9a9045c + 09a6b5a commit 78fade3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

editor/plugins/path_2d_editor_plugin.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,20 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
225225
break;
226226

227227
case ACTION_MOVING_POINT:
228-
case ACTION_MOVING_NEW_POINT: {
229228
if (original_mouse_pos != gpoint) {
230-
if (action == ACTION_MOVING_POINT) {
231-
undo_redo->create_action(TTR("Move Point in Curve"));
232-
undo_redo->add_undo_method(curve.ptr(), "set_point_position", action_point, moving_from);
233-
}
229+
undo_redo->create_action(TTR("Move Point in Curve"));
230+
undo_redo->add_undo_method(curve.ptr(), "set_point_position", action_point, moving_from);
234231
undo_redo->add_do_method(curve.ptr(), "set_point_position", action_point, cpoint);
235232
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
236233
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
237234
undo_redo->commit_action(false);
238235
}
236+
break;
237+
case ACTION_MOVING_NEW_POINT: {
238+
undo_redo->add_do_method(curve.ptr(), "set_point_position", action_point, cpoint);
239+
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
240+
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
241+
undo_redo->commit_action(false);
239242
} break;
240243

241244
case ACTION_MOVING_IN: {

0 commit comments

Comments
 (0)