[Bf-blender-cvs] [834b966b419] master: Fix T95212: Mirror modifier normals crash

Hans Goudey noreply at git.blender.org
Thu Jan 27 18:02:39 CET 2022


Commit: 834b966b419ca50f0675e49720dff36822838acb
Author: Hans Goudey
Date:   Thu Jan 27 11:02:10 2022 -0600
Branches: master
https://developer.blender.org/rB834b966b419ca50f0675e49720dff36822838acb

Fix T95212: Mirror modifier normals crash

The vertex and face normals from the input mesh
were used to calculate the normals on the result,
which could cause a crash because the result should
be about twice as large.

Also remove an unnecessary dirty tag, since it is handled
automatically when creating a new mesh or in the case
of the mirror modifier, when calculating the new custom
face corner normals.

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

M	source/blender/blenkernel/intern/mesh_mirror.c
M	source/blender/modifiers/intern/MOD_mirror.c

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

diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c
index abc0b518d92..ec3655ac491 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -420,7 +420,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
     /* calculate custom normals into loop_normals, then mirror first half into second half */
 
     BKE_mesh_normals_loop_split(result->mvert,
-                                BKE_mesh_vertex_normals_ensure(mesh),
+                                BKE_mesh_vertex_normals_ensure(result),
                                 result->totvert,
                                 result->medge,
                                 result->totedge,
@@ -428,7 +428,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
                                 loop_normals,
                                 totloop,
                                 result->mpoly,
-                                BKE_mesh_poly_normals_ensure(mesh),
+                                BKE_mesh_poly_normals_ensure(result),
                                 totpoly,
                                 true,
                                 mesh->smoothresh,
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index bbac6589577..1bdc97f0a8b 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -120,9 +120,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
 
   result = mirrorModifier__doMirror(mmd, ctx->object, mesh);
 
-  if (result != mesh) {
-    BKE_mesh_normals_tag_dirty(result);
-  }
   return result;
 }



More information about the Bf-blender-cvs mailing list