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-07-20 11:22:22 +0400
committerJoshua Leung <aligorith@gmail.com>2014-07-20 11:22:22 +0400
commit73d157e6f5c4d75cd774ec863da821d13649c09b (patch)
tree61dada34d15b3d695875e27766a3e6ec7d8d471b /source/blender/blenkernel/intern/fcurve.c
parentc03d8a17f11ae75cf207053231bb59325630606a (diff)
Bugfix T41042: Irrelevant Bezier handles still affect Graph Editor Show All
The "Show All" and "Show Selected" operators in the Graph Editor was taking into account all handles on keyframes, even when some of those would be invalid and/or set to nonsense values (e.g. for any interpolation mode other than "Bezier")
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index daf872ef4cc..5ad8a1c8d74 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -522,17 +522,28 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
/* only loop over keyframes to find extents for values if needed */
if (ymin || ymax) {
- BezTriple *bezt;
+ BezTriple *bezt, *prevbezt = NULL;
- for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
- if ((do_sel_only == false) || BEZSELECTED(bezt)) {
+ for (bezt = fcu->bezt, i = 0; i < fcu->totvert; prevbezt = bezt, bezt++, i++) {
+ if ((do_sel_only == false) || BEZSELECTED(bezt)) {
+ /* keyframe itself */
+ yminv = min_ff(yminv, bezt->vec[1][1]);
+ ymaxv = max_ff(ymaxv, bezt->vec[1][1]);
+
if (include_handles) {
- yminv = min_ffff(yminv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
- ymaxv = max_ffff(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
- }
- else {
- yminv = min_ff(yminv, bezt->vec[1][1]);
- ymaxv = max_ff(ymaxv, bezt->vec[1][1]);
+ /* left handle - only if applicable
+ * NOTE: for the very first keyframe, the left handle actually has no bearings on anything
+ */
+ if (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ)) {
+ yminv = min_ff(yminv, bezt->vec[0][1]);
+ ymaxv = max_ff(ymaxv, bezt->vec[0][1]);
+ }
+
+ /* right handle - only if applicable */
+ if (bezt->ipo == BEZT_IPO_BEZ) {
+ yminv = min_ff(yminv, bezt->vec[2][1]);
+ ymaxv = min_ff(ymaxv, bezt->vec[2][1]);
+ }
}
foundvert = true;