diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-12 12:07:50 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-12 12:07:52 +0300 |
commit | cb5b33a627d922019ded5765032baf182cee54a2 (patch) | |
tree | 9ec560b37a468ea637687bb6ac7dc5c4331062d3 /source/blender/modifiers | |
parent | 0eb2244f0ae785aec08e608458804b780ea4957b (diff) |
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.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_screw.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; } |