Merge pull request #96237 from KoBeWi/you_expected_path_to_even_less_bugs_branch_but_it_was_me,_dio
Fix Path2D splitting
This commit is contained in:
commit
b104f21841
|
@ -197,12 +197,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||
const Vector2 new_point = xform.affine_inverse().xform(gpoint2);
|
||||
curve->add_point(new_point, Vector2(0, 0), Vector2(0, 0), insertion_point + 1);
|
||||
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Split Curve"));
|
||||
undo_redo->add_do_method(curve.ptr(), "add_point", new_point, Vector2(0, 0), Vector2(0, 0), insertion_point + 1);
|
||||
undo_redo->add_undo_method(curve.ptr(), "remove_point", insertion_point + 1);
|
||||
|
||||
action = ACTION_MOVING_NEW_POINT;
|
||||
action = ACTION_MOVING_NEW_POINT_FROM_SPLIT;
|
||||
action_point = insertion_point + 1;
|
||||
moving_from = curve->get_point_position(action_point);
|
||||
moving_screen_from = gpoint2;
|
||||
|
@ -245,6 +240,16 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||
undo_redo->commit_action(false);
|
||||
} break;
|
||||
|
||||
case ACTION_MOVING_NEW_POINT_FROM_SPLIT: {
|
||||
undo_redo->create_action(TTR("Split Curve"));
|
||||
undo_redo->add_do_method(curve.ptr(), "add_point", Vector2(), Vector2(), Vector2(), action_point);
|
||||
undo_redo->add_do_method(curve.ptr(), "set_point_position", action_point, cpoint);
|
||||
undo_redo->add_undo_method(curve.ptr(), "remove_point", action_point);
|
||||
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_IN: {
|
||||
if (original_mouse_pos != gpoint) {
|
||||
undo_redo->create_action(TTR("Move In-Control in Curve"));
|
||||
|
@ -350,7 +355,8 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||
break;
|
||||
|
||||
case ACTION_MOVING_POINT:
|
||||
case ACTION_MOVING_NEW_POINT: {
|
||||
case ACTION_MOVING_NEW_POINT:
|
||||
case ACTION_MOVING_NEW_POINT_FROM_SPLIT: {
|
||||
curve->set_point_position(action_point, cpoint);
|
||||
} break;
|
||||
|
||||
|
@ -573,6 +579,10 @@ void Path2DEditor::_cancel_current_action() {
|
|||
curve->remove_point(curve->get_point_count() - 1);
|
||||
} break;
|
||||
|
||||
case ACTION_MOVING_NEW_POINT_FROM_SPLIT: {
|
||||
curve->remove_point(action_point);
|
||||
} break;
|
||||
|
||||
case ACTION_MOVING_IN: {
|
||||
curve->set_point_in(action_point, moving_from);
|
||||
curve->set_point_out(action_point, mirror_handle_length ? -moving_from : (-moving_from.normalized() * orig_out_length));
|
||||
|
|
|
@ -81,6 +81,7 @@ class Path2DEditor : public HBoxContainer {
|
|||
ACTION_NONE,
|
||||
ACTION_MOVING_POINT,
|
||||
ACTION_MOVING_NEW_POINT,
|
||||
ACTION_MOVING_NEW_POINT_FROM_SPLIT,
|
||||
ACTION_MOVING_IN,
|
||||
ACTION_MOVING_OUT,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue