[Bf-blender-cvs] [af9da0b] master: Complementary fix for rB8054372: Follow the common naming scheme by using negate_mat3_m4 instead of negate_m4.

Lukas Tönne noreply at git.blender.org
Thu Oct 30 15:31:33 CET 2014


Commit: af9da0be438812ee95698ae3e9adbbb49ba6b825
Author: Lukas Tönne
Date:   Thu Oct 30 15:26:41 2014 +0100
Branches: master
https://developer.blender.org/rBaf9da0be438812ee95698ae3e9adbbb49ba6b825

Complementary fix for rB8054372: Follow the common naming scheme by
using negate_mat3_m4 instead of negate_m4.

This avoids changing the behavior and only flips the 3x3 part of the
matrix.

===================================================================

M	source/blender/blenlib/BLI_math_matrix.h
M	source/blender/blenlib/intern/math_matrix.c
M	source/blender/editors/object/object_bake_api.c

===================================================================

diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index ee8b530..45972d0 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -126,6 +126,7 @@ void mul_m4_fl(float R[4][4], float f);
 void mul_mat3_m4_fl(float R[4][4], float f);
 
 void negate_m3(float R[3][3]);
+void negate_mat3_m4(float R[4][4]);
 void negate_m4(float R[4][4]);
 
 bool invert_m3_ex(float m[3][3], const float epsilon);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index fb04271..0204c3b 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -648,6 +648,15 @@ void negate_m3(float m[3][3])
 			m[i][j] *= -1.0f;
 }
 
+void negate_mat3_m4(float m[4][4])
+{
+	int i, j;
+
+	for (i = 0; i < 3; i++)
+		for (j = 0; j < 3; j++)
+			m[i][j] *= -1.0f;
+}
+
 void negate_m4(float m[4][4])
 {
 	int i, j;
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 4821ffd..57fabcb 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -768,7 +768,7 @@ static int bake(
 			normalize_m4_m4(highpoly[i].rotmat, highpoly[i].imat);
 			zero_v3(highpoly[i].rotmat[3]);
 			if (is_negative_m4(highpoly[i].rotmat))
-				negate_m4(highpoly[i].rotmat);
+				negate_mat3_m4(highpoly[i].rotmat);
 
 			i++;
 		}




More information about the Bf-blender-cvs mailing list