From 9776f56a39fd29ef1448ff35551eba27ab8b7c16 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 28 Nov 2011 03:41:14 +0000 Subject: [PATCH] change edge split modifier to loop over all edges and compare the face angles, rather then looping over all faces and looking at every faces-edges-fance which would compare faces twice. --- .../blender/modifiers/intern/MOD_edgesplit.c | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 22eaa41938d..ae39a4ed6f0 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -67,9 +67,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj BMesh *bm; BMEditMesh *em; DerivedMesh *cddm; - BMIter iter, liter; - BMFace *f; - BMLoop *l; + BMIter iter; BMEdge *e; /* int allocsize[] = {512, 512, 2048, 512}; */ /* UNUSED */ float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0); @@ -85,16 +83,14 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj BMO_push(bm, NULL); if (emd->flags & MOD_EDGESPLIT_FROMANGLE) { - BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { - BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { - float edge_angle_cos; - - if (l->radial_next == l) - continue; - - edge_angle_cos = dot_v3v3(f->no, l->radial_next->f->no); - if (edge_angle_cos < threshold) { - BMO_SetFlag(bm, l->e, EDGE_MARK); + BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + /* check for 1 edge having 2 face users */ + BMLoop *l1, *l2; + if ( (l1= e->l) && + (l2= e->l->radial_next) != l1) + { + if (dot_v3v3(l1->f->no, l2->f->no) < threshold) { + BMO_SetFlag(bm, e, EDGE_MARK); } } }