Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-04-09 15:15:23 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-04-09 15:15:23 +0400
commit525e7ac8d0b40b5f11fe9247f8be74a259f5e889 (patch)
treeb8351602d141ded6dc181225fdd79a59366c10a3 /source/blender/src/editview.c
parentad88bfae38f1ae6484eb1dfcff306fb51dc281e9 (diff)
smooth view transformations, set the smoothview value to about 250 and the view animates when you switch between side, top etc.
Diffstat (limited to 'source/blender/src/editview.c')
-rw-r--r--source/blender/src/editview.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 6dfdd3cf1c0..225854b1fff 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -2058,6 +2058,10 @@ void view3d_border_zoom(void)
short val;
float dvec[3], vb[2], xscale, yscale, scale;
+ /* SMOOTHVIEW */
+ float new_dist;
+ float new_ofs[3];
+
/* doesn't work fine for perspective */
if(G.vd->persp==1)
return;
@@ -2069,12 +2073,18 @@ void view3d_border_zoom(void)
vb[0] = G.vd->area->winx;
vb[1] = G.vd->area->winy;
+ new_dist = G.vd->dist;
+ new_ofs[0] = G.vd->ofs[0];
+ new_ofs[1] = G.vd->ofs[1];
+ new_ofs[2] = G.vd->ofs[2];
+
/* convert the drawn rectangle into 3d space */
- initgrabz(-G.vd->ofs[0], -G.vd->ofs[1], -G.vd->ofs[2]);
+ initgrabz(-new_ofs[0], -new_ofs[1], -new_ofs[2]);
+
window_to_3d(dvec, (rect.xmin+rect.xmax-vb[0])/2, (rect.ymin+rect.ymax-vb[1])/2);
/* center the view to the center of the rectangle */
- VecSubf(G.vd->ofs, G.vd->ofs, dvec);
+ VecSubf(new_ofs, new_ofs, dvec);
/* work out the ratios, so that everything selected fits when we zoom */
xscale = ((rect.xmax-rect.xmin)/vb[0]);
@@ -2082,7 +2092,10 @@ void view3d_border_zoom(void)
scale = (xscale >= yscale)?xscale:yscale;
/* zoom in as required, or as far as we can go */
- G.vd->dist = ((G.vd->dist*scale) >= 0.001*G.vd->grid)? G.vd->dist*scale:0.001*G.vd->grid;
+ new_dist = ((new_dist*scale) >= 0.001*G.vd->grid)? new_dist*scale:0.001*G.vd->grid;
+
+ smooth_view(G.vd, new_ofs, NULL, &new_dist);
+
}
}