diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-12 13:00:48 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-12 13:00:48 +0400 |
commit | bc5dc88bda64125e77e5be675eb4af549405a595 (patch) | |
tree | e6b5ae8fe2f76d102231d7a85d2caf755b21a781 | |
parent | 1c5b416cbf989d81b7a74b87df352be0551e0d7d (diff) |
Fix #36420: ends of curves - caps & twist not good
Forgot to calculate directions of first/last points
for NURBS and POLY splines.
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 849c1c0d3e1..26ae1b94aee 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2408,6 +2408,23 @@ static void make_bevel_list_2D(BevList *bl) } } +static void bevlist_firstlast_direction_calc_from_bpoint(Nurb *nu, BevList *bl) +{ + if (nu->pntsu > 1) { + BPoint *first_bp = nu->bp, *last_bp = nu->bp + (nu->pntsu - 1); + BevPoint *first_bevp, *last_bevp; + + first_bevp = (BevPoint *)(bl + 1); + last_bevp = first_bevp + (bl->nr - 1); + + sub_v3_v3v3(first_bevp->dir, (first_bp + 1)->vec, first_bp->vec); + normalize_v3(first_bevp->dir); + + sub_v3_v3v3(last_bevp->dir, last_bp->vec, (last_bp - 1)->vec); + normalize_v3(last_bevp->dir); + } +} + void BKE_curve_bevelList_make(Object *ob) { /* @@ -2491,6 +2508,10 @@ void BKE_curve_bevelList_make(Object *ob) bevp++; bp++; } + + if ((nu->flagu & CU_NURB_CYCLIC) == 0) { + bevlist_firstlast_direction_calc_from_bpoint(nu, bl); + } } else if (nu->type == CU_BEZIER) { /* in case last point is not cyclic */ @@ -2601,6 +2622,10 @@ void BKE_curve_bevelList_make(Object *ob) do_radius ? &bevp->radius : NULL, do_weight ? &bevp->weight : NULL, resolu, sizeof(BevPoint)); + + if ((nu->flagu & CU_NURB_CYCLIC) == 0) { + bevlist_firstlast_direction_calc_from_bpoint(nu, bl); + } } } } |