Fix T42893: Skin Modifier, changes randomly toggling editmode

Own regression, previously it would do a full mesh normal calculation for each isolated shape
(could hang on meshes with many loose parts).

However the normals are needed, instead of doing a full calculation,
just set normals on new faces.

Thanks to Brecht for finding cause!
This commit is contained in:
Campbell Barton 2015-05-04 20:36:43 +10:00
parent 8d5eeab473
commit abd68c6e45

@ -249,6 +249,7 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe)
/* Apply face attributes to hull output */ /* Apply face attributes to hull output */
BMO_ITER (f, &oiter, op.slots_out, "geom.out", BM_FACE) { BMO_ITER (f, &oiter, op.slots_out, "geom.out", BM_FACE) {
BM_face_normal_update(f);
if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING) if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
BM_elem_flag_enable(f, BM_ELEM_SMOOTH); BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
f->mat_nr = so->mat_nr; f->mat_nr = so->mat_nr;
@ -960,6 +961,7 @@ static void add_poly(SkinOutput *so,
BLI_assert(v1 && v2 && v3); BLI_assert(v1 && v2 && v3);
f = BM_face_create_verts(so->bm, verts, v4 ? 4 : 3, NULL, BM_CREATE_NO_DOUBLE, true); f = BM_face_create_verts(so->bm, verts, v4 ? 4 : 3, NULL, BM_CREATE_NO_DOUBLE, true);
BM_face_normal_update(f);
if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING) if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
BM_elem_flag_enable(f, BM_ELEM_SMOOTH); BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
f->mat_nr = so->mat_nr; f->mat_nr = so->mat_nr;
@ -1421,6 +1423,9 @@ static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
if (adj[0]->len == 3 && adj[1]->len == 3) { if (adj[0]->len == 3 && adj[1]->len == 3) {
BMVert *quad[4]; BMVert *quad[4];
BLI_assert(BM_face_is_normal_valid(adj[0]));
BLI_assert(BM_face_is_normal_valid(adj[1]));
/* Construct quad using the two triangles adjacent to /* Construct quad using the two triangles adjacent to
* the edge */ * the edge */
quad_from_tris(e, adj, quad); quad_from_tris(e, adj, quad);