From b6aa3073685f3f72b240cf6b82a93678316adba7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 24 Nov 2011 03:12:37 +0000 Subject: [PATCH] move edge angle test from previous commit into a static function & set on the edge loop rather then of face edges. --- source/blender/bmesh/operators/mesh_conv.c | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/source/blender/bmesh/operators/mesh_conv.c b/source/blender/bmesh/operators/mesh_conv.c index ca15079b65c..4f1e65a208e 100644 --- a/source/blender/bmesh/operators/mesh_conv.c +++ b/source/blender/bmesh/operators/mesh_conv.c @@ -413,6 +413,21 @@ static BMVert **bmesh_to_mesh_vertex_map(BMesh *bm, int ototvert) return vertMap; } +BM_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e) +{ + /* this is a cheap way to set the edge draw, its not precise and will + * pick the first 2 faces an edge uses */ + + + if ( /* (med->flag & ME_EDGEDRAW) && */ /* assume to be true */ + (e->l && (e->l != e->l->radial_next)) && + (dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.995f)) + { + med->flag &= ~ME_EDGEDRAW; + } +} + + void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) { Mesh *me = BMO_Get_Pnt(op, "mesh"); @@ -532,6 +547,8 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) /*copy over customdata*/ CustomData_from_bmesh_block(&bm->edata, &me->edata, e->head.data, i); + bmesh_quick_edgedraw_flag(med, e); + i++; med++; BM_CHECK_ELEMENT(bm, e); @@ -661,21 +678,6 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) mloop->e = BM_GetIndex(l->e); mloop->v = BM_GetIndex(l->v); - -#if 1 - /* this is a cheap way to set the edge draw, just so happens - * at this part of the code the info is available, feel free to - * move this block of code elsewhere */ - - if ( (l != l->radial_next) && - (medge[mloop->e].flag & ME_EDGEDRAW) && - (dot_v3v3(f->no, l->radial_next->f->no) > 0.995f)) - { - medge[mloop->e].flag &= ~ME_EDGEDRAW; - } -#endif - - /*copy over customdata*/ CustomData_from_bmesh_block(&bm->ldata, &me->ldata, l->head.data, j); BM_CHECK_ELEMENT(bm, l);