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
This commit is contained in:
Dalai Felinto 2014-05-22 21:35:41 -03:00
parent dd96205d0a
commit 7f089afc8b
3 changed files with 13 additions and 7 deletions

@ -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]);

@ -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])

@ -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 ++;
}