diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-04 10:14:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-04 10:14:02 +0400 |
commit | 94f35ecf1b619b756e503122434f10bc492fb37a (patch) | |
tree | 25f44524d62907f42982e035a910d74ff6efab6a /source/blender/blenkernel/intern | |
parent | bbf2db82a2c1525a262820b65e2f8b93f85a2445 (diff) |
Fix setting Curve-handle type moving the wrong one
Issue noted in T35952, now if you convert a free handle to an aligned handle,
it will move the selected handle.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 285dc412e37..9275b626b49 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3313,6 +3313,31 @@ void BKE_nurb_handles_calc(Nurb *nu) /* first, if needed, set handle flags */ calchandlesNurb_intern(nu, false); } +/** + * Workaround #BKE_nurb_handles_calc logic + * that makes unselected align to the selected handle. + */ +static void nurbList_handles_swap_select(Nurb *nu) +{ + BezTriple *bezt; + int i; + + for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) { + if ((bezt->f1 & SELECT) != (bezt->f3 & SELECT)) { + bezt->f1 ^= SELECT; + bezt->f3 ^= SELECT; + } + } +} + +/* internal use only (weak) */ +static void nurb_handles_calc__align_selected(Nurb *nu) +{ + nurbList_handles_swap_select(nu); + BKE_nurb_handles_calc(nu); + nurbList_handles_swap_select(nu); +} + /* 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) @@ -3510,7 +3535,9 @@ void BKE_nurbList_handles_set(ListBase *editnurb, const char code) } bezt++; } - BKE_nurb_handles_calc(nu); + + /* like BKE_nurb_handles_calc but moves selected */ + nurb_handles_calc__align_selected(nu); } nu = nu->next; } @@ -3554,7 +3581,9 @@ void BKE_nurbList_handles_set(ListBase *editnurb, const char code) bezt++; } - BKE_nurb_handles_calc(nu); + + /* like BKE_nurb_handles_calc but moves selected */ + nurb_handles_calc__align_selected(nu); } } } |