Fix T90332: Auto-smooth crashes in edit-mode
Regression in 39b2a7bb7e
that meant non-manifold edges were not being tagged
when they should have been.
This commit is contained in:
parent
d60a7a8744
commit
11cfa6c718
Notes:
blender-bot
2023-02-14 03:59:42 +01:00
Referenced by issue #90332, Convex Hull crash blender Referenced by issue #90293, Blender crashes in Edit mode
|
@ -50,6 +50,8 @@ static void bm_edge_tag_from_smooth(const float (*fnos)[3],
|
|||
BMEdge *e,
|
||||
const float split_angle_cos);
|
||||
|
||||
static void bm_edge_tag_clear(BMEdge *e);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Update Vertex & Face Normals
|
||||
* \{ */
|
||||
|
@ -820,9 +822,10 @@ BLI_INLINE bool bm_edge_is_smooth_no_angle_test(const BMEdge *e,
|
|||
const BMLoop *l_a,
|
||||
const BMLoop *l_b)
|
||||
{
|
||||
BLI_assert(l_a->radial_next == l_b);
|
||||
return (
|
||||
/* The face is manifold. */
|
||||
(l_a->radial_next == l_b) &&
|
||||
(l_b->radial_next == l_a) &&
|
||||
/* Faces have winding that faces the same way. */
|
||||
(l_a->v != l_b->v) &&
|
||||
/* The edge is smooth. */
|
||||
|
@ -863,6 +866,13 @@ static void bm_edge_tag_from_smooth(const float (*fnos)[3], BMEdge *e, const flo
|
|||
}
|
||||
}
|
||||
|
||||
static void bm_edge_tag_clear(BMEdge *e)
|
||||
{
|
||||
/* No need for atomics here as this is a single byte. */
|
||||
char *hflag_p = &e->head.hflag;
|
||||
*hflag_p = *hflag_p & ~BM_ELEM_TAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of #bm_edge_tag_from_smooth that sets sharp edges
|
||||
* when they would be considered smooth but exceed the split angle .
|
||||
|
@ -944,9 +954,13 @@ static void bm_mesh_loops_calc_normals_for_vert_with_clnors(BMesh *bm,
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Always set as #bm_mesh_loops_calc_normals_for_loop checks the tag. */
|
||||
if (do_edge_tag) {
|
||||
bm_edge_tag_from_smooth(fnos, e_curr_iter, split_angle_cos);
|
||||
}
|
||||
else {
|
||||
bm_edge_tag_clear(e_curr_iter);
|
||||
}
|
||||
|
||||
do { /* Radial loops. */
|
||||
if (l_curr->v != v) {
|
||||
|
@ -1052,9 +1066,13 @@ static void bm_mesh_loops_calc_normals_for_vert_without_clnors(
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Always set as #bm_mesh_loops_calc_normals_for_loop checks the tag. */
|
||||
if (do_edge_tag) {
|
||||
bm_edge_tag_from_smooth(fnos, e_curr_iter, split_angle_cos);
|
||||
}
|
||||
else {
|
||||
bm_edge_tag_clear(e_curr_iter);
|
||||
}
|
||||
|
||||
do { /* Radial loops. */
|
||||
if (l_curr->v != v) {
|
||||
|
|
Loading…
Reference in New Issue