[Bf-blender-cvs] [7f089af] master: Bake-API: relaxing in the check for scale uniformity
Dalai Felinto
noreply at git.blender.org
Fri May 23 02:38:23 CEST 2014
Commit: 7f089afc8bc0b25007c072838944fcdc6106544c
Author: Dalai Felinto
Date: Thu May 22 21:35:41 2014 -0300
https://developer.blender.org/rB7f089afc8bc0b25007c072838944fcdc6106544c
Bake-API: relaxing in the check for scale uniformity
It still warns the user that there may be an error, but the baking goes
on. Also using the new is_uniform_scaled_m4() instead of float comparison.
Reported and fix suggested by Campbell Barton as a concern over 2bfc3deb
===================================================================
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 7cfc894..8ce78e5 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -145,6 +145,7 @@ bool is_orthonormal_m3(float mat[3][3]);
bool is_orthonormal_m4(float mat[4][4]);
bool is_uniform_scaled_m3(float mat[3][3]);
+bool is_uniform_scaled_m4(float m[4][4]);
void adjoint_m2_m2(float R[2][2], float A[2][2]);
void adjoint_m3_m3(float R[3][3], float A[3][3]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 4cbe1a7..f375a5c 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1059,10 +1059,17 @@ bool is_uniform_scaled_m3(float m[3][3])
fabsf(l5 - l1) <= eps &&
fabsf(l6 - l1) <= eps)
{
- return 1;
+ return true;
}
- return 0;
+ return false;
+}
+
+bool is_uniform_scaled_m4(float m[4][4])
+{
+ float t[3][3];
+ copy_m3_m4(t, m);
+ return is_uniform_scaled_m3(t);
}
void normalize_m3(float mat[3][3])
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 57e29b1..95bddd2 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -508,14 +508,12 @@ static int bake(
if (ob_iter == ob_low)
continue;
- if (ob_iter->size[0] != ob_iter->size[1] || ob_iter->size[1] != ob_iter->size[2]) {
- BKE_reportf(reports, RPT_ERROR,
- "Selected objects need to have uniform scale. Apply Scale to object \"%s\"",
+ if (!is_uniform_scaled_m4(ob_iter->obmat)){
+ BKE_reportf(reports, RPT_INFO,
+ "Selected objects must have uniform scale. Apply scale to object \"%s\" for correct results",
ob_iter->id.name + 2);
- goto cleanup;
}
-
tot_highpoly ++;
}
More information about the Bf-blender-cvs
mailing list