Fix T45523: "View All" in Graph Editor does not respect Y axis with small values
authorJoshua Leung <aligorith@gmail.com>
Fri, 22 Jan 2016 12:56:23 +0000 (01:56 +1300)
committerJoshua Leung <aligorith@gmail.com>
Fri, 22 Jan 2016 12:56:45 +0000 (01:56 +1300)
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.

source/blender/editors/space_graph/graph_edit.c

index 6042100a984de6c326500683c11d625f86b37bd9..bf66b3087fd61bb350765a7e9ddc0ee2808cb4f1 100644 (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;