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:
authorMatt Ebb <matt@mke3.net>2007-10-09 02:17:51 +0400
committerMatt Ebb <matt@mke3.net>2007-10-09 02:17:51 +0400
commit74f744010b1adbc08a5f548f26066c82189f2655 (patch)
tree5087c9ed206683895f6fe7891618e2d8a4fe554b /source/blender/src/toets.c
parentca1ea2ce65d463a417695472ac514c8cb49425b7 (diff)
* Patch #6877: Zoom to Mouse Position
by Fahrezal Effendi (exavolt) This adds an additional preference to the view and controls section, which uses the mouse's position as the centre of the zoom when zooming in the 3D View with Ctrl-MMB or the mouse wheel. It's very nice for big scenes, thanks Fahrezal! A nice todo would be to add this for 2D views as well.
Diffstat (limited to 'source/blender/src/toets.c')
-rw-r--r--source/blender/src/toets.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index 6cbc732b847..6464f699d1a 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -109,6 +109,9 @@
#include "BIF_poseobject.h"
+#define VIEW_ZOOM_OUT_FACTOR (1.15f)
+#define VIEW_ZOOM_IN_FACTOR (1.0f/VIEW_ZOOM_OUT_FACTOR)
+
/* ------------------------------------------------------------------------- */
static int is_an_active_object(void *ob) {
@@ -156,6 +159,7 @@ void persptoetsen(unsigned short event)
float phi, si, q1[4], vec[3];
static int perspo=1;
int preview3d_event= 1;
+ short mouseloc[2];
float new_dist, orig_ofs[3];
@@ -244,14 +248,20 @@ void persptoetsen(unsigned short event)
if(G.vd->persp==2) {
G.vd->camzoom= MAX2(-30, G.vd->camzoom-5);
}
- else if(G.vd->dist<10.0*G.vd->far) G.vd->dist*=1.2f;
+ else if(G.vd->dist<10.0*G.vd->far) {
+ getmouseco_areawin(mouseloc);
+ view_zoom_mouseloc(VIEW_ZOOM_OUT_FACTOR, mouseloc);
+ }
if(G.vd->persp!=1) preview3d_event= 0;
}
else if(event==PADPLUSKEY) {
if(G.vd->persp==2) {
G.vd->camzoom= MIN2(300, G.vd->camzoom+5);
}
- else if(G.vd->dist> 0.001*G.vd->grid) G.vd->dist*=.83333f;
+ else if(G.vd->dist> 0.001*G.vd->grid) {
+ getmouseco_areawin(mouseloc);
+ view_zoom_mouseloc(VIEW_ZOOM_IN_FACTOR, mouseloc);
+ }
if(G.vd->persp!=1) preview3d_event= 0;
}
else if(event==PAD5) {