Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2014-04-28 09:15:23 +0400
committerJoshua Leung <aligorith@gmail.com>2014-04-28 09:15:23 +0400
commit0985bb483df8ce7bb887fa636853245dd598a877 (patch)
treef9b5d8bef7f6288591a4a6a32f9a821776fabc80 /source/blender/blenkernel/intern/curve.c
parent4a1b87790d456453fa5a25f08588dd6d9e8e47f9 (diff)
Fix T38594: Incorrect behaviour when editing aligned handles in curve editor
With the right handle selected, the movement of the left handle appears constrained to the frame it is currently on, leading to unpredictable and wild overshoots of the bezier curve. There appears to be little benefit in doing so. The effect of this patch is that makes it so that instead of trying (initially) to maintain the same distance between the two handles and then overshooting randomly later, the handles now try to keep the same distance from each other (i.e. similar doing a rotation around the keyframe) at all times. While this means that it isn't possible to set up assymetric handles (i.e. where ease in to the key is less than the ease out for example) using aligned handles (it's still possible using free; it's just a lot more work to keep them aligned), the benefits of removing of the random blips and jumps when things jump outweight the losses. Patch by Brecht
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index f0f9a95a1c5..18c10c8a28a 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -2912,6 +2912,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;
const float eps = 1e-5;
if (bezt->h1 == 0 && bezt->h2 == 0) {
@@ -2956,6 +2957,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;
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */
float tvec[3];
@@ -3092,15 +3094,11 @@ 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 (len_a == 0.0f)
- len_a = 1.0f;
- if (len_b == 0.0f)
- len_b = 1.0f;
if (bezt->f1 & SELECT) { /* order of calculation */
if (ELEM(bezt->h2, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) { /* aligned */
if (len_a > eps) {
- len = len_b / len_a;
+ len = 1.0f / orig_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]);
@@ -3108,7 +3106,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 = len_a / len_b;
+ len = orig_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]);
@@ -3118,7 +3116,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 = len_a / len_b;
+ len = 1.0f / orig_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]);
@@ -3126,7 +3124,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 = len_b / len_a;
+ len = orig_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]);