From 0602852860dda7dfc0ea20c72e03b7f96c981f1a Mon Sep 17 00:00:00 2001 From: Laurynas Duburas Date: Thu, 10 Mar 2022 18:34:27 -0600 Subject: Curve: Improve NURBS knot generation modes This patch enables all 8 combinations of Nurbs modes: Cyclic, Bezier and Endpoint. Also removes restriction on Bezier Nurbs order. The most significant changes are mode combinations bringing new meaning. In D13891 is a scheme showing NURBS with same control points in a modes, and also further description of each possible case. Differential Revision: https://developer.blender.org/D13891 --- source/blender/editors/curve/editcurve.c | 2 +- source/blender/editors/curve/editcurve_add.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/curve') diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index ba9502b80bf..f992309ed00 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4958,7 +4958,7 @@ bool ed_editnurb_spin( /* It is challenging to create a good approximation of a circle with uniform knots vector * (which is forced in Blender for cyclic NURBS curves). Here a NURBS circle is constructed * by connecting four Bezier arcs. */ - nu->flagv |= CU_NURB_CYCLIC | CU_NURB_BEZIER; + nu->flagv |= CU_NURB_CYCLIC | CU_NURB_BEZIER | CU_NURB_ENDPOINT; BKE_nurb_knot_calc_v(nu); } } diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index d7201495f75..ba5a7409ba7 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -292,7 +292,7 @@ Nurb *ED_curve_add_nurbs_primitive( nu->pntsv = 1; nu->orderu = 3; nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim6"); - nu->flagu = CU_NURB_CYCLIC | CU_NURB_BEZIER; + nu->flagu = CU_NURB_CYCLIC | CU_NURB_BEZIER | CU_NURB_ENDPOINT; bp = nu->bp; for (a = 0; a < 8; a++) { @@ -407,7 +407,7 @@ Nurb *ED_curve_add_nurbs_primitive( mul_m4_v3(mat, bp->vec); bp++; } - nu->flagu = CU_NURB_BEZIER; + nu->flagu = CU_NURB_BEZIER | CU_NURB_ENDPOINT; BKE_nurb_knot_calc_u(nu); BLI_addtail(editnurb, nu); /* temporal for spin */ -- cgit v1.2.3