diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2014-05-29 19:20:29 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2014-05-29 19:20:55 +0400 |
commit | 2057a3a2fcd545ad16fd77f789562727a5fd3f8b (patch) | |
tree | 88652f6d81d28126ab196d88922c663692c6dcc4 /source/blender/editors/object/object_bake_api.c | |
parent | b2cad79500bb1af92153928479ca7d7144463e00 (diff) |
Proper fix T40156 Cycles Baking and applyRotation issues
This should be the final fix for the applyrotation issue. It baffles me
that the fix involves discarding the scale transformations for the
normals but it works so I'm happy with it.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D554
Diffstat (limited to 'source/blender/editors/object/object_bake_api.c')
-rw-r--r-- | source/blender/editors/object/object_bake_api.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 54d1f0c679b..e349ad81081 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -522,11 +522,6 @@ static int bake( if (ob_iter == ob_low) continue; - 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); - } - tot_highpoly ++; } @@ -633,9 +628,14 @@ static int bake( highpoly[i].ob->restrictflag &= ~OB_RESTRICT_RENDER; /* lowpoly to highpoly transformation matrix */ - copy_m4_m4(highpoly[i].mat_high, highpoly[i].ob->obmat); - invert_m4_m4(highpoly[i].imat_high, highpoly[i].mat_high); - highpoly[i].scale = mat4_to_scale(highpoly[i].mat_high); + copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->obmat); + invert_m4_m4(highpoly[i].imat, highpoly[i].obmat); + + /* rotation */ + normalize_m4_m4(highpoly[i].rotmat, highpoly[i].imat); + zero_v3(highpoly[i].rotmat[3]); + if (is_negative_m4(highpoly[i].rotmat)) + negate_m3(highpoly[i].rotmat); i++; } |