[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12237] trunk/blender/source/blender: * Patch #6877: Zoom to Mouse Position
Matt Ebb
matt at mke3.net
Tue Oct 9 00:17:51 CEST 2007
Revision: 12237
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12237
Author: broken
Date: 2007-10-09 00:17:51 +0200 (Tue, 09 Oct 2007)
Log Message:
-----------
* 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.
Modified Paths:
--------------
trunk/blender/source/blender/include/BSE_view.h
trunk/blender/source/blender/makesdna/DNA_userdef_types.h
trunk/blender/source/blender/src/space.c
trunk/blender/source/blender/src/toets.c
trunk/blender/source/blender/src/view.c
Modified: trunk/blender/source/blender/include/BSE_view.h
===================================================================
--- trunk/blender/source/blender/include/BSE_view.h 2007-10-08 22:14:22 UTC (rev 12236)
+++ trunk/blender/source/blender/include/BSE_view.h 2007-10-08 22:17:51 UTC (rev 12237)
@@ -76,6 +76,7 @@
void calctrackballvecfirst(struct rcti *area, short *mval, float *vec);
void calctrackballvec(struct rcti *area, short *mval, float *vec);
void viewmove(int mode);
+void view_zoom_mouseloc(float dfac, short *mouseloc);
int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
void setwinmatrixview3d(int winx, int winy, struct rctf *rect);
Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h 2007-10-08 22:14:22 UTC (rev 12236)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h 2007-10-08 22:17:51 UTC (rev 12237)
@@ -189,23 +189,23 @@
/* ***************** USERDEF ****************** */
/* flag */
-#define USER_AUTOSAVE 1
-#define USER_AUTOGRABGRID 2
-#define USER_AUTOROTGRID 4
-#define USER_AUTOSIZEGRID 8
-#define USER_SCENEGLOBAL 16
-#define USER_TRACKBALL 32
-#define USER_DUPLILINK 64
-#define USER_FSCOLLUM 128
-#define USER_MAT_ON_OB 256
-#define USER_NO_CAPSLOCK 512
-#define USER_VIEWMOVE 1024
-#define USER_TOOLTIPS 2048
-#define USER_TWOBUTTONMOUSE 4096
-#define USER_NONUMPAD 8192
-#define USER_LMOUSESELECT 16384
-#define USER_FILECOMPRESS 32768
-#define USER_SAVE_PREVIEWS 65536
+#define USER_AUTOSAVE (1 << 0)
+#define USER_AUTOGRABGRID (1 << 1)
+#define USER_AUTOROTGRID (1 << 2)
+#define USER_AUTOSIZEGRID (1 << 3)
+#define USER_SCENEGLOBAL (1 << 4)
+#define USER_TRACKBALL (1 << 5)
+#define USER_DUPLILINK (1 << 6)
+#define USER_FSCOLLUM (1 << 7)
+#define USER_MAT_ON_OB (1 << 8)
+#define USER_NO_CAPSLOCK (1 << 9)
+#define USER_VIEWMOVE (1 << 10)
+#define USER_TOOLTIPS (1 << 11)
+#define USER_TWOBUTTONMOUSE (1 << 12)
+#define USER_NONUMPAD (1 << 13)
+#define USER_LMOUSESELECT (1 << 14)
+#define USER_FILECOMPRESS (1 << 15)
+#define USER_SAVE_PREVIEWS (1 << 16)
/* viewzom */
#define USER_ZOOM_CONT 0
@@ -214,51 +214,52 @@
/* uiflag */
-#define USER_KEYINSERTACT 1
-#define USER_KEYINSERTOBJ 2
-#define USER_WHEELZOOMDIR 4
-#define USER_FILTERFILEEXTS 8
-#define USER_DRAWVIEWINFO 16
-#define USER_PLAINMENUS 32 // old EVTTOCONSOLE print ghost events, here for tuhopuu compat. --phase
+#define USER_KEYINSERTACT (1 << 0)
+#define USER_KEYINSERTOBJ (1 << 1)
+#define USER_WHEELZOOMDIR (1 << 2)
+#define USER_FILTERFILEEXTS (1 << 3)
+#define USER_DRAWVIEWINFO (1 << 4)
+#define USER_PLAINMENUS (1 << 5) // old EVTTOCONSOLE print ghost events, here for tuhopuu compat. --phase
// old flag for hide pulldown was here
-#define USER_FLIPFULLSCREEN 128
-#define USER_ALLWINCODECS 256
-#define USER_MENUOPENAUTO 512
-#define USER_PANELPINNED 1024
-#define USER_AUTOPERSP 2048
-#define USER_LOCKAROUND 4096
-#define USER_GLOBALUNDO 8192
-#define USER_ORBIT_SELECTION 16384
-#define USER_KEYINSERTAVAI 32768
-#define USER_HIDE_DOT 65536
-#define USER_SHOW_ROTVIEWICON 131072
-#define USER_SHOW_VIEWPORTNAME 262144
-#define USER_KEYINSERTNEED 524288
+#define USER_FLIPFULLSCREEN (1 << 7)
+#define USER_ALLWINCODECS (1 << 8)
+#define USER_MENUOPENAUTO (1 << 9)
+#define USER_PANELPINNED (1 << 10)
+#define USER_AUTOPERSP (1 << 11)
+#define USER_LOCKAROUND (1 << 12)
+#define USER_GLOBALUNDO (1 << 13)
+#define USER_ORBIT_SELECTION (1 << 14)
+#define USER_KEYINSERTAVAI (1 << 15)
+#define USER_HIDE_DOT (1 << 16)
+#define USER_SHOW_ROTVIEWICON (1 << 17)
+#define USER_SHOW_VIEWPORTNAME (1 << 18)
+#define USER_KEYINSERTNEED (1 << 19)
+#define USER_ZOOM_TO_MOUSEPOS (1 << 20)
/* transopts */
-#define USER_TR_TOOLTIPS 1
-#define USER_TR_BUTTONS 2
-#define USER_TR_MENUS 4
-#define USER_TR_FILESELECT 8
-#define USER_TR_TEXTEDIT 16
-#define USER_DOTRANSLATE 32
-#define USER_USETEXTUREFONT 64
-#define CONVERT_TO_UTF8 128
+#define USER_TR_TOOLTIPS (1 << 0)
+#define USER_TR_BUTTONS (1 << 1)
+#define USER_TR_MENUS (1 << 2)
+#define USER_TR_FILESELECT (1 << 3)
+#define USER_TR_TEXTEDIT (1 << 4)
+#define USER_DOTRANSLATE (1 << 5)
+#define USER_USETEXTUREFONT (1 << 6)
+#define CONVERT_TO_UTF8 (1 << 7)
/* dupflag */
-#define USER_DUP_MESH 1
-#define USER_DUP_CURVE 2
-#define USER_DUP_SURF 4
-#define USER_DUP_FONT 8
-#define USER_DUP_MBALL 16
-#define USER_DUP_LAMP 32
-#define USER_DUP_IPO 64
-#define USER_DUP_MAT 128
-#define USER_DUP_TEX 256
-#define USER_DUP_ARM 512
-#define USER_DUP_ACT 1024
+#define USER_DUP_MESH (1 << 0)
+#define USER_DUP_CURVE (1 << 1)
+#define USER_DUP_SURF (1 << 2)
+#define USER_DUP_FONT (1 << 3)
+#define USER_DUP_MBALL (1 << 4)
+#define USER_DUP_LAMP (1 << 5)
+#define USER_DUP_IPO (1 << 6)
+#define USER_DUP_MAT (1 << 7)
+#define USER_DUP_TEX (1 << 8)
+#define USER_DUP_ARM (1 << 9)
+#define USER_DUP_ACT (1 << 10)
/* gameflags */
Modified: trunk/blender/source/blender/src/space.c
===================================================================
--- trunk/blender/source/blender/src/space.c 2007-10-08 22:14:22 UTC (rev 12236)
+++ trunk/blender/source/blender/src/space.c 2007-10-08 22:17:51 UTC (rev 12237)
@@ -3390,56 +3390,35 @@
uiBlockSetCol(block, TH_AUTO); /* end color */
uiBlockEndAlign(block);
+ uiDefButBitI(block, TOG, USER_ZOOM_TO_MOUSEPOS, B_DRAWINFO, "Zoom to Mouse Position",
+ (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y4,mpref,buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center");
+
uiDefBut(block, LABEL,0,"View rotation:",
- (xpos+(2*edgsp)+mpref+(2*spref)+(2*midsp)),y4label,mpref,buth,
+ (xpos+(2*edgsp)+mpref+(2*spref)+(2*midsp)),y3label,mpref,buth,
0, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1); /* mutually exclusive toggles, start color */
uiDefButBitI(block, TOG, USER_TRACKBALL, B_DRAWINFO, "Trackball",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y3,(mpref/2),buth,
+ (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y2,(mpref/2),buth,
&(U.flag), 0, 0, 0, 0,
"Allow the view to tumble freely when orbiting with the Middle Mouse Button");
uiDefButBitI(block, TOGN, USER_TRACKBALL, B_DRAWINFO, "Turntable",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y3,(mpref/2),buth,
+ (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y2,(mpref/2),buth,
&(U.flag), 0, 0, 0, 0,
"Use fixed up axis for orbiting with Middle Mouse Button");
uiBlockSetCol(block, TH_AUTO); /* end color */
uiDefButBitI(block, TOG, USER_AUTOPERSP, B_DRAWINFO, "Auto Perspective",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y2,(mpref/2),buth,
+ (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y1,(mpref/2),buth,
&(U.uiflag), 0, 0, 0, 0,
"Automatically switch between orthographic and perspective when changing from top/front/side views");
uiDefButBitI(block, TOG, USER_ORBIT_SELECTION, B_DRAWINFO, "Around Selection",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y2,(mpref/2),buth,
+ (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y1,(mpref/2),buth,
&(U.uiflag), 0, 0, 0, 0,
"Use selection as the orbiting center");
uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_SHOW_ROTVIEWICON, B_DRAWINFO, "Mini Axis",
- (xpos+edgsp+(2*mpref)+(2*midsp)),y1,(mpref/3),buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Show a small rotating 3D axis in the bottom left corner of the 3D View");
- uiDefButS(block, NUM, B_DRAWINFO, "Size:",
- (xpos+edgsp+(2*mpref)+(2*midsp)+(mpref/3)),y1,(mpref/3),buth,
- &U.rvisize, 10, 64, 0, 0,
- "The axis icon's size");
- uiDefButS(block, NUM, B_DRAWINFO, "Bright:",
- (xpos+edgsp+(2*mpref)+(2*midsp)+2*(mpref/3)),y1,(mpref/3),buth,
- &U.rvibright, 0, 10, 0, 0,
- "The brightness of the icon");
- uiBlockEndAlign(block);
-
- uiDefButS(block, NUM, B_DRAWINFO, "Rotation Angle:",
- (xpos+edgsp+(3*mpref)+(4*midsp)),y1,(mpref),buth,
- &U.pad_rot_angle, 0, 90, 0, 0,
- "The rotation step for numerical pad keys (2 4 6 8)");
-
- uiDefButS(block, NUM, B_DRAWINFO, "Smooth View:",
- (xpos+edgsp+(4*mpref)+(5*midsp)),y1,(mpref),buth,
- &U.smooth_viewtx, 0, 1000, 0, 0,
- "The time to animate the view in miliseconds, zero to disable");
-
uiDefBut(block, LABEL,0,"Select with:",
(xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y6label,mpref,buth,
0, 0, 0, 0, 0, "");
@@ -3474,7 +3453,21 @@
&(U.flag), 0, 0, 0, 0,
"Emulates Middle Mouse with Alt+LeftMouse (doesnt work with Left Mouse Select option)");
-
+ uiBlockBeginAlign(block);
+ uiDefButBitI(block, TOG, USER_SHOW_ROTVIEWICON, B_DRAWINFO, "Mini Axis",
+ (xpos+edgsp+(3*mpref)+(4*midsp)),y1,(mpref/3),buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Show a small rotating 3D axis in the bottom left corner of the 3D View");
+ uiDefButS(block, NUM, B_DRAWINFO, "Size:",
+ (xpos+edgsp+(3*mpref)+(4*midsp)+(mpref/3)),y1,(mpref/3),buth,
+ &U.rvisize, 10, 64, 0, 0,
+ "The axis icon's size");
+ uiDefButS(block, NUM, B_DRAWINFO, "Bright:",
+ (xpos+edgsp+(3*mpref)+(4*midsp)+2*(mpref/3)),y1,(mpref/3),buth,
+ &U.rvibright, 0, 10, 0, 0,
+ "The brightness of the icon");
+ uiBlockEndAlign(block);
+
uiDefBut(block, LABEL,0,"Middle Mouse Button:",
(xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y6label,mpref,buth,
0, 0, 0, 0, 0, "");
@@ -3488,6 +3481,7 @@
&(U.flag), 0, 0, 0, 0, "Default action for the Middle Mouse Button");
uiBlockSetCol(block, TH_AUTO); /* end color */
uiBlockEndAlign(block);
+
uiDefBut(block, LABEL,0,"Mouse Wheel:",
(xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y4label,mpref,buth,
@@ -3502,6 +3496,17 @@
&U.wheellinescroll, 0.0, 32.0, 0, 0,
"The number of lines scrolled at a time with the mouse wheel");
uiBlockEndAlign(block);
+
+ uiBlockBeginAlign(block);
+ uiDefButS(block, NUM, B_DRAWINFO, "Smooth View:",
+ (xpos+edgsp+(4*mpref)+(5*midsp)),y2,(mpref),buth,
+ &U.smooth_viewtx, 0, 1000, 0, 0,
+ "The time to animate the view in miliseconds, zero to disable");
+ uiDefButS(block, NUM, B_DRAWINFO, "Rotation Angle:",
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list