[Bf-blender-cvs] [b14f7ae8f4b] soc-2021-curves: Make cyclic only by clicking center of endpoints

dilithjay noreply at git.blender.org
Sun Jan 2 11:03:17 CET 2022


Commit: b14f7ae8f4b0bfc92517bba791adaf024a330a1a
Author: dilithjay
Date:   Sun Jan 2 11:53:54 2022 +0530
Branches: soc-2021-curves
https://developer.blender.org/rBb14f7ae8f4b0bfc92517bba791adaf024a330a1a

Make cyclic only by clicking center of endpoints

===================================================================

M	source/blender/editors/curve/editcurve_pen.c

===================================================================

diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index 6ae821cfb18..d8de0a83f51 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -1106,13 +1106,19 @@ static bool make_cyclic_if_endpoints(Nurb *sel_nu,
     Nurb *nu = NULL;
     BezTriple *bezt = NULL;
     BPoint *bp = NULL;
-    Base *basact = NULL;
-    ED_curve_pick_vert_thresholded(vc, 1, sel_dist_mul, &nu, &bezt, &bp, &hand, &basact);
-
-    if (nu == sel_nu && ((nu->type == CU_BEZIER && bezt != sel_bezt &&
-                          (bezt == nu->bezt || bezt == nu->bezt + nu->pntsu - 1)) ||
-                         (nu->type != CU_BEZIER && bp != sel_bp &&
-                          (bp == nu->bp || bp == nu->bp + nu->pntsu - 1)))) {
+    // Base *basact = NULL;
+    Curve *cu = vc->obedit->data;
+    short bezt_idx;
+    const float mval_fl[2] = {(float)vc->mval[0], (float)vc->mval[1]};
+    // ED_curve_pick_vert_thresholded(vc, 1, sel_dist_mul, &nu, &bezt, &bp, &hand, &basact);
+    get_closest_vertex_to_point_in_nurbs(
+        &(cu->editnurb->nurbs), &nu, &bezt, &bp, &bezt_idx, mval_fl, sel_dist_mul, vc);
+
+    if (nu == sel_nu &&
+        ((nu->type == CU_BEZIER && bezt != sel_bezt &&
+          (bezt == nu->bezt || bezt == nu->bezt + nu->pntsu - 1) && bezt_idx == 1) ||
+         (nu->type != CU_BEZIER && bp != sel_bp &&
+          (bp == nu->bp || bp == nu->bp + nu->pntsu - 1)))) {
       View3D *v3d = CTX_wm_view3d(C);
       ListBase *editnurb = object_editcurve_get(vc->obedit);
       ed_curve_toggle_cyclic(v3d, editnurb, 0);



More information about the Bf-blender-cvs mailing list