Durian Request/Bugfixes: Graph Editor Zooming doesn't go far enough
authorJoshua Leung <aligorith@gmail.com>
Mon, 25 Jan 2010 11:06:55 +0000 (11:06 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 25 Jan 2010 11:06:55 +0000 (11:06 +0000)
Pushed limits for Graph Editor view extents to proper limits, and fixed clamping used in View2D code which was preventing height of View2D viewports from getting below 1.0

source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/view2d.c
source/blender/editors/space_graph/space_graph.c

index dcebd5d69e2b72387663831cf9e7fdacf6b9cb59..5fda492728ccff23ee25b5e190ca0cff9423219a 100644 (file)
@@ -4632,7 +4632,7 @@ static void lib_link_screen(FileData *fd, Main *main)
                                for (sl= sa->spacedata.first; sl; sl= sl->next) {
                                        if(sl->spacetype==SPACE_VIEW3D) {
                                                View3D *v3d= (View3D*) sl;
-                                               BGpic *bgpic;
+                                               BGpic *bgpic = NULL;
                                                
                                                v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera);
                                                v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
@@ -6184,7 +6184,13 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                /* init mainarea view2d */
                                ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
                                ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
-                                                               
+                               
+                               ar->v2d.min[0]= FLT_MIN;
+                               ar->v2d.min[1]= FLT_MIN;
+                               
+                               ar->v2d.max[0]= MAXFRAMEF;
+                               ar->v2d.max[1]= FLT_MAX;
+                               
                                //ar->v2d.flag |= V2D_IS_INITIALISED;
                                break;
                        }
index c5e81e237c9e4a6b5e449368c7716cc91fa648fc..a6c37f689c5a6b98ae7134fa9664dcca8bcf21c1 100644 (file)
@@ -25,6 +25,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+#include <float.h>
 #include <limits.h>
 #include <math.h>
 #include <string.h>
@@ -347,11 +348,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
        if (v2d->keepzoom & V2D_LOCKZOOM_Y)
                height= winy;
                
-       /* values used to divide, so make it safe */
-       if(width<1) width= 1;
-       if(height<1) height= 1;
-       if(winx<1) winx= 1;
-       if(winy<1) winy= 1;
+       /* values used to divide, so make it safe 
+        * NOTE: width and height must use FLT_MIN instead of 1, otherwise it is impossible to
+        *              get enough resolution in Graph Editor for editing some curves
+        */
+       if(width < FLT_MIN) width= 1;
+       if(height < FLT_MIN) height= 1;
+       if(winx < 1) winx= 1;
+       if(winy < 1) winy= 1;
        
        /* V2D_LIMITZOOM indicates that zoom level should be preserved when the window size changes */
        if (resize && (v2d->keepzoom & V2D_KEEPZOOM)) {
index 4e12b850729432c1eae588b3f7cb6186c8901548..a623c5aae3a1125e61876f0b1a54b810f525fbcd 100644 (file)
@@ -151,11 +151,11 @@ static SpaceLink *graph_new(const bContext *C)
        
        ar->v2d.cur= ar->v2d.tot;
        
-       ar->v2d.min[0]= 0.00001f;
-       ar->v2d.min[1]= 0.00001f;
-       
+       ar->v2d.min[0]= FLT_MIN;
+       ar->v2d.min[1]= FLT_MIN;
+
        ar->v2d.max[0]= MAXFRAMEF;
-       ar->v2d.max[1]= 50000.0f;
+       ar->v2d.max[1]= FLT_MAX;
        
        ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
        ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);