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")
This commit is contained in:
parent
c03d8a17f1
commit
73d157e6f5
Notes:
blender-bot
2023-10-13 01:54:23 +02:00
Referenced by commit 3a4e8f8184
, Bugfix T41240: Home key doesn't show everything on F-Curves
Referenced by issue #41042, 90° Bezier handles mess up zoom
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue