[Bf-blender-cvs] [cb5b33a627d] blender-v3.2-release: Fix T98056: Screw modifier crash with normal calculation and merging

Hans Goudey noreply at git.blender.org
Thu May 12 11:07:53 CEST 2022


Commit: cb5b33a627d922019ded5765032baf182cee54a2
Author: Hans Goudey
Date:   Thu May 12 11:07:50 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBcb5b33a627d922019ded5765032baf182cee54a2

Fix T98056: Screw modifier crash with normal calculation and merging

If merging is enabled, the mesh might be recreated before
the dirty flag can be cleared, which means the normals aren't
valid anymore. To fix this, clearing the dirty flag should happen
before the merging. This is an existing bug, just exposed by
more recent explicit dirty normal tagging.

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

M	source/blender/modifiers/intern/MOD_screw.c

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

diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 05072cf340c..2082d9f3bba 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -1118,6 +1118,10 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
     MEM_freeN(vert_loop_map);
   }
 
+  if ((ltmd->flag & MOD_SCREW_NORMAL_CALC)) {
+    BKE_mesh_vertex_normals_clear_dirty(result);
+  }
+
   if ((ltmd->flag & MOD_SCREW_MERGE) && (screw_ofs == 0.0f)) {
     result = mesh_remove_doubles_on_axis(result,
                                          mvert_new,
@@ -1128,10 +1132,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
                                          ltmd->merge_dist);
   }
 
-  if ((ltmd->flag & MOD_SCREW_NORMAL_CALC)) {
-    BKE_mesh_vertex_normals_clear_dirty(result);
-  }
-
   return result;
 }



More information about the Bf-blender-cvs mailing list