diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-07 14:04:05 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-07 14:07:01 +0300 |
commit | f08018f92868806bd840670e7e94c65d83a069c0 (patch) | |
tree | d71da9d143706dc6af493a92d3df768c4d48739a /source/blender/modifiers/intern/MOD_normal_edit.c | |
parent | 0036ffb3e608afb9f24374c7942cbdd5efc5dd68 (diff) |
Fix (unreported) EditNormal modifier: broken 'flip poly' feature.
Newly computed custom normals were forgotten during poly flipping, leading
to wrong custom normals being assigned to wrong loop...
Dead simple, but was tough to track down this one!
Diffstat (limited to 'source/blender/modifiers/intern/MOD_normal_edit.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_normal_edit.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index d386653d2c6..2cfa746ab3c 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -158,6 +158,7 @@ static bool polygons_check_flip( MPoly *mpoly, float (*polynors)[3], const int num_polys) { MPoly *mp; + MDisps *mdisp = CustomData_get_layer(ldata, CD_MDISPS); int i; bool flipped = false; @@ -176,7 +177,7 @@ static bool polygons_check_flip( /* If average of new loop normals is opposed to polygon normal, flip polygon. */ if (dot_v3v3(polynors[i], norsum) < 0.0f) { - BKE_mesh_polygon_flip(mp, mloop, ldata); + BKE_mesh_polygon_flip_ex(mp, mloop, ldata, nos, mdisp, true); negate_v3(polynors[i]); flipped = true; } @@ -272,6 +273,8 @@ static void normalEditModifier_do_radial( if (polygons_check_flip(mloop, nos, dm->getLoopDataLayout(dm), mpoly, polynors, num_polys)) { dm->dirty |= DM_DIRTY_TESS_CDLAYERS; + /* We need to recompute vertex normals! */ + dm->calcNormals(dm); } BKE_mesh_normals_loop_custom_set(mvert, num_verts, medge, num_edges, mloop, nos, num_loops, |