Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-08-09 11:32:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-09 11:32:53 +0300
commit909e0819ae939a8054bea2c9dcf389232744f3ae (patch)
tree10f6e7264fd749c804fe086be7e137810cd7f13e
parent52c349cfcd28f402e6e73450831078fbd3fbbf08 (diff)
Fix T90532: Crash editing meshes with auto-smooth
Caused by fix for T90256 and a misunderstanding in D11928. Don't skip tagging edges when the auto-smooth angle is 180 degrees since this skips topology checks which are needed for properly calculating edge loop normals.
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_normals.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c
index 8eda38046a1..a5e41b74ee1 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c
@@ -1116,8 +1116,6 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
BMIter fiter;
BMFace *f_curr;
const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
- const bool check_angle = (split_angle < (float)M_PI);
- const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f;
MLoopNorSpaceArray _lnors_spacearr = {NULL};
@@ -1152,16 +1150,13 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
do {
BM_elem_index_set(l_curr, index_loop++); /* set_inline */
BM_elem_flag_disable(l_curr, BM_ELEM_TAG);
- /* Needed for when #bm_mesh_edges_sharp_tag doesn't run.
- * Mark smooth if there is no smoothing angle. */
- BM_elem_flag_enable(l_curr->e, BM_ELEM_TAG);
} while ((l_curr = l_curr->next) != l_first);
}
bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP);
- if (split_angle_cos != -1.0f) {
- bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, false);
- }
+ /* Always tag edges based on winding & sharp edge flag
+ * (even when the auto-smooth angle doesn't need to be calculated). */
+ bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, false);
/* We now know edges that can be smoothed (they are tagged),
* and edges that will be hard (they aren't).