diff options
-rw-r--r-- | source/blender/bmesh/bmesh.h | 30 | ||||
-rw-r--r-- | source/blender/bmesh/bmesh_queries.h | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 18 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers_impl.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_join_triangles.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_utils.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_edgesplit.c | 3 |
15 files changed, 55 insertions, 52 deletions
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index 1f7e5f15d3a..ae85c40e270 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -92,21 +92,23 @@ struct EditMesh; #define BM_FACE 8 #define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE) -/* BMHeader->hflag (char, all bits used!) */ -#define BM_ELEM_SELECT (1<<0) -#define BM_ELEM_HIDDEN (1<<1) -#define BM_ELEM_SEAM (1<<2) -#define BM_ELEM_SHARP (1<<3) -#define BM_ELEM_SMOOTH (1<<4) -#define BM_ELEM_TAG (1<<5) /* internal flag, used for ensuring correct normals - * during multires interpolation, and any other time - * when temp tagging is handy. - * always assume dirty & clear before use. */ - -/* we have 2 spare flags which is awesome but since we're limited to 8 +/* BMHeader->hflag (char) */ +#define BM_ELEM_SELECT (1 << 0) +#define BM_ELEM_HIDDEN (1 << 1) +#define BM_ELEM_SEAM (1 << 2) +#define BM_ELEM_SMOOTH (1 << 3) /* used for faces and edges, note from the user POV, + * this is a sharp edge when disabled */ + +#define BM_ELEM_TAG (1 << 4) /* internal flag, used for ensuring correct normals + * during multires interpolation, and any other time + * when temp tagging is handy. + * always assume dirty & clear before use. */ + +/* we have 3 spare flags which is awesome but since we're limited to 8 * only add new flags with care! - campbell */ -/* #define BM_TMP_SPARE (1<<6) */ -/* #define BM_NONORMCALC (1<<7) */ /* UNUSED */ +/* #define BM_ELEM_SPARE (1<<5) */ +/* #define BM_ELEM_SPARE (1<<6) */ +/* #define BM_ELEM_NONORMCALC (1<<7) */ /* UNUSED */ /* stub */ void bmesh_error(void); diff --git a/source/blender/bmesh/bmesh_queries.h b/source/blender/bmesh/bmesh_queries.h index 040d0f00923..1ae469eb663 100644 --- a/source/blender/bmesh/bmesh_queries.h +++ b/source/blender/bmesh/bmesh_queries.h @@ -72,13 +72,13 @@ int BM_vert_is_wire(struct BMesh *bm, struct BMVert *v); /*returns true if e is a wire edge*/ int BM_edge_is_wire(struct BMesh *bm, struct BMEdge *e); -/* returns true if v is part of a non-manifold edge in the mesh, +/* returns FALSE if v is part of a non-manifold edge in the mesh, * I believe this includes if it's part of both a wire edge and * a face.*/ -int BM_vert_is_nonmanifold(struct BMesh *bm, struct BMVert *v); +int BM_vert_is_manifold(struct BMesh *bm, struct BMVert *v); -/* returns true if e is shared by more then two faces. */ -int BM_edge_is_nonmanifold(struct BMesh *bm, struct BMEdge *e); +/* returns FALSE if e is shared by more then two faces. */ +int BM_edge_is_manifold(struct BMesh *bm, struct BMEdge *e); /* returns true if e is a boundary edge, e.g. has only 1 face bordering it. */ int BM_edge_is_boundry(struct BMEdge *e); diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index b202523f3a0..cdb40d668d1 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -789,10 +789,10 @@ char BM_vert_flag_from_mflag(const char meflag) } char BM_edge_flag_from_mflag(const short meflag) { - return ( ((meflag & SELECT) ? BM_ELEM_SELECT : 0) | - ((meflag & ME_SEAM) ? BM_ELEM_SEAM : 0) | - ((meflag & ME_SHARP) ? BM_ELEM_SHARP : 0) | - ((meflag & ME_HIDE) ? BM_ELEM_HIDDEN : 0) + return ( ((meflag & SELECT) ? BM_ELEM_SELECT : 0) | + ((meflag & ME_SEAM) ? BM_ELEM_SEAM : 0) | + ((meflag & ME_SHARP) == 0 ? BM_ELEM_SMOOTH : 0) | /* invert */ + ((meflag & ME_HIDE) ? BM_ELEM_HIDDEN : 0) ); } char BM_face_flag_from_mflag(const char meflag) @@ -818,7 +818,7 @@ short BM_edge_flag_to_mflag(BMEdge *eed) return ( ((hflag & BM_ELEM_SELECT) ? SELECT : 0) | ((hflag & BM_ELEM_SEAM) ? ME_SEAM : 0) | - ((hflag & BM_ELEM_SHARP) ? ME_SHARP : 0) | + ((hflag & BM_ELEM_SMOOTH) == 0 ? ME_SHARP : 0) | ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0) | ((BM_edge_is_wire(NULL, eed)) ? ME_LOOSEEDGE : 0) | /* not typical */ (ME_EDGEDRAW | ME_EDGERENDER) diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 21bd24dafde..246c8a4655b 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -79,7 +79,7 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v) return TRUE; } - if (BM_vert_is_nonmanifold(bm, v)) { + if (!BM_vert_is_manifold(bm, v)) { if (!v->e) BM_vert_kill(bm, v); else if (!v->e->l) { BM_edge_kill(bm, v->e); @@ -101,7 +101,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v) BMEdge *e, *keepedge = NULL, *baseedge = NULL; int len = 0; - if (BM_vert_is_nonmanifold(bm, v)) { + if (!BM_vert_is_manifold(bm, v)) { return FALSE; } diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index e9df584e5a6..089bc79e25d 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -338,7 +338,7 @@ int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e) * 1 for true, 0 for false. */ -int BM_vert_is_nonmanifold(BMesh *UNUSED(bm), BMVert *v) +int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v) { BMEdge *e, *oe; BMLoop *l; @@ -346,7 +346,7 @@ int BM_vert_is_nonmanifold(BMesh *UNUSED(bm), BMVert *v) if (v->e == NULL) { /* loose vert */ - return TRUE; + return FALSE; } /* count edges while looking for non-manifold edges */ @@ -354,12 +354,12 @@ int BM_vert_is_nonmanifold(BMesh *UNUSED(bm), BMVert *v) for (len = 0, e = v->e; e != oe || (e == oe && len == 0); len++, e = bmesh_disk_nextedge(e, v)) { if (e->l == NULL) { /* loose edge */ - return TRUE; + return FALSE; } if (bmesh_radial_length(e->l) > 2) { /* edge shared by more than two faces */ - return TRUE; + return FALSE; } } @@ -392,10 +392,10 @@ int BM_vert_is_nonmanifold(BMesh *UNUSED(bm), BMVert *v) if (count < len) { /* vert shared by multiple regions */ - return TRUE; + return FALSE; } - return FALSE; + return TRUE; } /* @@ -409,13 +409,13 @@ int BM_vert_is_nonmanifold(BMesh *UNUSED(bm), BMVert *v) * 1 for true, 0 for false. */ -int BM_edge_is_nonmanifold(BMesh *UNUSED(bm), BMEdge *e) +int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e) { int count = BM_edge_face_count(e); if (count != 2 && count != 1) { - return TRUE; + return FALSE; } - return FALSE; + return TRUE; } /* diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 345c3358677..e6bcbf405fe 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -268,7 +268,7 @@ static void *islandboundWalker_step(BMWalker *walker) if (iwalk->lastv == e->v1) v = e->v2; else v = e->v1; - if (BM_vert_is_nonmanifold(walker->bm, v)) { + if (!BM_vert_is_manifold(walker->bm, v)) { BMW_reset(walker); BMO_error_raise(walker->bm, NULL, BMERR_WALKER_FAILED, "Non-manifold vert " @@ -561,7 +561,7 @@ static int faceloopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) } /* Don't start a face loop from non-manifold edges */ - if (BM_edge_is_nonmanifold(bm, e)) { + if (!BM_edge_is_manifold(bm, e)) { return FALSE; } @@ -719,7 +719,7 @@ static void *edgeringWalker_step(BMWalker *walker) return lwalk->wireedge; e = l->e; - if (BM_edge_is_nonmanifold(bm, e)) { + if (!BM_edge_is_manifold(bm, e)) { /* walker won't traverse to a non-manifold edge, but may * be started on one, and should not traverse *away* from * a non-manfold edge (non-manifold edges are never in an @@ -730,12 +730,12 @@ static void *edgeringWalker_step(BMWalker *walker) l = l->radial_next; l = l->next->next; - if ((l->f->len != 4) || BM_edge_is_nonmanifold(bm, l->e)) { + if ((l->f->len != 4) || !BM_edge_is_manifold(bm, l->e)) { l = lwalk->l->next->next; } /* only walk to manifold edge */ - if ((l->f->len == 4) && !BM_edge_is_nonmanifold(bm, l->e) && + if ((l->f->len == 4) && BM_edge_is_manifold(bm, l->e) && !BLI_ghash_haskey(walker->visithash, l->e)) { lwalk = BMW_state_add(walker); lwalk->l = l; diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 71dd8cf7e7e..b6a87e604ec 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -410,7 +410,7 @@ static void calc_solidify_normals(BMesh *bm) edge_face_count = NULL; /* dont re-use */ BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { - if (BM_vert_is_nonmanifold(bm, v)) { + if (!BM_vert_is_manifold(bm, v)) { BMO_elem_flag_enable(bm, v, VERT_NONMAN); continue; } diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 91910aa280a..921c579447b 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -285,7 +285,7 @@ void bmesh_jointriangles_exec(BMesh *bm, BMOperator *op) v3 = e->l->next->v; v4 = e->l->radial_next->prev->v; - if (dosharp && BM_elem_flag_test(e, BM_ELEM_SHARP)) + if (dosharp && !BM_elem_flag_test(e, BM_ELEM_SMOOTH)) continue; if ((douvs || dovcols) && compareFaceAttribs(bm, e, douvs, dovcols)) diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index b660ebbb5fc..e0187476a6a 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -835,7 +835,7 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op) break; case SIMEDGE_SHARP: - if (BM_elem_flag_test(e, BM_ELEM_SHARP) == BM_elem_flag_test(es, BM_ELEM_SHARP)) { + if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == BM_elem_flag_test(es, BM_ELEM_SMOOTH)) { BMO_elem_flag_enable(bm, e, EDGE_MARK); cont = 0; } diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index ef99b30fd0b..b20b7316eb4 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -133,7 +133,7 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v) BMEdge *e, *elast; BMLoop *l1, *l2; - if (BM_vert_is_nonmanifold(bm, v)) { + if (!BM_vert_is_manifold(bm, v)) { return 0; } @@ -836,7 +836,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); if(v->e){ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); - if (BM_vert_is_nonmanifold(bm, v)) + if (!BM_vert_is_manifold(bm, v)) BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN); /* test wire ver */ len = BM_vert_edge_count(v); @@ -849,7 +849,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG); - if (BM_edge_is_nonmanifold(bm, e)) { + if (!BM_edge_is_manifold(bm, e)) { BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_NONMAN); BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_NONMAN); BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 6f4b4fff369..b0440eeb14f 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -1196,7 +1196,7 @@ static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e) case EDGE_MODE_TAG_SEAM: return BM_elem_flag_test(e, BM_ELEM_SEAM); case EDGE_MODE_TAG_SHARP: - return BM_elem_flag_test(e, BM_ELEM_SHARP); + return !BM_elem_flag_test(e, BM_ELEM_SMOOTH); case EDGE_MODE_TAG_CREASE: return BM_elem_float_data_get(&em->bm->edata, e, CD_CREASE) ? 1 : 0; case EDGE_MODE_TAG_BEVEL: @@ -2328,7 +2328,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op) } BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (!BM_elem_flag_test(em->bm, BM_ELEM_HIDDEN) && BM_vert_is_nonmanifold(em->bm, v)) { + if (!BM_elem_flag_test(em->bm, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(em->bm, v)) { BM_elem_select_set(em->bm, v, TRUE); } } diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index be7efd54477..63834815f42 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -1102,7 +1102,7 @@ static int editbmesh_mark_sharp(bContext *C, wmOperator *op) if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) continue; - BM_elem_flag_enable(eed, BM_ELEM_SHARP); + BM_elem_flag_disable(eed, BM_ELEM_SMOOTH); } } else { @@ -1110,7 +1110,7 @@ static int editbmesh_mark_sharp(bContext *C, wmOperator *op) if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) continue; - BM_elem_flag_disable(eed, BM_ELEM_SHARP); + BM_elem_flag_enable(eed, BM_ELEM_SMOOTH); } } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 0dfb2f032f2..8baba5a1ee2 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2448,7 +2448,7 @@ static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index) { BMEdge *eed = EDBM_get_edge_for_index(userData, index); - return !BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_SHARP); + return !BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && !BM_elem_flag_test(eed, BM_ELEM_SMOOTH); } static void draw_dm_edges_sharp(BMEditMesh *em, DerivedMesh *dm) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c1e7e6cd04c..0df2a70302a 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3452,7 +3452,7 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op) if(mark_seams) BM_elem_flag_enable(editedge, BM_ELEM_SEAM); if(mark_sharp) - BM_elem_flag_enable(editedge, BM_ELEM_SHARP); + BM_elem_flag_disable(editedge, BM_ELEM_SMOOTH); } } diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index ed52ebe47ba..14b54be8be1 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -88,8 +88,9 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj if (emd->flags & MOD_EDGESPLIT_FROMFLAG) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(e, BM_ELEM_SHARP)) + if (!BM_elem_flag_test(e, BM_ELEM_SMOOTH)) { BMO_elem_flag_enable(bm, e, EDGE_MARK); + } } } |