diff options
-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); + } } } } |