[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38591] branches/merwin-spacenav/source/ blender: tweaked ephemeral ndof data types

Mike Erwin significant.bit at gmail.com
Thu Jul 21 23:40:04 CEST 2011


Revision: 38591
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38591
Author:   merwin
Date:     2011-07-21 21:40:04 +0000 (Thu, 21 Jul 2011)
Log Message:
-----------
tweaked ephemeral ndof data types

Modified Paths:
--------------
    branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_fly.c
    branches/merwin-spacenav/source/blender/makesdna/DNA_userdef_types.h
    branches/merwin-spacenav/source/blender/makesdna/DNA_view3d_types.h
    branches/merwin-spacenav/source/blender/makesrna/intern/rna_userdef.c

Modified: branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_fly.c
===================================================================
--- branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_fly.c	2011-07-21 21:40:00 UTC (rev 38590)
+++ branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_fly.c	2011-07-21 21:40:04 UTC (rev 38591)
@@ -929,9 +929,16 @@
 	wmNDOFMotionData* ndof = fly->ndof;
 	const float dt = ndof->dt;
 	RegionView3D* rv3d = fly->rv3d;
+	const int flag = U.ndof_flag;
 
-	const int shouldRotate = 1, shouldTranslate = 1;
+	const int shouldRotate = TRUE,
+	          shouldTranslate = TRUE;
 
+	// const int shouldRotate = flag & NDOF_SHOULD_ROTATE,
+	//          shouldTranslate = flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM);
+	// might also be something in FlyInfo that restricts motion
+	// if so, change these ^^
+
 	float view_inv[4];
 	invert_qt_qt(view_inv, rv3d->viewquat);
 
@@ -955,7 +962,7 @@
 		// transform motion from view to world coordinates
 		mul_qt_v3(view_inv, trans);
 
-		if (U.ndof_flag & NDOF_FLY_HELICOPTER)
+		if (flag & NDOF_FLY_HELICOPTER)
 			// could also use RNA to get a simple boolean value
 			{
 			// replace world z component with device y (yes it makes sense)
@@ -981,9 +988,9 @@
 
 		// apply rotation to view
 		axis_angle_to_quat(rotation, axis, angle);
-		mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation);		
+		mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation);
 
-		if (U.ndof_flag & NDOF_LOCK_HORIZON)
+		if (flag & NDOF_LOCK_HORIZON)
 			// force an upright viewpoint
 			// TODO: make this less... sudden
 			{
@@ -992,6 +999,7 @@
 
 			// find new inverse since viewquat has changed
 			invert_qt_qt(view_inv, rv3d->viewquat);
+			// could apply reverse rotation to existing view_inv to save a few cycles
 
 			// transform view vectors to world coordinates
 			mul_qt_v3(view_inv, view_horizon);
@@ -1007,7 +1015,7 @@
 
 			// rotate view so view horizon = world horizon
 			axis_angle_to_quat(rotation, view_direction, angle);
-			mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation);		
+			mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation);
 			}
 
 		rv3d->view = RV3D_VIEW_USER;

Modified: branches/merwin-spacenav/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- branches/merwin-spacenav/source/blender/makesdna/DNA_userdef_types.h	2011-07-21 21:40:00 UTC (rev 38590)
+++ branches/merwin-spacenav/source/blender/makesdna/DNA_userdef_types.h	2011-07-21 21:40:04 UTC (rev 38591)
@@ -365,7 +365,6 @@
 	short recent_files;		/* maximum number of recently used files to remember  */
 	short smooth_viewtx;	/* miliseconds to spend spinning the view */
 	short glreslimit;
-/*	short ndof_pan, ndof_rotate; */
 	short curssize;
 	short color_picker_type;
 	short ipo_new;			/* interpolation mode for newly added F-Curves */
@@ -586,12 +585,12 @@
 #define NDOF_FLY_HELICOPTER (1 << 1)
 #define NDOF_LOCK_HORIZON   (1 << 2)
 /* the following might not need to be saved between sessions,
-   but they do need to live somewhere accessible...
+   but they do need to live somewhere accessible... */
 #define NDOF_SHOULD_PAN     (1 << 3)
 #define NDOF_SHOULD_ZOOM    (1 << 4)
 #define NDOF_SHOULD_ROTATE  (1 << 5)
-*/
 
+
 #ifdef __cplusplus
 }
 #endif

Modified: branches/merwin-spacenav/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- branches/merwin-spacenav/source/blender/makesdna/DNA_view3d_types.h	2011-07-21 21:40:00 UTC (rev 38590)
+++ branches/merwin-spacenav/source/blender/makesdna/DNA_view3d_types.h	2011-07-21 21:40:04 UTC (rev 38591)
@@ -190,11 +190,10 @@
 	/* drawflags, denoting state */
 	short zbuf, transp, xray;
 
-	char ndofmode;			/* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */
-	char ndoffilter;		/* filter for 6DOF devices 0 normal, 1 dominant */
-	
+	char pad3[2];
+
 	void *properties_storage;	/* Nkey panel stores stuff here (runtime only!) */
-	
+
 	/* XXX depricated? */
 	struct bGPdata *gpd;		/* Grease-Pencil Data (annotation layers) */
 

Modified: branches/merwin-spacenav/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- branches/merwin-spacenav/source/blender/makesrna/intern/rna_userdef.c	2011-07-21 21:40:00 UTC (rev 38590)
+++ branches/merwin-spacenav/source/blender/makesrna/intern/rna_userdef.c	2011-07-21 21:40:04 UTC (rev 38591)
@@ -2739,24 +2739,14 @@
 	RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens");
 
   	/* 3D mouse settings */
-/*	
-	prop= RNA_def_property(srna, "ndof_pan_speed", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "ndof_pan");
-	RNA_def_property_range(prop, 0, 200);
-	RNA_def_property_ui_text(prop, "NDof Pan Speed", "The overall panning speed of an NDOF device, as percent of standard");
-
-	prop= RNA_def_property(srna, "ndof_rotate_speed", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "ndof_rotate");
-	RNA_def_property_range(prop, 0, 200);
-	RNA_def_property_ui_text(prop, "NDof Rotation Speed", "The overall rotation speed of an NDOF device, as percent of standard");
-*/
 	prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.25f, 4.0f);
-	RNA_def_property_ui_text(prop, "3D Mouse Sensitivity", "Baseline sensitivity of the 3D Mouse");
+	RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse");
 
 	prop= RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE);
-	RNA_def_property_ui_text(prop, "Show 3D Mouse Guide", "Visualize the center and axis of rotation (or projected position in fly mode)");
+	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")*/
 
 	prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON);




More information about the Bf-blender-cvs mailing list