From c30fb009ccf23cd9dc78d342ebddc2286594c88a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Feb 2013 15:57:12 +0000 Subject: problem with own changes to triabgulate: calling beauty fill directly would re-allocate the faces which mean't triangulates output slots pointers became invalid. (noticed when using from py api) --- source/blender/bmesh/intern/bmesh_opdefines.c | 2 +- source/blender/bmesh/intern/bmesh_operators.c | 6 +++--- source/blender/bmesh/operators/bmo_triangulate.c | 14 ++++---------- 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 4147da82363..75439638fe1 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1436,7 +1436,7 @@ static BMOpDefine bmo_beautify_fill_def = { "beautify_fill", /* slots_in */ {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"constrain_edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can't be flipped */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can be flipped */ {{'\0'}}, }, /* slots_out */ diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 3308a014d25..98958596324 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -562,7 +562,7 @@ static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag, BMElemF *ele_f; int i; - BLI_assert(ELEM(true, false, test_for_enabled)); + BLI_assert((unsigned int)test_for_enabled <= 1); for (i = 0; i < 3; i++) { if (htype & flag_types[i]) { @@ -938,7 +938,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, int totelement, i = 0; BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args); - BLI_assert(ELEM(true, false, test_for_enabled)); + BLI_assert((unsigned int)test_for_enabled <= 1); if (test_for_enabled) totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag); @@ -1586,7 +1586,7 @@ static int bmo_opname_to_opcode(const char *opname) * **Utility** * * Pass an existing slot which is copied to either an input or output slot. - * Taking the operator and slot-name pair of args. + * Taking the operator and slot-name pair of args (BMOperator *, const char *). * - `s` - slot_in (lower case) * - `S` - slot_out (upper case) * diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index e06929e339d..1007e0529bf 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -51,12 +51,6 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op) BM_mesh_triangulate(bm, use_beauty, true, op, slot_facemap_out); - if (use_beauty) { - BMO_op_callf(bm, op->flag, - "beautify_fill faces=%hf constrain_edges=%He", - BM_ELEM_TAG, BM_ELEM_TAG); - } - BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG); BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG); } @@ -69,7 +63,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) BMEdge *e; int stop = 0; - BMO_slot_buffer_flag_enable(bm, op->slots_in, "constrain_edges", BM_EDGE, EDGE_MARK); + BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK); BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { if (f->len == 3) { @@ -83,7 +77,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMVert *v1, *v2, *v3, *v4; - if (!BM_edge_is_manifold(e) || BMO_elem_flag_test(bm, e, EDGE_MARK)) { + if (!BM_edge_is_manifold(e) || !BMO_elem_flag_test(bm, e, EDGE_MARK)) { continue; } @@ -123,7 +117,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) if (fac1 > fac2) { e = BM_edge_rotate(bm, e, false, BM_EDGEROT_CHECK_EXISTS); if (e) { - BMO_elem_flag_enable(bm, e, ELE_NEW); + BMO_elem_flag_enable(bm, e, ELE_NEW | EDGE_MARK); BMO_elem_flag_enable(bm, e->l->f, FACE_MARK | ELE_NEW); BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK | ELE_NEW); @@ -194,7 +188,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) BLI_smallhash_release(&hash); /* clean up fill */ - BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK); + BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff edges=%Fe", ELE_NEW, EDGE_MARK); BMO_op_exec(bm, &bmop); BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, ELE_NEW); BMO_op_finish(bm, &bmop); -- cgit v1.2.3