Fix T45523: "View All" in Graph Editor does not respect Y axis with small values

The previous threshold used to prevent the Graph Editor from imploding if
presented with a flat (or nearly flat, accounting for floating point precision)
curve was too coarse, meaning that in some cases, the "View All" tool would end
up behaving weirdly.
This commit is contained in:
Joshua Leung 2016-01-23 01:56:23 +13:00
parent 56e729105a
commit 477078defa
Notes: blender-bot 2023-02-14 08:52:06 +01:00
Referenced by issue #45523, "View All" in F-Curves does not respect Y axis with small values.
1 changed files with 8 additions and 2 deletions

View File

@ -140,8 +140,14 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
/* ensure that the extents are not too extreme that view implodes...*/
if (foundBounds) {
if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.1f)) *xmax += 0.1f;
if ((ymin && ymax) && (fabsf(*ymax - *ymin) < 0.1f)) *ymax += 0.1f;
if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.001f)) {
*xmin -= 0.0005f;
*xmax += 0.0005f;
}
if ((ymin && ymax) && (fabsf(*ymax - *ymin) < 0.001f)) {
*ymax -= 0.0005f;
*ymax += 0.0005f;
}
}
else {
if (xmin) *xmin = (float)PSFRA;