From b27854bd47104300a484e3b06185b2cb1fa0b774 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Jan 2013 16:42:43 +0000 Subject: use booleans for bmesh api. --- .../blender/bmesh/operators/bmo_join_triangles.c | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'source/blender/bmesh/operators/bmo_join_triangles.c') diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 45ecdee014e..e052968a6a0 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -105,7 +105,7 @@ static float measure_facepair(BMVert *v1, BMVert *v2, #define T2QUV_LIMIT 0.005f #define T2QCOL_LIMIT 3 -static int bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const int do_uv, const int do_tf, const int do_vcol) +static bool bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const bool do_uv, const bool do_tf, const bool do_vcol) { /* first get loops */ BMLoop *l[4]; @@ -138,7 +138,7 @@ static int bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const int do_uv, const int do if (luv[0] && (!compare_v2v2(luv[0]->uv, luv[2]->uv, T2QUV_LIMIT) || !compare_v2v2(luv[1]->uv, luv[3]->uv, T2QUV_LIMIT))) { - return FALSE; + return false; } } @@ -149,7 +149,7 @@ static int bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const int do_uv, const int do }; if (tp[0] && (tp[0]->tpage != tp[1]->tpage)) { - return FALSE; + return false; } } @@ -166,12 +166,12 @@ static int bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const int do_uv, const int do if (!compare_rgb_uchar((unsigned char *)&lcol[0]->r, (unsigned char *)&lcol[2]->r, T2QCOL_LIMIT) || !compare_rgb_uchar((unsigned char *)&lcol[1]->r, (unsigned char *)&lcol[3]->r, T2QCOL_LIMIT)) { - return FALSE; + return false; } } } - return TRUE; + return true; } typedef struct JoinEdge { @@ -197,6 +197,13 @@ static int fplcmp(const void *v1, const void *v2) void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) { + const bool do_sharp = BMO_slot_bool_get(op->slots_in, "cmp_sharp"); + const bool do_uv = BMO_slot_bool_get(op->slots_in, "cmp_uvs"); + const bool do_tf = do_uv; /* texture face, make make its own option eventually */ + const bool do_vcol = BMO_slot_bool_get(op->slots_in, "cmp_vcols"); + const bool do_mat = BMO_slot_bool_get(op->slots_in, "cmp_materials"); + const float limit = BMO_slot_float_get(op->slots_in, "limit"); + BMIter iter, liter; BMOIter siter; BMFace *f; @@ -204,12 +211,6 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) BMEdge *e; BLI_array_declare(jedges); JoinEdge *jedges = NULL; - int do_sharp = BMO_slot_bool_get(op->slots_in, "cmp_sharp"); - int do_uv = BMO_slot_bool_get(op->slots_in, "cmp_uvs"); - int do_tf = do_uv; /* texture face, make make its own option eventually */ - int do_vcol = BMO_slot_bool_get(op->slots_in, "cmp_vcols"); - int do_mat = BMO_slot_bool_get(op->slots_in, "cmp_materials"); - float limit = BMO_slot_float_get(op->slots_in, "limit"); int i, totedge; /* flag all edges of all input face */ @@ -265,7 +266,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) if (do_mat && f1->mat_nr != f2->mat_nr) continue; - if ((do_uv || do_tf || do_vcol) && (bm_edge_faces_cmp(bm, e, do_uv, do_tf, do_vcol) == FALSE)) + if ((do_uv || do_tf || do_vcol) && (bm_edge_faces_cmp(bm, e, do_uv, do_tf, do_vcol) == false)) continue; measure = measure_facepair(v1, v2, v3, v4, limit); @@ -308,7 +309,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) BM_edge_face_pair(e, &f1, &f2); /* checked above */ - BM_faces_join_pair(bm, f1, f2, e, TRUE); + BM_faces_join_pair(bm, f1, f2, e, true); } BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { @@ -342,7 +343,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) continue; } - BM_faces_join_pair(bm, f1, f2, e, TRUE); + BM_faces_join_pair(bm, f1, f2, e, true); } } -- cgit v1.2.3