From abd68c6e45a67ff682f13000d1ae2f8b79edea22 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 May 2015 20:36:43 +1000 Subject: [PATCH] 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! --- source/blender/modifiers/intern/MOD_skin.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 02515360f3a..155c76638f9 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -249,6 +249,7 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe) /* Apply face attributes to hull output */ BMO_ITER (f, &oiter, op.slots_out, "geom.out", BM_FACE) { + BM_face_normal_update(f); if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING) BM_elem_flag_enable(f, BM_ELEM_SMOOTH); f->mat_nr = so->mat_nr; @@ -960,6 +961,7 @@ static void add_poly(SkinOutput *so, BLI_assert(v1 && v2 && v3); 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) BM_elem_flag_enable(f, BM_ELEM_SMOOTH); 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) { 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 * the edge */ quad_from_tris(e, adj, quad);