Fix T90421: edit-mode auto-smooth crash when angle set to 180degrees

Error in 39b2a7bb7e
which failed to set edge flags with single threaded calculation,
used for low poly models.
This commit is contained in:
Campbell Barton 2021-08-04 22:34:55 +10:00
parent 76dcf70dac
commit 26c2c617b4
Notes: blender-bot 2023-02-14 09:29:42 +01:00
Referenced by issue #90421, Crash in Edit Mode with non-manifold meshes when autosmooth is enabled and set to exactly 180º
1 changed files with 6 additions and 4 deletions

View File

@ -1156,10 +1156,6 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
edge_vectors = BLI_stack_new(sizeof(float[3]), __func__);
}
if (split_angle_cos != -1.0f) {
bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, false);
}
/* Clear all loops' tags (means none are to be skipped for now). */
int index_face, index_loop = 0;
BM_ITER_MESH_INDEX (f_curr, &fiter, bm, BM_FACES_OF_MESH, index_face) {
@ -1171,10 +1167,16 @@ 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. */
BM_elem_flag_disable(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);
}
/* We now know edges that can be smoothed (they are tagged),
* and edges that will be hard (they aren't).
* Now, time to generate the normals.