[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15315] trunk/blender/source/blender: [ #14398] In Object- and EditMode, global rotate manual input is different than mouse

Martin Poirier theeth at yahoo.com
Sun Jun 22 22:40:13 CEST 2008


Revision: 15315
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15315
Author:   theeth
Date:     2008-06-22 22:40:13 +0200 (Sun, 22 Jun 2008)

Log Message:
-----------
[#14398] In Object- and EditMode, global rotate manual input is different than mouse

The sign of the rotation angle was sometimes different between num input and mouse input.

Modified Paths:
--------------
    trunk/blender/source/blender/include/transform.h
    trunk/blender/source/blender/src/transform.c
    trunk/blender/source/blender/src/transform_constraints.c
    trunk/blender/source/blender/src/transform_snap.c

Modified: trunk/blender/source/blender/include/transform.h
===================================================================
--- trunk/blender/source/blender/include/transform.h	2008-06-22 20:39:41 UTC (rev 15314)
+++ trunk/blender/source/blender/include/transform.h	2008-06-22 20:40:13 UTC (rev 15315)
@@ -102,9 +102,9 @@
                          /* Apply function pointer for linear vectorial transformation                */
                          /* The last three parameters are pointers to the in/out/printable vectors    */
     void  (*applySize)(struct TransInfo *, struct TransData *, float [3][3]);
-                         /* Apply function pointer for rotation transformation (prototype will change */
-    void  (*applyRot)(struct TransInfo *, struct TransData *, float [3]);
-                         /* Apply function pointer for rotation transformation (prototype will change */
+                         /* Apply function pointer for size transformation */
+    void  (*applyRot)(struct TransInfo *, struct TransData *, float [3], float *);
+                         /* Apply function pointer for rotation transformation */
 } TransCon;
 
 typedef struct TransDataIpokey {

Modified: trunk/blender/source/blender/src/transform.c
===================================================================
--- trunk/blender/source/blender/src/transform.c	2008-06-22 20:39:41 UTC (rev 15314)
+++ trunk/blender/source/blender/src/transform.c	2008-06-22 20:40:13 UTC (rev 15315)
@@ -2621,7 +2621,7 @@
 			continue;
 		
 		if (t->con.applyRot) {
-			t->con.applyRot(t, td, axis);
+			t->con.applyRot(t, td, axis, NULL);
 			VecRotToMat3(axis, angle * td->factor, mat);
 		}
 		else if (t->flag & T_PROP_EDIT) {
@@ -2654,7 +2654,7 @@
 	snapGrid(t, &final);
 
 	if (t->con.applyRot) {
-		t->con.applyRot(t, NULL, axis);
+		t->con.applyRot(t, NULL, axis, &final);
 	}
 	
 	applySnapping(t, &final);
@@ -3314,7 +3314,7 @@
 	}
 	
 	if (t->con.applyRot && t->con.mode & CON_APPLY) {
-		t->con.applyRot(t, NULL, axis);
+		t->con.applyRot(t, NULL, axis, NULL);
 	}
 	
 	for(i = 0 ; i < t->total; i++, td++) {
@@ -3326,7 +3326,7 @@
 
 		VecSubf(vec, t->center, td->center);
 		if (t->con.applyRot && t->con.mode & CON_APPLY) {
-			t->con.applyRot(t, td, axis);
+			t->con.applyRot(t, td, axis, NULL);
 			if (isLockConstraint(t)) {
 				float dvec[3];
 				Projf(dvec, vec, axis);

Modified: trunk/blender/source/blender/src/transform_constraints.c
===================================================================
--- trunk/blender/source/blender/src/transform_constraints.c	2008-06-22 20:39:41 UTC (rev 15314)
+++ trunk/blender/source/blender/src/transform_constraints.c	2008-06-22 20:40:13 UTC (rev 15315)
@@ -393,7 +393,7 @@
  * (ie: not doing counterclockwise rotations when the mouse moves clockwise).
  */
 
-static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3])
+static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle)
 {
 	if (!td && t->con.mode & CON_APPLY) {
 		int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
@@ -413,9 +413,9 @@
 			break;
 		}
 		/* don't flip axis if asked to or if num input */
-		if (!(mode & CON_NOFLIP) && hasNumInput(&t->num) == 0) {
+		if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
 			if (Inpf(vec, t->viewinv[2]) > 0.0f) {
-				VecMulf(vec, -1.0f);
+				*angle = -(*angle);
 			}
 		}
 	}
@@ -435,10 +435,15 @@
  * (ie: not doing counterclockwise rotations when the mouse moves clockwise).
  */
 
-static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3])
+static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle)
 {
-	if (td && t->con.mode & CON_APPLY) {
+	if (t->con.mode & CON_APPLY) {
 		int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
+		
+		/* on setup call, use first object */
+		if (td == NULL) {
+			td= t->data;
+		}
 
 		switch(mode) {
 		case CON_AXIS0:
@@ -454,9 +459,9 @@
 			VECCOPY(vec, td->axismtx[2]);
 			break;
 		}
-		if (!(mode & CON_NOFLIP)) {
+		if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
 			if (Inpf(vec, t->viewinv[2]) > 0.0f) {
-				VecMulf(vec, -1.0f);
+				*angle = -(*angle);
 			}
 		}
 	}

Modified: trunk/blender/source/blender/src/transform_snap.c
===================================================================
--- trunk/blender/source/blender/src/transform_snap.c	2008-06-22 20:39:41 UTC (rev 15314)
+++ trunk/blender/source/blender/src/transform_snap.c	2008-06-22 20:40:13 UTC (rev 15315)
@@ -412,7 +412,7 @@
 	if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
 		float axis[3], tmp[3];
 		
-		t->con.applyRot(t, NULL, axis);
+		t->con.applyRot(t, NULL, axis, NULL);
 
 		Projf(tmp, end, axis);
 		VecSubf(end, end, tmp);





More information about the Bf-blender-cvs mailing list