[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24961] trunk/blender: A few new mouse navigation config options to help transitioning users

Matt Ebb matt at mke3.net
Sat Nov 28 05:43:17 CET 2009


Revision: 24961
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24961
Author:   broken
Date:     2009-11-28 05:43:15 +0100 (Sat, 28 Nov 2009)

Log Message:
-----------
A few new mouse navigation config options to help transitioning users

* Dolly zoom Vertical/Horizontal switch
  Changes between using vertical or horizontal mouse movement for zooming

* Invert Zoom Direction
   Inverts the vertical or horizontal mouse movement for dolly zoom

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2009-11-28 04:04:01 UTC (rev 24960)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2009-11-28 04:43:15 UTC (rev 24961)
@@ -1136,6 +1136,9 @@
 
         sub.label(text="Zoom Style:")
         sub.row().prop(inputs, "viewport_zoom_style", expand=True)
+        if inputs.viewport_zoom_style == 'DOLLY':
+            sub.row().prop(inputs, "zoom_axis", expand=True)
+            sub.prop(inputs, "invert_zoom_direction")
 
         #sub.prop(inputs, "use_middle_mouse_paste")
 
@@ -1143,7 +1146,6 @@
 
         #sub = col.column()
         #sub.label(text="Mouse Wheel:")
-        #sub.prop(view, "wheel_invert_zoom", text="Invert Zoom")
         #sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
 
         col.separator()

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2009-11-28 04:04:01 UTC (rev 24960)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2009-11-28 04:43:15 UTC (rev 24961)
@@ -851,8 +851,19 @@
 		zfac = vod->dist0 * ((float)len2/len1) / vod->rv3d->dist;
 	}
 	else {	/* USER_ZOOM_DOLLY */
-		float len1 = (vod->ar->winrct.ymax - y) + 5;
-		float len2 = (vod->ar->winrct.ymax - vod->origy) + 5;
+		float len1, len2;
+		
+		if (U.uiflag & USER_ZOOM_DOLLY_HORIZ) {
+			len1 = (vod->ar->winrct.xmax - x) + 5;
+			len2 = (vod->ar->winrct.xmax - vod->origx) + 5;
+		}
+		else {
+			len1 = (vod->ar->winrct.ymax - y) + 5;
+			len2 = (vod->ar->winrct.ymax - vod->origy) + 5;
+		}
+		if (U.uiflag & USER_ZOOM_INVERT)
+			SWAP(float, len1, len2);
+		
 		zfac = vod->dist0 * (2.0*((len2/len1)-1.0) + 1.0) / vod->rv3d->dist;
 	}
 

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2009-11-28 04:04:01 UTC (rev 24960)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2009-11-28 04:43:15 UTC (rev 24961)
@@ -414,7 +414,9 @@
 #define USER_SHOW_FPS			(1 << 21)
 #define USER_MMB_PASTE			(1 << 22)
 #define USER_MENUFIXEDORDER		(1 << 23)
-#define USER_CONTINUOUS_MOUSE		(1 << 24)
+#define USER_CONTINUOUS_MOUSE	(1 << 24)
+#define USER_ZOOM_INVERT		(1 << 25)
+#define USER_ZOOM_DOLLY_HORIZ	(1 << 26)
 
 /* Auto-Keying mode */
 	/* AUTOKEY_ON is a bitflag */

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2009-11-28 04:04:01 UTC (rev 24960)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2009-11-28 04:43:15 UTC (rev 24961)
@@ -2268,26 +2268,21 @@
 		{USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport."},
 		{0, NULL, 0, NULL, NULL}};
 		
-	static EnumPropertyItem middle_mouse_mouse_items[] = {
-		{0, "PAN", 0, "Pan", "Use the middle mouse button for panning the viewport."},
-		{USER_VIEWMOVE, "ROTATE", 0, "Rotate", "Use the middle mouse button for rotation the viewport."},
-		{0, NULL, 0, NULL, NULL}};
-		
 	static EnumPropertyItem view_zoom_styles[] = {
 		{USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down."},
 		{USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zooms in and out based on vertical mouse movement."},
 		{USER_ZOOM_SCALE, "SCALE", 0, "Scale", "Zooms in and out like scaling the view, mouse movements relative to center."},
 		{0, NULL, 0, NULL, NULL}};
+	
+	static EnumPropertyItem view_zoom_axes[] = {
+		{0,						"VERTICAL", 0, "Vertical", "Zooms in and out based on vertical mouse movement."},
+		{USER_ZOOM_DOLLY_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zooms in and out based on horizontal mouse movement."},
+		{0, NULL, 0, NULL, NULL}};
 		
 	srna= RNA_def_struct(brna, "UserPreferencesInput", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_nested(brna, srna, "UserPreferences");
 	RNA_def_struct_ui_text(srna, "Input", "Settings for input devices.");
-
-	prop= RNA_def_property(srna, "middle_mouse", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
-	RNA_def_property_enum_items(prop, middle_mouse_mouse_items);
-	RNA_def_property_ui_text(prop, "Middle Mouse", "Use the middle mouse button to pan or zoom the view.");
 	
 	prop= RNA_def_property(srna, "select_mouse", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
@@ -2299,6 +2294,15 @@
 	RNA_def_property_enum_items(prop, view_zoom_styles);
 	RNA_def_property_ui_text(prop, "Viewport Zoom Style", "Which style to use for viewport scaling.");
 	
+	prop= RNA_def_property(srna, "zoom_axis", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
+	RNA_def_property_enum_items(prop, view_zoom_axes);
+	RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on.");
+	
+	prop= RNA_def_property(srna, "invert_zoom_direction", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
+	RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");
+	
 	prop= RNA_def_property(srna, "view_rotation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, view_rotation_items);
@@ -2306,7 +2310,7 @@
 	
 	prop= RNA_def_property(srna, "continuous_mouse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE);
-	RNA_def_property_ui_text(prop, "Continuous Grab", "Experimental option to allow moving the mouse outside the view");
+	RNA_def_property_ui_text(prop, "Continuous Grab", "Allow moving the mouse outside the view on some manipulations (transform, ui control drag).");
 	
 	prop= RNA_def_property(srna, "ndof_pan_speed", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ndof_pan");





More information about the Bf-blender-cvs mailing list