[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24384] trunk/blender/source/blender/ editors: Make orientation matrix access function public.

Martin Poirier theeth at yahoo.com
Fri Nov 6 22:31:14 CET 2009


Revision: 24384
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24384
Author:   theeth
Date:     2009-11-06 22:31:14 +0100 (Fri, 06 Nov 2009)

Log Message:
-----------
Make orientation matrix access function public.

Fix bug in previous code: passing 3x3 matrix to a function expecting a 4x4 (warnings are for something)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_transform.h
    trunk/blender/source/blender/editors/transform/transform.h
    trunk/blender/source/blender/editors/transform/transform_manipulator.c
    trunk/blender/source/blender/editors/transform/transform_orientations.c

Modified: trunk/blender/source/blender/editors/include/ED_transform.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_transform.h	2009-11-06 21:10:45 UTC (rev 24383)
+++ trunk/blender/source/blender/editors/include/ED_transform.h	2009-11-06 21:31:14 UTC (rev 24384)
@@ -122,6 +122,8 @@
 void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
 void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
 
+void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[][3], int activeOnly);
+
 struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C);
 char * BIF_menustringTransformOrientation(const struct bContext *C, char *title); /* the returned value was allocated and needs to be freed after use */
 int BIF_countTransformOrientation(const struct bContext *C);

Modified: trunk/blender/source/blender/editors/transform/transform.h
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.h	2009-11-06 21:10:45 UTC (rev 24383)
+++ trunk/blender/source/blender/editors/transform/transform.h	2009-11-06 21:31:14 UTC (rev 24384)
@@ -698,8 +698,6 @@
 
 int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3], int activeOnly);
 
-/* also used in view3d_edit.c, todo - move outside of transform */
-void getTransformOrientationMatrix(const struct bContext *C, float twmat[][4], int use_active);
 int createSpaceNormal(float mat[3][3], float normal[3]);
 int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]);
 

Modified: trunk/blender/source/blender/editors/transform/transform_manipulator.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_manipulator.c	2009-11-06 21:10:45 UTC (rev 24383)
+++ trunk/blender/source/blender/editors/transform/transform_manipulator.c	2009-11-06 21:31:14 UTC (rev 24384)
@@ -496,7 +496,9 @@
 		}
 		case V3D_MANIP_NORMAL:
 			if(obedit || ob->mode & OB_MODE_POSE) {
-				getTransformOrientationMatrix(C, rv3d->twmat, (v3d->around == V3D_ACTIVE));
+				float mat[3][3];
+				ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
+				Mat4CpyMat3(rv3d->twmat, mat);
 				break;
 			}
 			/* no break we define 'normal' as 'local' in Object mode */

Modified: trunk/blender/source/blender/editors/transform/transform_orientations.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_orientations.c	2009-11-06 21:10:45 UTC (rev 24383)
+++ trunk/blender/source/blender/editors/transform/transform_orientations.c	2009-11-06 21:31:14 UTC (rev 24384)
@@ -515,9 +515,6 @@
 	View3D *v3d = CTX_wm_view3d(C);
 	Object *ob = CTX_data_active_object(C);
 	Object *obedit = CTX_data_active_object(C);
-	float normal[3]={0.0, 0.0, 0.0};
-	float plane[3]={0.0, 0.0, 0.0};
-	
 
 	switch(t->current_orientation) {
 	case V3D_MANIP_GLOBAL:
@@ -532,7 +529,7 @@
 	case V3D_MANIP_NORMAL:
 		if(obedit || (ob && ob->mode & OB_MODE_POSE)) {
 			strcpy(t->spacename, "normal");
-			getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
+			ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
 			break;
 		}
 		/* no break we define 'normal' as 'local' in Object mode */
@@ -927,12 +924,11 @@
 	return result;
 }
 
-void getTransformOrientationMatrix(const bContext *C, float twmat[][4], int activeOnly)
+void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[][3], int activeOnly)
 {
 	float normal[3]={0.0, 0.0, 0.0};
 	float plane[3]={0.0, 0.0, 0.0};
 
-	float mat[3][3];
 	int type;
 
 	type = getTransformOrientation(C, normal, plane, activeOnly);
@@ -940,25 +936,25 @@
 	switch (type)
 	{
 		case ORIENTATION_NORMAL:
-			if (createSpaceNormalTangent(mat, normal, plane) == 0)
+			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
 			{
 				type = ORIENTATION_NONE;
 			}
 			break;
 		case ORIENTATION_VERT:
-			if (createSpaceNormal(mat, normal) == 0)
+			if (createSpaceNormal(orientation_mat, normal) == 0)
 			{
 				type = ORIENTATION_NONE;
 			}
 			break;
 		case ORIENTATION_EDGE:
-			if (createSpaceNormalTangent(mat, normal, plane) == 0)
+			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
 			{
 				type = ORIENTATION_NONE;
 			}
 			break;
 		case ORIENTATION_FACE:
-			if (createSpaceNormalTangent(mat, normal, plane) == 0)
+			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
 			{
 				type = ORIENTATION_NONE;
 			}
@@ -967,10 +963,6 @@
 
 	if (type == ORIENTATION_NONE)
 	{
-		Mat4One(twmat);
+		Mat3One(orientation_mat);
 	}
-	else
-	{
-		Mat4CpyMat3(twmat, mat);
-	}
 }





More information about the Bf-blender-cvs mailing list