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:
authorCampbell Barton <ideasman42@gmail.com>2014-02-27 10:15:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-27 10:15:49 +0400
commit4622fc418ed0865d9f6bc169e3bfa25f3265a6b1 (patch)
tree6452067af397282860d9e162d161a9cf0f1adab0 /source/blender/blenkernel
parent55fe91abf34e2f984e7be79694f542c6a5f80b63 (diff)
Fix T38863: FCurve auto-clamp allows handle to move past X bounds
F-Curves with large Y axis had strange behavior where the handles could stretch out on the X axis rather then clamping as they do at smaller sizes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/curve.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 03eb9292def..01ddbc60b50 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -3024,24 +3024,38 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
}
}
if (leftviolate || rightviolate) { /* align left handle */
- float h1[3], h2[3];
- float dot;
+ if (mode != 0) {
+ /* simple 2d calculation */
+ float h1_x = p2_h1[0] - p2[0];
+ float h2_x = p2[0] - p2_h2[0];
- sub_v3_v3v3(h1, p2_h1, p2);
- sub_v3_v3v3(h2, p2, p2_h2);
+ if (leftviolate) {
+ p2_h2[1] = p2[1] + ((p2[1] - p2_h1[1]) / h1_x) * h2_x;
+ }
+ else {
+ p2_h1[1] = p2[1] + ((p2[1] - p2_h2[1]) / h2_x) * h1_x;
+ }
+ }
+ else {
+ float h1[3], h2[3];
+ float dot;
- len_a = normalize_v3(h1);
- len_b = normalize_v3(h2);
+ sub_v3_v3v3(h1, p2_h1, p2);
+ sub_v3_v3v3(h2, p2, p2_h2);
- dot = dot_v3v3(h1, h2);
+ len_a = normalize_v3(h1);
+ len_b = normalize_v3(h2);
- if (leftviolate) {
- mul_v3_fl(h1, dot * len_b);
- sub_v3_v3v3(p2_h2, p2, h1);
- }
- else {
- mul_v3_fl(h2, dot * len_a);
- add_v3_v3v3(p2_h1, p2, h2);
+ dot = dot_v3v3(h1, h2);
+
+ if (leftviolate) {
+ mul_v3_fl(h1, dot * len_b);
+ sub_v3_v3v3(p2_h2, p2, h1);
+ }
+ else {
+ mul_v3_fl(h2, dot * len_a);
+ add_v3_v3v3(p2_h1, p2, h2);
+ }
}
}
}