diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-03 23:58:02 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-03 23:58:02 +0400 |
commit | ea6671a6309b6d9363758a945f681c1adb2a4c6b (patch) | |
tree | 11664d7c35787d256520be3dbe84e802fe532f38 | |
parent | 1618329b005beca2dfbe413a4eef661a83ad15a1 (diff) |
Fix for aligned handles in masking and curve objects
The issue has been introduced in 0985bb4, made it so curves and masks
stick to old behavior.
FCurves are still flaky, namely, grabbing both handles selected would
change the length of one of the handles which is not nice imo.
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index d73426292e9..14fd44e594a 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2899,7 +2899,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n float *p1, *p2, *p3, pt[3]; float dvec_a[3], dvec_b[3]; float len, len_a, len_b; - float orig_len_ratio; + float len_ratio; const float eps = 1e-5; if (bezt->h1 == 0 && bezt->h2 == 0) { @@ -2944,7 +2944,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n if (len_a == 0.0f) len_a = 1.0f; if (len_b == 0.0f) len_b = 1.0f; - orig_len_ratio = len_a / len_b; + len_ratio = len_a / len_b; if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */ float tvec[3]; @@ -3081,11 +3081,18 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n len_a = len_v3v3(p2, p2_h1); len_b = len_v3v3(p2, p2_h2); + if (is_fcurve == false) { + if (len_a == 0.0f) + len_a = 1.0f; + if (len_b == 0.0f) + len_b = 1.0f; + len_ratio = len_a / len_b; + } if (bezt->f1 & SELECT) { /* order of calculation */ if (ELEM(bezt->h2, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { /* aligned */ if (len_a > eps) { - len = 1.0f / orig_len_ratio; + len = 1.0f / len_ratio; p2_h2[0] = p2[0] + len * (p2[0] - p2_h1[0]); p2_h2[1] = p2[1] + len * (p2[1] - p2_h1[1]); p2_h2[2] = p2[2] + len * (p2[2] - p2_h1[2]); @@ -3093,7 +3100,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n } if (ELEM(bezt->h1, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { if (len_b > eps) { - len = orig_len_ratio; + len = len_ratio; p2_h1[0] = p2[0] + len * (p2[0] - p2_h2[0]); p2_h1[1] = p2[1] + len * (p2[1] - p2_h2[1]); p2_h1[2] = p2[2] + len * (p2[2] - p2_h2[2]); @@ -3103,7 +3110,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n else { if (ELEM(bezt->h1, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { if (len_b > eps) { - len = orig_len_ratio; + len = len_ratio; p2_h1[0] = p2[0] + len * (p2[0] - p2_h2[0]); p2_h1[1] = p2[1] + len * (p2[1] - p2_h2[1]); p2_h1[2] = p2[2] + len * (p2[2] - p2_h2[2]); @@ -3111,7 +3118,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n } if (ELEM(bezt->h2, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { /* aligned */ if (len_a > eps) { - len = 1.0f / orig_len_ratio; + len = 1.0f / len_ratio; p2_h2[0] = p2[0] + len * (p2[0] - p2_h1[0]); p2_h2[1] = p2[1] + len * (p2[1] - p2_h1[1]); p2_h2[2] = p2[2] + len * (p2[2] - p2_h1[2]); |