[Bf-blender-cvs] [abd68c6] master: Fix T42893: Skin Modifier, changes randomly toggling editmode

Campbell Barton noreply at git.blender.org
Mon May 4 13:03:12 CEST 2015


Commit: abd68c6e45a67ff682f13000d1ae2f8b79edea22
Author: Campbell Barton
Date:   Mon May 4 20:36:43 2015 +1000
Branches: master
https://developer.blender.org/rBabd68c6e45a67ff682f13000d1ae2f8b79edea22

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!

===================================================================

M	source/blender/modifiers/intern/MOD_skin.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 0251536..155c766 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);




More information about the Bf-blender-cvs mailing list