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:
authorTon Roosendaal <ton@blender.org>2006-11-08 18:22:58 +0300
committerTon Roosendaal <ton@blender.org>2006-11-08 18:22:58 +0300
commita65fc1e38177c05854c7a8d879d6526204f35a7b (patch)
treea3753864d620f9f5a89572233fba1c9ea795a9ff /source/blender/src/editview.c
parenta0354619c77747abe47e4f60a3b26f63f433d40a (diff)
Patch #5126 by Ben Stabler
In 3D window, ortho view, you can use SHIFT+B to zoom in to a border. I've disabled it for perspective, that doesn't work at all with this.
Diffstat (limited to 'source/blender/src/editview.c')
-rw-r--r--source/blender/src/editview.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 39aae4be851..2fa409b18f2 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -1985,8 +1985,6 @@ void set_render_border(void)
{
rcti rect;
short val;
-
- if(G.vd->persp!=2) return;
val= get_border(&rect, 3);
if(val) {
@@ -2011,6 +2009,40 @@ void set_render_border(void)
}
}
+void view3d_border_zoom(void)
+{
+ /* Zooms in on a border drawn by the user */
+ rcti rect;
+ short val;
+ float dvec[3], vb[2], xscale, yscale, scale;
+
+ /* doesn't work fine for perspective */
+ if(G.vd->persp==1)
+ return;
+
+ val = get_border(&rect, 3); //box select input
+ if(val)
+ {
+ /* find the current window width and height */
+ vb[0] = G.vd->area->winx;
+ vb[1] = G.vd->area->winy;
+
+ /* convert the drawn rectangle into 3d space */
+ initgrabz(-G.vd->ofs[0], -G.vd->ofs[1], -G.vd->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);
+
+ /* work out the ratios, so that everything selected fits when we zoom */
+ xscale = ((rect.xmax-rect.xmin)/vb[0]);
+ yscale = ((rect.ymax-rect.ymin)/vb[1]);
+ 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;
+ }
+}
void fly(void)
{