Page Menu
Home
Search
Configure Global Search
Log In
Files
F3163
zoomtocursor.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Ben Stabler (lightning)
Nov 13 2013, 1:08 PM
Size
4 KB
Subscribers
None
zoomtocursor.patch
View Options
Index: source/blender/include/BSE_view.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BSE_view.h,v
retrieving revision 1.14
diff -u -r1.14 BSE_view.h
--- source/blender/include/BSE_view.h 28 Jan 2006 18:33:13 -0000 1.14
+++ source/blender/include/BSE_view.h 24 Oct 2006 22:37:54 -0000
@@ -55,6 +55,7 @@
void initgrabz(float x, float y, float z);
void window_to_3d(float *vec, short mx, short my);
+void window_to_3d_f(float *vec, float mx, float my);
void project_short(float *vec, short *adr);
void project_short_noclip(float *vec, short *adr);
void project_int(float *vec, int *adr);
Index: source/blender/makesdna/DNA_userdef_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_userdef_types.h,v
retrieving revision 1.58
diff -u -r1.58 DNA_userdef_types.h
--- source/blender/makesdna/DNA_userdef_types.h 19 Oct 2006 05:06:41 -0000 1.58
+++ source/blender/makesdna/DNA_userdef_types.h 24 Oct 2006 14:32:14 -0000
@@ -225,6 +225,7 @@
#define USER_HIDE_DOT 65536
#define USER_SHOW_ROTVIEWICON 131072
#define USER_SHOW_VIEWPORTNAME 262144
+#define USER_ZOOM_TOCURSOR 524288
/* transopts */
Index: source/blender/src/editview.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editview.c,v
retrieving revision 1.112
diff -u -r1.112 editview.c
--- source/blender/src/editview.c 12 Oct 2006 09:32:47 -0000 1.112
+++ source/blender/src/editview.c 25 Oct 2006 00:43:08 -0000
@@ -2002,6 +2002,26 @@
}
}
+void relative_zoom(unsigned short event)
+{
+ short mval[2];
+ float scaleFactor, dvec[3];
+
+ if(event==PADPLUSKEY)
+ scaleFactor=.83333f;
+ else if(event==PADMINUS)
+ scaleFactor=1.2f;
+
+ getmouseco_areawin(mval);
+
+ initgrabz(G.vd->ofs[0], G.vd->ofs[1], G.vd->ofs[2]);
+
+ window_to_3d_f(dvec, (mval[0]-((G.vd->area->winx-1)/2))*(scaleFactor-1), (mval[1]-((G.vd->area->winy-1)/2))*(scaleFactor-1));
+
+ G.vd->dist*=scaleFactor;
+
+ VecAddf(G.vd->ofs, G.vd->ofs, dvec);
+}
void fly(void)
{
@@ -2813,6 +2810,10 @@
"The number of lines scrolled at a time with the mouse wheel");
uiBlockEndAlign(block);
+ uiDefButBitI(block, TOG, USER_ZOOM_TOCURSOR, 0, "Zoom to cursor",
+ (xpos+edgsp+(4*mpref)+(5*midsp)),y1,mpref,buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Zoom relative to the mouse cursor position");
uiDefBut(block, LABEL,0,"3D Transform Widget:",
(xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y6label,mpref,buth,
Index: source/blender/src/toets.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/toets.c,v
retrieving revision 1.84
diff -u -r1.84 toets.c
--- source/blender/src/toets.c 28 Sep 2006 01:55:44 -0000 1.84
+++ source/blender/src/toets.c 24 Oct 2006 23:07:59 -0000
@@ -241,14 +241,26 @@
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)
+ {
+ if(U.uiflag & USER_ZOOM_TOCURSOR)
+ relative_zoom(event);
+ else
+ G.vd->dist*=1.2f;
+ }
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)
+ {
+ if(U.uiflag & USER_ZOOM_TOCURSOR)
+ relative_zoom(event);
+ else
+ G.vd->dist*=.83333f;
+ }
if(G.vd->persp!=1) preview3d_event= 0;
}
else if(event==PAD5) {
Index: source/blender/src/view.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/view.c,v
retrieving revision 1.70
diff -u -r1.70 view.c
--- source/blender/src/view.c 15 Aug 2006 11:33:00 -0000 1.70
+++ source/blender/src/view.c 24 Oct 2006 22:38:10 -0000
@@ -151,6 +151,11 @@
void window_to_3d(float *vec, short mx, short my)
{
+ window_to_3d_f(vec, mx, my);
+}
+
+void window_to_3d_f(float *vec, float mx, float my)
+{
/* always call initgrabz */
float dx, dy;
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7b/c2/01a1706988529056244a91b89edf
Event Timeline
Log In to Comment