diff options
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index e41b1999198..dd5932af895 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3084,6 +3084,24 @@ void BKE_nurb_handles_calc(Nurb *nu) /* first, if needed, set handle flags */ calchandlesNurb_intern(nu, FALSE); } +/* similar to BKE_nurb_handle_calc but for curves and + * figures out the previous and next for us */ +void BKE_nurb_handle_calc_simple(Nurb *nu, BezTriple *bezt) +{ + int index = (int)(bezt - nu->bezt); + BezTriple *prev, *next; + + BLI_assert(ARRAY_HAS_ITEM(bezt, nu->bezt, nu->pntsu)); + + if (index == 0) { + prev = (nu->flag & CU_NURB_CYCLIC) ? &nu->bezt[nu->pntsu - 1] : NULL; + } + if (index == nu->pntsu - 1) { + next = (nu->flag & CU_NURB_CYCLIC) ? &nu->bezt[0] : NULL; + } + + BKE_nurb_handle_calc(bezt, prev, next, 0); +} void BKE_nurb_handles_test(Nurb *nu) { |