[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53403] trunk/blender/source/blender/ editors/space_view3d/view3d_edit.c: Fixes for NDOF device:

Ton Roosendaal ton at blender.org
Sat Dec 29 16:17:30 CET 2012


Revision: 53403
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53403
Author:   ton
Date:     2012-12-29 15:17:26 +0000 (Sat, 29 Dec 2012)
Log Message:
-----------
Fixes for NDOF device:

User preference "Rotate around selection" now works for all input operators.
(Didnt for new default)

Note: the default will only rotate around selection, zooms remain to view center.
Our view pivot methods are not well definied at all...

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2012-12-29 13:21:01 UTC (rev 53402)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2012-12-29 15:17:26 UTC (rev 53403)
@@ -1008,17 +1008,20 @@
  */
 static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ViewOpsData *vod = op->customdata;
 	
 	if (event->type != NDOF_MOTION)
 		return OPERATOR_CANCELLED;
 	else {
 		View3D *v3d = CTX_wm_view3d(C);
+		ViewOpsData *vod;
 		RegionView3D *rv3d = CTX_wm_region_view3d(C);
 		wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
 
 		ED_view3d_camera_lock_init(v3d, rv3d);
 
+		viewops_data_create(C, op, event);
+		vod = op->customdata;
+
 		rv3d->rot_angle = 0.f; /* off by default, until changed later this function */
 
 		if (ndof->progress != P_FINISHING) {
@@ -1138,8 +1141,10 @@
 			}
 		}
 
+		viewops_data_free(C, op);
+		
 		ED_view3d_camera_lock_sync(v3d, rv3d);
-
+		
 		ED_region_tag_redraw(CTX_wm_region(C));
 
 		return OPERATOR_FINISHED;
@@ -1164,11 +1169,11 @@
 
 static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ViewOpsData *vod = op->customdata;
 	
 	if (event->type != NDOF_MOTION)
 		return OPERATOR_CANCELLED;
 	else {
+		ViewOpsData *vod;
 		View3D *v3d = CTX_wm_view3d(C);
 		RegionView3D *rv3d = CTX_wm_region_view3d(C);
 		wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
@@ -1177,6 +1182,9 @@
 
 		rv3d->rot_angle = 0.f; /* off by default, until changed later this function */
 
+		viewops_data_create(C, op, event);
+		vod = op->customdata;
+
 		if (ndof->progress != P_FINISHING) {
 			const float dt = ndof->dt;
 
@@ -1308,6 +1316,8 @@
 			}
 		}
 
+		viewops_data_free(C, op);
+		
 		ED_view3d_camera_lock_sync(v3d, rv3d);
 
 		ED_region_tag_redraw(CTX_wm_region(C));
@@ -1460,16 +1470,8 @@
 			const float forward_sensitivity = 1.f;
 			const float vertical_sensitivity = 0.4f;
 			const float lateral_sensitivity = 0.6f;
-
 			float pan_vec[3];
 			const float rot_sensitivity = 1.f;
-#if 0
-			const float zoom_sensitivity = 1.f;
-			const float pan_sensitivity = 1.f;
-			float rot[4];
-			float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
-			float axis[3];
-#endif
 
 			/* inverse view */
 			invert_qt_qt(view_inv, rv3d->viewquat);
@@ -1575,10 +1577,13 @@
 			}
 
 		}
+		
+		viewops_data_free(C, op);
+		
 		ED_view3d_camera_lock_sync(v3d, rv3d);
 
 		ED_region_tag_redraw(CTX_wm_region(C));
-		viewops_data_free(C, op);
+		
 		return OPERATOR_FINISHED;
 	}
 }




More information about the Bf-blender-cvs mailing list