From 3b446ed4e45fccc0e4a6fc998a28442b5429a209 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 25 Jan 2010 11:06:55 +0000 Subject: [PATCH] Durian Request/Bugfixes: Graph Editor Zooming doesn't go far enough 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 | 10 ++++++++-- source/blender/editors/interface/view2d.c | 14 +++++++++----- source/blender/editors/space_graph/space_graph.c | 8 ++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index dcebd5d69e2..5fda492728c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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; } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index c5e81e237c9..a6c37f689c5 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -25,6 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include #include #include #include @@ -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)) { diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 4e12b850729..a623c5aae3a 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -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);