[Bf-blender-cvs] [4622fc4] master: Fix T38863: FCurve auto-clamp allows handle to move past X bounds
Campbell Barton
noreply at git.blender.org
Thu Feb 27 07:24:42 CET 2014
Commit: 4622fc418ed0865d9f6bc169e3bfa25f3265a6b1
Author: Campbell Barton
Date: Thu Feb 27 17:15:49 2014 +1100
https://developer.blender.org/rB4622fc418ed0865d9f6bc169e3bfa25f3265a6b1
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.
===================================================================
M source/blender/blenkernel/intern/curve.c
===================================================================
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 03eb929..01ddbc6 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);
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list