[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41831] trunk/blender: Apply patch [#28632 ] Add individual invert to 3d mouse in turntable mode and when zooming

Nathan Letwory nathan at letworyinteractive.com
Mon Nov 14 15:02:20 CET 2011


Revision: 41831
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41831
Author:   jesterking
Date:     2011-11-14 14:02:19 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
Apply patch [#28632] Add individual invert to 3d mouse in turntable mode and when zooming
Submitted by Rainer Wahler

This patch adds the individual invert options for the turntable mode too. In turntable mode there are only the rotate and roll and no tilt axis to invert.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_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/startup/bl_ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2011-11-14 12:55:46 UTC (rev 41830)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2011-11-14 14:02:19 UTC (rev 41831)
@@ -765,10 +765,9 @@
             layout.label(text="Orbit options")
             if input_prefs.view_rotate_method == 'TRACKBALL':
                 layout.prop(input_prefs, "ndof_roll_invert_axis")
-                layout.prop(input_prefs, "ndof_tilt_invert_axis")
-                layout.prop(input_prefs, "ndof_rotate_invert_axis")
-            else:
-                layout.prop(input_prefs, "ndof_orbit_invert_axes")
+            layout.prop(input_prefs, "ndof_tilt_invert_axis")
+            layout.prop(input_prefs, "ndof_rotate_invert_axis")
+            layout.prop(input_prefs, "ndof_zoom_invert")
 
             layout.separator()
             layout.label(text="Pan options")
@@ -776,6 +775,9 @@
             layout.prop(input_prefs, "ndof_pany_invert_axis")
             layout.prop(input_prefs, "ndof_panz_invert_axis")
 
+            layout.label(text="Zoom options")
+            layout.prop(input_prefs, "ndof_zoom_updown")
+
             layout.separator()
             layout.label(text="Fly options")
             layout.prop(input_prefs, "ndof_fly_helicopter", icon='NDOF_FLY')

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2011-11-14 12:55:46 UTC (rev 41830)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2011-11-14 14:02:19 UTC (rev 41831)
@@ -1031,21 +1031,17 @@
 				rv3d->view = RV3D_VIEW_USER;
 		
 				if (U.flag & USER_TRACKBALL) {
-					const int invert_roll = U.ndof_flag & NDOF_ROLL_INVERT_AXIS;
-					const int invert_tilt = U.ndof_flag & NDOF_TILT_INVERT_AXIS;
-					const int invert_rot = U.ndof_flag & NDOF_ROTATE_INVERT_AXIS;
-
 					float rot[4];
 					float axis[3];
 					float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
 
-					if (invert_roll)
+					if (U.ndof_flag & NDOF_ROLL_INVERT_AXIS)
 						axis[2] = -axis[2];
 
-					if (invert_tilt)
+					if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
 						axis[0] = -axis[0];
 
-					if (invert_rot)
+					if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
 						axis[1] = -axis[1];
 
 					// transform rotation axis from view to world coordinates
@@ -1061,8 +1057,6 @@
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
 				} else {
 					/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
-					const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES;
-
 					float angle, rot[4];
 					float xvec[3] = {1,0,0};
 		
@@ -1071,7 +1065,7 @@
 		
 					/* Perform the up/down rotation */
 					angle = rot_sensitivity * dt * ndof->rvec[0];
-					if (invert)
+					if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
 						angle = -angle;
 					rot[0] = cos(angle);
 					mul_v3_v3fl(rot+1, xvec, sin(angle));
@@ -1079,7 +1073,7 @@
 		
 					/* Perform the orbital rotation */
 					angle = rot_sensitivity * dt * ndof->rvec[1];
-					if (invert)
+					if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
 						angle = -angle;
 		
 					// update the onscreen doo-dad
@@ -1164,23 +1158,19 @@
 			const float vertical_sensitivity = 0.4f;
 			const float lateral_sensitivity = 0.6f;
 
-			const int invert_panx = U.ndof_flag & NDOF_PANX_INVERT_AXIS;
-			const int invert_pany = U.ndof_flag & NDOF_PANY_INVERT_AXIS;
-			const int invert_panz = U.ndof_flag & NDOF_PANZ_INVERT_AXIS;
-
 			float pan_vec[3];
 
-			if (invert_panx)
+			if (U.ndof_flag & NDOF_PANX_INVERT_AXIS)
 				pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
 			else
 				pan_vec[0] = lateral_sensitivity * ndof->tvec[0];
 
-			if (invert_panz)
+			if (U.ndof_flag & NDOF_PANZ_INVERT_AXIS)
 				pan_vec[1] = -vertical_sensitivity * ndof->tvec[1];
 			else
 				pan_vec[1] = vertical_sensitivity * ndof->tvec[1];
 
-			if (invert_pany)
+			if (U.ndof_flag & NDOF_PANY_INVERT_AXIS)
 				pan_vec[2] = -forward_sensitivity * ndof->tvec[2];
 			else
 				pan_vec[2] = forward_sensitivity * ndof->tvec[2];

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2011-11-14 12:55:46 UTC (rev 41830)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2011-11-14 14:02:19 UTC (rev 41831)
@@ -605,7 +605,6 @@
 */
 /* actually... users probably don't care about what the mode
    is called, just that it feels right */
-#define NDOF_ORBIT_INVERT_AXES (1 << 6)
 /* zoom is up/down if this flag is set (otherwise forward/backward) */
 #define NDOF_ZOOM_UPDOWN (1 << 7)
 #define NDOF_ZOOM_INVERT (1 << 8)

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2011-11-14 12:55:46 UTC (rev 41830)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2011-11-14 14:02:19 UTC (rev 41831)
@@ -2954,12 +2954,6 @@
 	RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation");
 	/* TODO: update description when fly-mode visuals are in place  ("projected position in fly mode")*/
 
-	/* 3D view: orbit */
-	prop= RNA_def_property(srna, "ndof_orbit_invert_axes", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ORBIT_INVERT_AXES);
-	RNA_def_property_ui_text(prop, "Invert Axes", "Toggle between moving the viewpoint or moving the scene being viewed");
-	/* in 3Dx docs, this is called 'object mode' vs. 'target camera mode' */
-
 	/* 3D view: roll */
 	prop= RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROLL_INVERT_AXIS);




More information about the Bf-blender-cvs mailing list