[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38669] branches/merwin-spacenav/source/ blender/editors/transform: removed old ndof transform stuff, added experimental ndof nav during transform (might disable for release)

Mike Erwin significant.bit at gmail.com
Mon Jul 25 02:00:54 CEST 2011


Revision: 38669
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38669
Author:   merwin
Date:     2011-07-25 00:00:53 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
removed old ndof transform stuff, added experimental ndof nav during transform (might disable for release)

Modified Paths:
--------------
    branches/merwin-spacenav/source/blender/editors/transform/transform.c
    branches/merwin-spacenav/source/blender/editors/transform/transform_ops.c

Modified: branches/merwin-spacenav/source/blender/editors/transform/transform.c
===================================================================
--- branches/merwin-spacenav/source/blender/editors/transform/transform.c	2011-07-24 23:42:20 UTC (rev 38668)
+++ branches/merwin-spacenav/source/blender/editors/transform/transform.c	2011-07-25 00:00:53 UTC (rev 38669)
@@ -1006,9 +1006,11 @@
 			else view_editmove(event->type);
 			t->redraw= 1;
 			break;
-//		case NDOFMOTION:
-//            viewmoveNDOF(1);
-  //         break;
+#if 0
+		case NDOF_MOTION:
+			// should have been caught by tranform_modal
+			return OPERATOR_PASS_THROUGH;
+#endif
 		default:
 			handled = 0;
 			break;
@@ -1017,43 +1019,6 @@
 		// Numerical input events
 		t->redraw |= handleNumInput(&(t->num), event);
 
-		// NDof input events
-		switch(handleNDofInput(&(t->ndof), event))
-		{
-			case NDOF_CONFIRM:
-				if ((t->options & CTX_NDOF) == 0)
-				{
-					/* Confirm on normal transform only */
-					t->state = TRANS_CONFIRM;
-				}
-				break;
-			case NDOF_CANCEL:
-				if (t->options & CTX_NDOF)
-				{
-					/* Cancel on pure NDOF transform */
-					t->state = TRANS_CANCEL;
-				}
-				else
-				{
-					/* Otherwise, just redraw, NDof input was cancelled */
-					t->redraw |= TREDRAW_HARD;
-				}
-				break;
-			case NDOF_NOMOVE:
-				if (t->options & CTX_NDOF)
-				{
-					/* Confirm on pure NDOF transform */
-					t->state = TRANS_CONFIRM;
-				}
-				break;
-			case NDOF_REFRESH:
-				t->redraw |= TREDRAW_HARD;
-				break;
-			default:
-				handled = 0;
-				break;
-		}
-
 		// Snapping events
 		t->redraw |= handleSnapping(t, event);
 
@@ -2886,10 +2851,6 @@
 	setInputPostFct(&t->mouse, postInputRotation);
 	initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
 	
-	t->ndof.axis = 16;
-	/* Scale down and flip input for rotation */
-	t->ndof.factor[0] = -0.2f;
-	
 	t->idx_max = 0;
 	t->num.idx_max = 0;
 	t->snap[0] = 0.0f;
@@ -3161,8 +3122,6 @@
 
 	final = t->values[0];
 	
-	applyNDofInput(&t->ndof, &final);
-	
 	snapGrid(t, &final);
 	
 	if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
@@ -3216,11 +3175,6 @@
 
 	initMouseInputMode(t, &t->mouse, INPUT_TRACKBALL);
 
-	t->ndof.axis = 40;
-	/* Scale down input for rotation */
-	t->ndof.factor[0] = 0.2f;
-	t->ndof.factor[1] = 0.2f;
-
 	t->idx_max = 1;
 	t->num.idx_max = 1;
 	t->snap[0] = 0.0f;
@@ -3276,8 +3230,6 @@
 	phi[0] = t->values[0];
 	phi[1] = t->values[1];
 
-	applyNDofInput(&t->ndof, phi);
-
 	snapGrid(t, phi);
 
 	if (hasNumInput(&t->num)) {
@@ -3331,8 +3283,6 @@
 	t->num.flag = 0;
 	t->num.idx_max = t->idx_max;
 
-	t->ndof.axis = (t->flag & T_2D_EDIT)? 1|2: 1|2|4;
-
 	if(t->spacetype == SPACE_VIEW3D) {
 		RegionView3D *rv3d = t->ar->regiondata;
 
@@ -3507,7 +3457,6 @@
 		headerTranslation(t, pvec, str);
 	}
 	else {
-		applyNDofInput(&t->ndof, t->values);
 		snapGrid(t, t->values);
 		applyNumInput(&t->num, t->values);
 		if (hasNumInput(&t->num)) {
@@ -3616,10 +3565,6 @@
 
 	initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
 
-	t->ndof.axis = 16;
-	/* Scale down and flip input for rotation */
-	t->ndof.factor[0] = -0.2f;
-
 	t->idx_max = 0;
 	t->num.idx_max = 0;
 	t->snap[0] = 0.0f;
@@ -3643,8 +3588,6 @@
 
 	final = t->values[0];
 
-	applyNDofInput(&t->ndof, &final);
-
 	snapGrid(t, &final);
 
 	if (hasNumInput(&t->num)) {
@@ -3759,10 +3702,6 @@
 
 	initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
 
-	t->ndof.axis = 4;
-	/* Flip direction */
-	t->ndof.factor[0] = -1.0f;
-
 	t->idx_max = 0;
 	t->num.idx_max = 0;
 	t->snap[0] = 0.0f;
@@ -3783,8 +3722,6 @@
 
 	distance = t->values[0];
 
-	applyNDofInput(&t->ndof, &distance);
-
 	snapGrid(t, &distance);
 
 	applyNumInput(&t->num, &distance);
@@ -5309,8 +5246,6 @@
 	t->num.flag = 0;
 	t->num.idx_max = t->idx_max;
 
-	t->ndof.axis = 1|2;
-
 	t->snap[0] = 0.0f;
 	t->snap[1] = floor(t->scene->r.frs_sec / t->scene->r.frs_sec_base);
 	t->snap[2] = 10.0f;
@@ -5365,7 +5300,6 @@
 		VECCOPY(t->values, tvec);
 	}
 	else {
-		applyNDofInput(&t->ndof, t->values);
 		snapGrid(t, t->values);
 		applyNumInput(&t->num, t->values);
 	}
@@ -5925,54 +5859,3 @@
 	// TRANSFORM_FIX_ME
 	//Trans.undostr= str;
 }
-
-
-#if 0 // TRANSFORM_FIX_ME
-static void NDofTransform(void)
-{
-	float fval[7];
-	float maxval = 50.0f; // also serves as threshold
-	int axis = -1;
-	int mode = 0;
-	int i;
-
-	getndof(fval);
-
-	for(i = 0; i < 6; i++)
-	{
-		float val = fabs(fval[i]);
-		if (val > maxval)
-		{
-			axis = i;
-			maxval = val;
-		}
-	}
-
-	switch(axis)
-	{
-		case -1:
-			/* No proper axis found */
-			break;
-		case 0:
-		case 1:
-		case 2:
-			mode = TFM_TRANSLATION;
-			break;
-		case 4:
-			mode = TFM_ROTATION;
-			break;
-		case 3:
-		case 5:
-			mode = TFM_TRACKBALL;
-			break;
-		default:
-			printf("ndof: what we are doing here ?");
-	}
-
-	if (mode != 0)
-	{
-		initTransform(mode, CTX_NDOF);
-		Transform();
-	}
-}
-#endif

Modified: branches/merwin-spacenav/source/blender/editors/transform/transform_ops.c
===================================================================
--- branches/merwin-spacenav/source/blender/editors/transform/transform_ops.c	2011-07-24 23:42:20 UTC (rev 38668)
+++ branches/merwin-spacenav/source/blender/editors/transform/transform_ops.c	2011-07-25 00:00:53 UTC (rev 38669)
@@ -360,6 +360,12 @@
 
 	TransInfo *t = op->customdata;
 
+	if (event->type == NDOF_MOTION)
+		{
+		// puts("transform_modal: passing through NDOF_MOTION");
+		return OPERATOR_PASS_THROUGH;
+		}
+
 	/* XXX insert keys are called here, and require context */
 	t->context= C;
 	exit_code = transformEvent(t, event);




More information about the Bf-blender-cvs mailing list