From 2bb7a9f05d975a47f79b3e180cfce2ef68a9ee50 Mon Sep 17 00:00:00 2001 From: Casey Bianco-Davis Date: Tue, 14 Oct 2025 10:50:21 +0200 Subject: [PATCH] Fix #147402: Pen Tool doesn't return to the `Aligned` type after `LeftCtrl` This makes it so that the Pen Tool will return the handle type back to `Align` after letting go of `LeftCtrl` This effects Grease Pencil and Curves objects. Pull Request: https://projects.blender.org/blender/blender/pulls/147943 --- source/blender/editors/curves/intern/curves_pen.cc | 11 ++++++++++- source/blender/editors/include/ED_curves.hh | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/curves/intern/curves_pen.cc b/source/blender/editors/curves/intern/curves_pen.cc index 188a8bbd4aa..3da8288201d 100644 --- a/source/blender/editors/curves/intern/curves_pen.cc +++ b/source/blender/editors/curves/intern/curves_pen.cc @@ -479,7 +479,9 @@ static bool move_handles_in_curve(const PenToolOperation &ptd, offset = snap_8_angles(offset); } - if (ptd.point_added) { + /* Set both handles to be `Aligned` if this point is newly added or is + * no longer control freely. */ + if (ptd.point_added || ptd.handle_moved) { handle_types_left[point_i] = BEZIER_HANDLE_ALIGN; handle_types_right[point_i] = BEZIER_HANDLE_ALIGN; } @@ -1181,6 +1183,8 @@ wmOperatorStatus PenToolOperation::invoke(bContext *C, wmOperator *op, const wmE this->move_entire = false; this->snap_angle = false; + this->handle_moved = false; + if (!(ELEM(event->type, LEFTMOUSE) && ELEM(event->val, KM_PRESS, KM_DBL_CLICK))) { return OPERATOR_RUNNING_MODAL; } @@ -1223,6 +1227,11 @@ wmOperatorStatus PenToolOperation::modal(bContext *C, wmOperator *op, const wmEv } else if (event->val == int(PenModal::MoveHandle)) { this->move_handle = !this->move_handle; + + /* Record if handle has every been moved. */ + if (this->move_handle) { + this->handle_moved = true; + } } } diff --git a/source/blender/editors/include/ED_curves.hh b/source/blender/editors/include/ED_curves.hh index 5fe9f5e1232..b2a599fb03b 100644 --- a/source/blender/editors/include/ED_curves.hh +++ b/source/blender/editors/include/ED_curves.hh @@ -91,6 +91,8 @@ class PenToolOperation { bool point_added; bool point_removed; + /* Used to go back to `aligned` after `move_handle` becomes `false` */ + bool handle_moved; float4x4 projection; float2 mouse_co;