Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-14 20:42:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-14 20:42:43 +0400
commitb27854bd47104300a484e3b06185b2cb1fa0b774 (patch)
tree3be00fa743238e3a50283f56d595d978ed36667b /source
parent6cdbd1b1aaae0f8b3018ecf2648699a0ea6d6be8 (diff)
use booleans for bmesh api.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_tessmesh.h2
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c14
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c95
-rw-r--r--source/blender/bmesh/intern/bmesh_core.h21
-rw-r--r--source/blender/bmesh/intern/bmesh_error.h6
-rw-r--r--source/blender/bmesh/intern/bmesh_inline.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c8
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators_inline.h26
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c134
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.h36
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c22
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c18
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c150
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.h24
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h16
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api_inline.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c72
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c54
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c170
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h50
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.c70
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.h16
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c68
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_private.h6
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c4
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c6
-rw-r--r--source/blender/bmesh/operators/bmo_create.c40
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c46
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c8
-rw-r--r--source/blender/bmesh/operators/bmo_edgesplit.c8
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c32
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c32
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c32
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c29
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_conv.c10
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c10
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c44
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c10
-rw-r--r--source/blender/bmesh/operators/bmo_similar.c52
-rw-r--r--source/blender/bmesh/operators/bmo_smooth_laplacian.c6
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c26
-rw-r--r--source/blender/bmesh/operators/bmo_symmetrize.c30
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c6
-rw-r--r--source/blender/bmesh/operators/bmo_unsubdivide.c2
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c37
-rw-r--r--source/blender/bmesh/operators/bmo_wireframe.c36
-rw-r--r--source/blender/bmesh/tools/BME_bevel.c42
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate.h8
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_collapse.c82
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_dissolve.c12
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c40
-rw-r--r--source/blender/bmesh/tools/bmesh_edgesplit.c14
-rw-r--r--source/blender/bmesh/tools/bmesh_edgesplit.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c6
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c66
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.h2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.c14
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.c18
75 files changed, 982 insertions, 974 deletions
diff --git a/source/blender/blenkernel/BKE_tessmesh.h b/source/blender/blenkernel/BKE_tessmesh.h
index 9462822e25f..b3e6ab37273 100644
--- a/source/blender/blenkernel/BKE_tessmesh.h
+++ b/source/blender/blenkernel/BKE_tessmesh.h
@@ -83,7 +83,7 @@ typedef struct BMEditMesh {
} BMEditMesh;
void BMEdit_RecalcTessellation(BMEditMesh *em);
-BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate);
+BMEditMesh *BMEdit_Create(BMesh *bm, const bool do_tessellate);
BMEditMesh *BMEdit_Copy(BMEditMesh *em);
BMEditMesh *BMEdit_FromObject(struct Object *ob);
void BMEdit_Free(BMEditMesh *em);
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 91577320a9c..0197cc3fa77 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -69,7 +69,7 @@
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
-BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate)
+BMEditMesh *BMEdit_Create(BMesh *bm, const bool do_tessellate)
{
BMEditMesh *em = MEM_callocN(sizeof(BMEditMesh), __func__);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 267cf1738b0..79cbd2ef886 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -533,7 +533,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
bm = BM_mesh_create(&bm_mesh_allocsize_default);
- BM_mesh_bm_from_me(bm, me, TRUE, ob->shapenr);
+ BM_mesh_bm_from_me(bm, me, true, ob->shapenr);
return bm;
}
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 791288a4dda..bb22175e2ad 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -295,7 +295,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index, BMVert *v1,
/* Note: passing NULL for the 'example' parameter, profiling shows
* a small performance bump */
- f = BM_face_create_quad_tri(bvh->bm, v1, v2, v3, NULL, NULL, TRUE);
+ f = BM_face_create_quad_tri(bvh->bm, v1, v2, v3, NULL, NULL, true);
if (!BLI_ghash_haskey(bvh->bm_face_to_node, f)) {
BLI_ghash_insert(bvh->nodes[node_index].bm_faces, f, NULL);
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 31f795823b1..fddb7b4bf2c 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -53,7 +53,7 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
* \brief Make Quad/Triangle
*
* Creates a new quad or triangle from a list of 3 or 4 vertices.
- * If \a nodouble is TRUE, then a check is done to see if a face
+ * If \a no_double is true, then a check is done to see if a face
* with these vertices already exists and returns it instead.
*
* If a pointer to an example face is provided, it's custom data
@@ -65,16 +65,16 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
BMFace *BM_face_create_quad_tri(BMesh *bm,
BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
- const BMFace *example, const int nodouble)
+ const BMFace *example, const bool no_double)
{
BMVert *vtar[4] = {v1, v2, v3, v4};
- return BM_face_create_quad_tri_v(bm, vtar, v4 ? 4 : 3, example, nodouble);
+ return BM_face_create_quad_tri_v(bm, vtar, v4 ? 4 : 3, example, no_double);
}
-BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const int nodouble)
+BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const bool no_double)
{
BMFace *f = NULL;
- int is_overlap = FALSE;
+ bool is_overlap = false;
/* sanity check - debug mode only */
if (len == 3) {
@@ -97,7 +97,7 @@ BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFa
}
- if (nodouble) {
+ if (no_double) {
/* check if face exists or overlaps */
is_overlap = BM_face_exists(verts, len, &f);
}
@@ -793,7 +793,7 @@ void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *sour
/* First we copy select */
if (BM_elem_flag_test((BMElem *)sheader, BM_ELEM_SELECT)) {
- BM_elem_select_set(target_mesh, (BMElem *)target, TRUE);
+ BM_elem_select_set(target_mesh, (BMElem *)target, true);
}
/* Now we copy flags */
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
index 60c465e5f5a..0f597dbb1d8 100644
--- a/source/blender/bmesh/intern/bmesh_construct.h
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -29,10 +29,10 @@
BMFace *BM_face_create_quad_tri_v(BMesh *bm,
BMVert **verts, int len,
- const BMFace *example, const int nodouble);
+ const BMFace *example, const bool no_double);
BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
- const BMFace *example, const int nodouble);
+ const BMFace *example, const bool no_double);
void BM_face_copy_shared(BMesh *bm, BMFace *f);
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index ea9ab364b84..a2f2a9a0dba 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -109,7 +109,7 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, cons
* \brief Main function for creating a new edge.
*
* \note Duplicate edges are supported by the API however users should _never_ see them.
- * so unless you need a unique edge or know the edge won't exist, you should call with \a nodouble = TRUE
+ * so unless you need a unique edge or know the edge won't exist, you should call with \a no_double = true
*/
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, const eBMCreateFlag create_flag)
{
@@ -209,7 +209,8 @@ static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge
return l;
}
-BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges)
+BMFace *BM_face_copy(BMesh *bm, BMFace *f,
+ const bool copy_verts, const bool copy_edges)
{
BMVert **verts = BLI_array_alloca(verts, f->len);
BMEdge **edges = BLI_array_alloca(edges, f->len);
@@ -222,7 +223,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
i = 0;
do {
- if (copyverts) {
+ if (copy_verts) {
verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v, 0);
}
else {
@@ -234,7 +235,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
i = 0;
do {
- if (copyedges) {
+ if (copy_edges) {
BMVert *v1, *v2;
if (l_iter->e->v1 == verts[i]) {
@@ -734,7 +735,7 @@ static int UNUSED_FUNCTION(bm_loop_length)(BMLoop *l)
*
* \return Success
*/
-static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
+static bool bm_loop_reverse_loop(BMesh *bm, BMFace *f
#ifdef USE_BMESH_HOLES
, BMLoopList *lst
#endif
@@ -748,7 +749,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
#endif
const int len = f->len;
- const int do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
+ const bool do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
BMLoop *l_iter, *oldprev, *oldnext;
BMEdge **edar = BLI_array_alloca(edar, len);
int i, j, edok;
@@ -816,13 +817,13 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
BM_CHECK_ELEMENT(f);
- return 1;
+ return true;
}
/**
* \brief Flip the faces direction
*/
-int bmesh_loop_reverse(BMesh *bm, BMFace *f)
+bool bmesh_loop_reverse(BMesh *bm, BMFace *f)
{
#ifdef USE_BMESH_HOLES
return bm_loop_reverse_loop(bm, f, f->loops.first);
@@ -893,26 +894,26 @@ static int UNUSED_FUNCTION(count_flagged_disk)(BMVert *v, int flag)
return i;
}
-static int disk_is_flagged(BMVert *v, int flag)
+static bool disk_is_flagged(BMVert *v, int flag)
{
BMEdge *e = v->e;
if (!e)
- return FALSE;
+ return false;
do {
BMLoop *l = e->l;
if (!l) {
- return FALSE;
+ return false;
}
if (bmesh_radial_length(l) == 1)
- return FALSE;
+ return false;
do {
if (!BM_ELEM_API_FLAG_TEST(l->f, flag))
- return FALSE;
+ return false;
l = l->radial_next;
} while (l != e->l);
@@ -920,7 +921,7 @@ static int disk_is_flagged(BMVert *v, int flag)
e = bmesh_disk_edge_next(e, v);
} while (e != v->e);
- return TRUE;
+ return true;
}
/* Mid-level Topology Manipulation Functions */
@@ -939,7 +940,7 @@ static int disk_is_flagged(BMVert *v, int flag)
* \note this is a generic, flexible join faces function,
* almost everything uses this, including #BM_faces_join_pair
*/
-BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del)
+BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
{
BMFace *f, *newf;
#ifdef USE_BMESH_HOLES
@@ -1198,7 +1199,7 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
ListBase *holes,
#endif
BMEdge *example,
- const short nodouble
+ const bool no_double
)
{
#ifdef USE_BMESH_HOLES
@@ -1225,7 +1226,7 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
}
/* allocate new edge between v1 and v2 */
- e = BM_edge_create(bm, v1, v2, example, nodouble ? BM_CREATE_NO_DOUBLE : 0);
+ e = BM_edge_create(bm, v1, v2, example, no_double ? BM_CREATE_NO_DOUBLE : 0);
f2 = bm_face_create__sfme(bm, f);
f1loop = bm_loop_create(bm, v2, e, f, v2loop, 0);
@@ -1351,9 +1352,10 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
BMLoop *nextl;
BMEdge *ne;
BMVert *nv, *ov;
- int i, edok, valence1 = 0, valence2 = 0;
+ int i, valence1 = 0, valence2 = 0;
+ bool edok;
- BLI_assert(bmesh_vert_in_edge(e, tv) != FALSE);
+ BLI_assert(bmesh_vert_in_edge(e, tv) != false);
ov = bmesh_edge_other_vert_get(e, tv);
@@ -1384,11 +1386,11 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
/* verify disk cycles */
edok = bmesh_disk_validate(valence1, ov->e, ov);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
edok = bmesh_disk_validate(valence2, tv->e, tv);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
edok = bmesh_disk_validate(2, nv->e, nv);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
/* Split the radial cycle if present */
nextl = e->l;
@@ -1454,9 +1456,9 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
/* verify length of radial cycle */
edok = bmesh_radial_validate(radlen, e->l);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
edok = bmesh_radial_validate(radlen, ne->l);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
/* verify loop->v and loop->next->v pointers for e */
for (i = 0, l = e->l; i < radlen; i++, l = l->radial_next) {
@@ -1465,7 +1467,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
BMESH_ASSERT(!(l->prev->e != ne && l->next->e != ne));
edok = bmesh_verts_in_edge(l->v, l->next->v, e);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
BMESH_ASSERT(l->v != l->next->v);
BMESH_ASSERT(l->e != l->next->e);
@@ -1481,7 +1483,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
// BMESH_ASSERT(l->radial_next == l);
BMESH_ASSERT(!(l->prev->e != e && l->next->e != e));
edok = bmesh_verts_in_edge(l->v, l->next->v, ne);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
BMESH_ASSERT(l->v != l->next->v);
BMESH_ASSERT(l->e != l->next->e);
@@ -1533,12 +1535,13 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
* faces with just 2 edges. It is up to the caller to decide what to do with
* these faces.
*/
-BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_double)
+BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const bool check_edge_double)
{
BMEdge *oe;
BMVert *ov, *tv;
BMLoop *killoop, *l;
- int len, radlen = 0, halt = 0, i, valence1, valence2, edok;
+ int len, radlen = 0, i, valence1, valence2;
+ bool edok, halt = false;
if (bmesh_vert_in_edge(ke, kv) == 0) {
return NULL;
@@ -1617,7 +1620,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
/* Validate radial cycle of oe */
edok = bmesh_radial_validate(radlen, oe->l);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
}
/* deallocate edge */
@@ -1628,17 +1631,17 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
/* Validate disk cycle lengths of ov, tv are unchanged */
edok = bmesh_disk_validate(valence1, ov->e, ov);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
edok = bmesh_disk_validate(valence2, tv->e, tv);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
/* Validate loop cycle of all faces attached to 'oe' */
for (i = 0, l = oe->l; i < radlen; i++, l = l->radial_next) {
BMESH_ASSERT(l->e == oe);
edok = bmesh_verts_in_edge(l->v, l->next->v, oe);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
edok = bmesh_loop_validate(l->f);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
BM_CHECK_ELEMENT(l);
BM_CHECK_ELEMENT(l->v);
@@ -1806,7 +1809,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
/* validate the new loop cycle */
edok = bmesh_loop_validate(f1);
- BMESH_ASSERT(edok != FALSE);
+ BMESH_ASSERT(edok != false);
return f1;
}
@@ -1822,7 +1825,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
* where \a v and \a vtarget are connected by an edge
* (assert checks for this case).
*/
-int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
+bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
{
void *loops_stack[BM_DEFAULT_ITER_STACK_SIZE];
BMLoop **loops;
@@ -1832,7 +1835,7 @@ int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
/* verts already spliced */
if (v == v_target) {
- return FALSE;
+ return false;
}
/* we can't modify the vert while iterating so first allocate an array of loops */
@@ -1862,7 +1865,7 @@ int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
/* v is unused now, and can be killed */
BM_vert_kill(bm, v);
- return TRUE;
+ return true;
}
/**
@@ -1876,7 +1879,7 @@ int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
*
* \return Success
*/
-int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
+bool bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
{
BMEdge **stack = NULL;
BLI_array_staticdeclare(stack, BM_DEFAULT_ITER_STACK_SIZE);
@@ -1993,13 +1996,13 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
MEM_freeN(verts);
}
- return TRUE;
+ return true;
}
/**
* High level function which wraps both #bmesh_vert_separate and #bmesh_edge_separate
*/
-int BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
+bool BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len)
{
int i;
@@ -2023,7 +2026,7 @@ int BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
*
* \note Edges must already have the same vertices.
*/
-int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
+bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
{
BMLoop *l;
@@ -2034,7 +2037,7 @@ int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
* so assert on release builds */
BLI_assert(0);
- return FALSE;
+ return false;
}
while (e->l) {
@@ -2053,7 +2056,7 @@ int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
/* removes from disks too */
BM_edge_kill(bm, e);
- return TRUE;
+ return true;
}
/**
@@ -2067,7 +2070,7 @@ int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
* \note Does nothing if \a l_sep is already the only loop in the
* edge radial.
*/
-int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
+bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
{
BMEdge *ne;
int radlen;
@@ -2078,7 +2081,7 @@ int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
radlen = bmesh_radial_length(e->l);
if (radlen < 2) {
/* no cut required */
- return TRUE;
+ return true;
}
if (l_sep == e->l) {
@@ -2096,7 +2099,7 @@ int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
BM_CHECK_ELEMENT(ne);
BM_CHECK_ELEMENT(e);
- return TRUE;
+ return true;
}
/**
diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h
index 5fd4a6ec7df..d8cfc973394 100644
--- a/source/blender/bmesh/intern/bmesh_core.h
+++ b/source/blender/bmesh/intern/bmesh_core.h
@@ -27,7 +27,8 @@
* \ingroup bmesh
*/
-BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges);
+BMFace *BM_face_copy(BMesh *bm, BMFace *f,
+ const bool copy_verts, const bool copy_edges);
typedef enum eBMCreateFlag {
/* faces and edges only */
@@ -49,16 +50,16 @@ void BM_face_kill(BMesh *bm, BMFace *f);
void BM_edge_kill(BMesh *bm, BMEdge *e);
void BM_vert_kill(BMesh *bm, BMVert *v);
-int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep);
-int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target);
-int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target);
+bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep);
+bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target);
+bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target);
-int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len);
+bool bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len);
-int bmesh_loop_reverse(BMesh *bm, BMFace *f);
+bool bmesh_loop_reverse(BMesh *bm, BMFace *f);
-BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del);
-int BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
+BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del);
+bool BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len);
/* EULER API - For modifying structure */
@@ -68,11 +69,11 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1,
ListBase *holes,
#endif
BMEdge *example,
- const short nodouble
+ const bool no_double
);
BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e);
-BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_splice);
+BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const bool check_edge_splice);
BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
BMVert *bmesh_urmv(BMesh *bm, BMFace *sf, BMVert *sv);
BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *sl);
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index 2ef146c7b38..0f23f87c143 100644
--- a/source/blender/bmesh/intern/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -35,11 +35,11 @@ void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
/* gets the topmost error from the stack.
* returns error code or 0 if no error.*/
-int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op);
-int BMO_error_occurred(BMesh *bm);
+int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op);
+bool BMO_error_occurred(BMesh *bm);
/* same as geterror, only pops the error off the stack as well */
-int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op);
+int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op);
void BMO_error_clear(BMesh *bm);
/* this is meant for handling errors, like self-intersection test failures.
diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
index 04b214f725a..102e9d47ffd 100644
--- a/source/blender/bmesh/intern/bmesh_inline.h
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -44,7 +44,7 @@ BLI_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag)
return head->hflag & hflag;
}
-BLI_INLINE short _bm_elem_flag_test_bool(const BMHeader *head, const char hflag)
+BLI_INLINE bool _bm_elem_flag_test_bool(const BMHeader *head, const char hflag)
{
return (head->hflag & hflag) != 0;
}
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 1afaf851e2a..44b8baace4c 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -599,7 +599,7 @@ void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source)
* if do_vertex is true, target's vert data will also get interpolated.
*/
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
- int do_vertex, int do_multires)
+ const bool do_vertex, const bool do_multires)
{
BMLoop *l_iter;
BMLoop *l_first;
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
index 8be963f5798..3563ed1f40e 100644
--- a/source/blender/bmesh/intern/bmesh_interp.h
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -44,7 +44,7 @@ void BM_elem_float_data_set(CustomData *cd, void *element, int type, const floa
void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source);
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
- int do_vertex, int do_multires);
+ const bool do_vertex, const bool do_multires);
void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f);
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index c3f33eb95e1..44b76df7432 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -164,14 +164,12 @@ void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
*
* Counts how many flagged / unflagged items are found in this element.
*/
-int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const short value)
+int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const bool value)
{
BMIter iter;
BMElem *ele;
int count = 0;
- BLI_assert(ELEM(value, TRUE, FALSE));
-
for (ele = BM_iter_new(&iter, NULL, itype, data); ele; ele = BM_iter_step(&iter)) {
if (BM_elem_flag_test_bool(ele, hflag) == value) {
count++;
@@ -186,14 +184,12 @@ int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, cons
*
* Counts how many flagged / unflagged items are found in this mesh.
*/
-int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const short value)
+int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const bool value)
{
BMIter iter;
BMElem *ele;
int count = 0;
- BLI_assert(ELEM(value, TRUE, FALSE));
-
for (ele = BM_iter_new(&iter, bm, itype, NULL); ele; ele = BM_iter_step(&iter)) {
if (BM_elem_flag_test_bool(ele, hflag) == value) {
count++;
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index 7291bca6356..3b795a253bd 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -131,8 +131,8 @@ void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
__attribute__((warn_unused_result))
#endif
;
-int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const short value);
-int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const short value);
+int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const bool value);
+int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const bool value);
/* private for bmesh_iterators_inline.c */
void bmiter__vert_of_mesh_begin(struct BMIter *iter);
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h
index 96816521493..5bac3eb458f 100644
--- a/source/blender/bmesh/intern/bmesh_iterators_inline.h
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -50,7 +50,7 @@ BLI_INLINE void *BM_iter_step(BMIter *iter)
* it with the appropriate function pointers based
* upon its type.
*/
-BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
+BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
{
/* int argtype; */
iter->itype = itype;
@@ -78,7 +78,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_EDGES_OF_VERT:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__edge_of_vert_begin;
@@ -87,7 +87,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_FACES_OF_VERT:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__face_of_vert_begin;
@@ -96,7 +96,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_LOOPS_OF_VERT:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__loop_of_vert_begin;
@@ -105,7 +105,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_VERTS_OF_EDGE:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__vert_of_edge_begin;
@@ -114,7 +114,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_FACES_OF_EDGE:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__face_of_edge_begin;
@@ -123,7 +123,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_VERTS_OF_FACE:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__vert_of_face_begin;
@@ -132,7 +132,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_EDGES_OF_FACE:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__edge_of_face_begin;
@@ -141,7 +141,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_LOOPS_OF_FACE:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__loop_of_face_begin;
@@ -150,7 +150,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_LOOPS_OF_LOOP:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__loops_of_loop_begin;
@@ -159,7 +159,7 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
break;
case BM_LOOPS_OF_EDGE:
if (UNLIKELY(!data)) {
- return FALSE;
+ return false;
}
iter->begin = bmiter__loops_of_edge_begin;
@@ -169,13 +169,13 @@ BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *dat
default:
/* should never happen */
BLI_assert(0);
- return FALSE;
+ return false;
break;
}
iter->begin(iter);
- return TRUE;
+ return true;
}
/**
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index a2510129df6..afcca88d7e4 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -280,7 +280,7 @@ static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
bm_log_vert_from_id(log, lf->v_ids[2])};
BMFace *f;
- f = BM_face_create_quad_tri_v(bm, v, 3, NULL, FALSE);
+ f = BM_face_create_quad_tri_v(bm, v, 3, NULL, false);
bm_log_face_id_set(log, f, GET_INT_FROM_POINTER(key));
}
}
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index 669be315cc6..66a89c30e92 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -107,18 +107,18 @@ void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode)
#pragma omp section
{
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
- int ok = TRUE;
+ bool ok = true;
if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (!BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT)) {
- ok = FALSE;
+ ok = false;
break;
}
} while ((l_iter = l_iter->next) != l_first);
}
else {
- ok = FALSE;
+ ok = false;
}
BM_elem_flag_set(f, BM_ELEM_SELECT, ok);
@@ -129,18 +129,18 @@ void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode)
}
else if (selectmode & SCE_SELECT_EDGE) {
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
- int ok = TRUE;
+ bool ok = true;
if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (!BM_elem_flag_test(l_iter->e, BM_ELEM_SELECT)) {
- ok = FALSE;
+ ok = false;
break;
}
} while ((l_iter = l_iter->next) != l_first);
}
else {
- ok = FALSE;
+ ok = false;
}
BM_elem_flag_set(f, BM_ELEM_SELECT, ok);
@@ -171,7 +171,7 @@ void BM_mesh_deselect_flush(BMesh *bm)
BMIter eiter;
BMIter fiter;
- int ok;
+ bool ok;
/* we can use 2 sections here because the second loop isnt checking edge selection */
#pragma omp parallel sections if (bm->totedge + bm->totface >= BM_OMP_LIMIT)
@@ -191,21 +191,21 @@ void BM_mesh_deselect_flush(BMesh *bm)
#pragma omp section
{
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
- ok = TRUE;
+ ok = true;
if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (!BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT)) {
- ok = FALSE;
+ ok = false;
break;
}
} while ((l_iter = l_iter->next) != l_first);
}
else {
- ok = FALSE;
+ ok = false;
}
- if (ok == FALSE) {
+ if (ok == false) {
BM_elem_flag_disable(f, BM_ELEM_SELECT);
}
}
@@ -233,7 +233,7 @@ void BM_mesh_select_flush(BMesh *bm)
BMIter eiter;
BMIter fiter;
- int ok;
+ bool ok;
/* we can use 2 sections here because the second loop isnt checking edge selection */
#pragma omp parallel sections if (bm->totedge + bm->totface >= BM_OMP_LIMIT)
@@ -253,18 +253,18 @@ void BM_mesh_select_flush(BMesh *bm)
#pragma omp section
{
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
- ok = TRUE;
+ ok = true;
if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (!BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT)) {
- ok = FALSE;
+ ok = false;
break;
}
} while ((l_iter = l_iter->next) != l_first);
}
else {
- ok = FALSE;
+ ok = false;
}
if (ok) {
@@ -283,7 +283,7 @@ void BM_mesh_select_flush(BMesh *bm)
* Changes selection state of a single vertex
* in a mesh
*/
-void BM_vert_select_set(BMesh *bm, BMVert *v, int select)
+void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
{
BLI_assert(v->head.htype == BM_VERT);
@@ -310,7 +310,7 @@ void BM_vert_select_set(BMesh *bm, BMVert *v, int select)
*
* Changes selection state of a single edge in a mesh.
*/
-void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
+void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
{
BLI_assert(e->head.htype == BM_EDGE);
@@ -322,8 +322,8 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
if (!BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel += 1;
BM_elem_flag_enable(e, BM_ELEM_SELECT);
- BM_vert_select_set(bm, e->v1, TRUE);
- BM_vert_select_set(bm, e->v2, TRUE);
+ BM_vert_select_set(bm, e->v1, true);
+ BM_vert_select_set(bm, e->v2, true);
}
else {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1;
@@ -354,13 +354,13 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
}
if (deselect) {
- BM_vert_select_set(bm, verts[i], FALSE);
+ BM_vert_select_set(bm, verts[i], false);
}
}
}
else {
- BM_vert_select_set(bm, e->v1, FALSE);
- BM_vert_select_set(bm, e->v2, FALSE);
+ BM_vert_select_set(bm, e->v1, false);
+ BM_vert_select_set(bm, e->v2, false);
}
}
@@ -372,7 +372,7 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
* Changes selection state of a single
* face in a mesh.
*/
-void BM_face_select_set(BMesh *bm, BMFace *f, int select)
+void BM_face_select_set(BMesh *bm, BMFace *f, const bool select)
{
BMLoop *l_iter;
BMLoop *l_first;
@@ -391,8 +391,8 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select)
BM_elem_flag_enable(f, BM_ELEM_SELECT);
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
- BM_vert_select_set(bm, l_iter->v, TRUE);
- BM_edge_select_set(bm, l_iter->e, TRUE);
+ BM_vert_select_set(bm, l_iter->v, true);
+ BM_edge_select_set(bm, l_iter->e, true);
} while ((l_iter = l_iter->next) != l_first);
}
else {
@@ -412,7 +412,7 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select)
}
if (!f2) {
- BM_edge_select_set(bm, l->e, FALSE);
+ BM_edge_select_set(bm, l->e, false);
}
}
@@ -426,7 +426,7 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select)
}
if (!e) {
- BM_vert_select_set(bm, l->v, FALSE);
+ BM_vert_select_set(bm, l->v, false);
}
}
}
@@ -467,7 +467,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
- BM_edge_select_set(bm, (BMEdge *)ele, TRUE);
+ BM_edge_select_set(bm, (BMEdge *)ele, true);
}
}
BM_mesh_select_mode_flush(bm);
@@ -481,7 +481,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
#endif
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
- BM_face_select_set(bm, (BMFace *)ele, TRUE);
+ BM_face_select_set(bm, (BMFace *)ele, true);
}
}
BM_mesh_select_mode_flush(bm);
@@ -492,14 +492,12 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
* counts number of elements with flag enabled/disabled
*/
static int bm_mesh_flag_count(BMesh *bm, const char htype, const char hflag,
- const short respecthide, const short test_for_enabled)
+ const short respecthide, const bool test_for_enabled)
{
BMElem *ele;
BMIter iter;
int tot = 0;
- BLI_assert(ELEM(test_for_enabled, TRUE, FALSE));
-
if (htype & BM_VERT) {
for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); ele; ele = BM_iter_step(&iter)) {
if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
@@ -522,21 +520,21 @@ static int bm_mesh_flag_count(BMesh *bm, const char htype, const char hflag,
return tot;
}
-int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, int respecthide)
+int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, const bool respecthide)
{
- return bm_mesh_flag_count(bm, htype, hflag, respecthide, TRUE);
+ return bm_mesh_flag_count(bm, htype, hflag, respecthide, true);
}
-int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, int respecthide)
+int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, const bool respecthide)
{
- return bm_mesh_flag_count(bm, htype, hflag, respecthide, FALSE);
+ return bm_mesh_flag_count(bm, htype, hflag, respecthide, false);
}
/**
* \note use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection
* \note by design, this will not touch the editselection history stuff
*/
-void BM_elem_select_set(BMesh *bm, BMElem *ele, int select)
+void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
{
switch (ele->head.htype) {
case BM_VERT:
@@ -560,12 +558,12 @@ void BM_active_face_set(BMesh *bm, BMFace *efa)
bm->act_face = efa;
}
-BMFace *BM_active_face_get(BMesh *bm, int sloppy, int selected)
+BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
{
- if (bm->act_face && (!selected || BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT))) {
+ if (bm->act_face && (!is_selected || BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT))) {
return bm->act_face;
}
- else if (sloppy) {
+ else if (is_sloppy) {
BMIter iter;
BMFace *f = NULL;
BMEditSelection *ese;
@@ -579,7 +577,7 @@ BMFace *BM_active_face_get(BMesh *bm, int sloppy, int selected)
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
f = NULL;
}
- else if (selected && !BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+ else if (is_selected && !BM_elem_flag_test(f, BM_ELEM_SELECT)) {
f = NULL;
}
else {
@@ -743,20 +741,20 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
/* --- macro wrapped funcs --- */
-int _bm_select_history_check(BMesh *bm, const BMHeader *ele)
+bool _bm_select_history_check(BMesh *bm, const BMHeader *ele)
{
return (BLI_findptr(&bm->selected, ele, offsetof(BMEditSelection, ele)) != NULL);
}
-int _bm_select_history_remove(BMesh *bm, BMHeader *ele)
+bool _bm_select_history_remove(BMesh *bm, BMHeader *ele)
{
BMEditSelection *ese = BLI_findptr(&bm->selected, ele, offsetof(BMEditSelection, ele));
if (ese) {
BLI_freelinkN(&bm->selected, ese);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -800,10 +798,10 @@ void BM_select_history_validate(BMesh *bm)
}
/* utility function */
-int BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
+bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
{
BMEditSelection *ese_last = bm->selected.last;
- BMFace *efa = BM_active_face_get(bm, FALSE, FALSE);
+ BMFace *efa = BM_active_face_get(bm, false, false);
ese->next = ese->prev = NULL;
@@ -828,14 +826,14 @@ int BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
}
else {
ese->ele = NULL;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
- int respecthide, const char hflag_test)
+ const bool respecthide, const char hflag_test)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@@ -851,7 +849,7 @@ void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hfl
if ((htype == (BM_VERT | BM_EDGE | BM_FACE)) &&
(hflag == BM_ELEM_SELECT) &&
- (respecthide == FALSE) &&
+ (respecthide == false) &&
(hflag_test == 0))
{
/* fast path for deselect all, avoid topology loops
@@ -887,7 +885,7 @@ void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hfl
}
if (hflag & BM_ELEM_SELECT) {
- BM_elem_select_set(bm, ele, FALSE);
+ BM_elem_select_set(bm, ele, false);
}
BM_elem_flag_disable(ele, hflag);
}
@@ -897,7 +895,7 @@ void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hfl
}
void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
- int respecthide, const char hflag_test)
+ const bool respecthide, const char hflag_test)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@@ -935,7 +933,7 @@ void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hfla
}
if (hflag & BM_ELEM_SELECT) {
- BM_elem_select_set(bm, ele, TRUE);
+ BM_elem_select_set(bm, ele, true);
}
BM_elem_flag_enable(ele, hflag_nosel);
}
@@ -944,14 +942,14 @@ void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hfla
}
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
- int respecthide)
+ const bool respecthide)
{
/* call with 0 hflag_test */
BM_mesh_elem_hflag_disable_test(bm, htype, hflag, respecthide, 0);
}
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
- int respecthide)
+ const bool respecthide)
{
/* call with 0 hflag_test */
BM_mesh_elem_hflag_enable_test(bm, htype, hflag, respecthide, 0);
@@ -963,7 +961,7 @@ static void vert_flush_hide_set(BMVert *v)
{
BMIter iter;
BMEdge *e;
- int hide = TRUE;
+ bool hide = true;
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
hide = hide && BM_elem_flag_test(e, BM_ELEM_HIDDEN);
@@ -976,7 +974,7 @@ static void edge_flush_hide(BMEdge *e)
{
BMIter iter;
BMFace *f;
- int hide = TRUE;
+ bool hide = true;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
hide = hide && BM_elem_flag_test(f, BM_ELEM_HIDDEN);
@@ -985,13 +983,15 @@ static void edge_flush_hide(BMEdge *e)
BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide);
}
-void BM_vert_hide_set(BMVert *v, int hide)
+void BM_vert_hide_set(BMVert *v, const bool hide)
{
/* vert hiding: vert + surrounding edges and faces */
BMIter iter, fiter;
BMEdge *e;
BMFace *f;
+ BLI_assert(v->head.htype == BM_VERT);
+
BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide);
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
@@ -1003,12 +1003,14 @@ void BM_vert_hide_set(BMVert *v, int hide)
}
}
-void BM_edge_hide_set(BMEdge *e, int hide)
+void BM_edge_hide_set(BMEdge *e, const bool hide)
{
BMIter iter;
BMFace *f;
/* BMVert *v; */
+ BLI_assert(e->head.htype == BM_EDGE);
+
/* edge hiding: faces around the edge */
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide);
@@ -1021,11 +1023,13 @@ void BM_edge_hide_set(BMEdge *e, int hide)
vert_flush_hide_set(e->v2);
}
-void BM_face_hide_set(BMFace *f, int hide)
+void BM_face_hide_set(BMFace *f, const bool hide)
{
BMIter iter;
BMLoop *l;
+ BLI_assert(f->head.htype == BM_FACE);
+
BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide);
BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
@@ -1037,21 +1041,21 @@ void BM_face_hide_set(BMFace *f, int hide)
}
}
-void _bm_elem_hide_set(BMesh *bm, BMHeader *head, int hide)
+void _bm_elem_hide_set(BMesh *bm, BMHeader *head, const bool hide)
{
/* Follow convention of always deselecting before
* hiding an element */
switch (head->htype) {
case BM_VERT:
- if (hide) BM_vert_select_set(bm, (BMVert *)head, FALSE);
+ if (hide) BM_vert_select_set(bm, (BMVert *)head, false);
BM_vert_hide_set((BMVert *)head, hide);
break;
case BM_EDGE:
- if (hide) BM_edge_select_set(bm, (BMEdge *)head, FALSE);
+ if (hide) BM_edge_select_set(bm, (BMEdge *)head, false);
BM_edge_hide_set((BMEdge *)head, hide);
break;
case BM_FACE:
- if (hide) BM_face_select_set(bm, (BMFace *)head, FALSE);
+ if (hide) BM_face_select_set(bm, (BMFace *)head, false);
BM_face_hide_set((BMFace *)head, hide);
break;
default:
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index 8d4397794d5..a3d2d4a6985 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -35,29 +35,29 @@ typedef struct BMEditSelection {
/* geometry hiding code */
#define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide)
-void _bm_elem_hide_set(BMesh *bm, BMHeader *ele, int hide);
-void BM_vert_hide_set(BMVert *v, int hide);
-void BM_edge_hide_set(BMEdge *e, int hide);
-void BM_face_hide_set(BMFace *f, int hide);
+void _bm_elem_hide_set(BMesh *bm, BMHeader *ele, const bool hide);
+void BM_vert_hide_set(BMVert *v, const bool hide);
+void BM_edge_hide_set(BMEdge *e, const bool hide);
+void BM_face_hide_set(BMFace *f, const bool hide);
/* Selection code */
-void BM_elem_select_set(BMesh *bm, BMElem *ele, int select);
+void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select);
void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
- int respecthide, const char hflag_test);
+ const bool respecthide, const char hflag_test);
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
- int respecthide, const char hflag_test);
+ const bool respecthide, const char hflag_test);
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
- int respecthide);
+ const bool respecthide);
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
- int respecthide);
+ const bool respecthide);
/* individual element select functions, BM_elem_select_set is a shortcut for these
* that automatically detects which one to use*/
-void BM_vert_select_set(BMesh *bm, BMVert *v, int select);
-void BM_edge_select_set(BMesh *bm, BMEdge *e, int select);
-void BM_face_select_set(BMesh *bm, BMFace *f, int select);
+void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select);
+void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select);
+void BM_face_select_set(BMesh *bm, BMFace *f, const bool select);
void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode);
@@ -66,12 +66,12 @@ void BM_mesh_select_mode_flush(BMesh *bm);
void BM_mesh_deselect_flush(BMesh *bm);
void BM_mesh_select_flush(BMesh *bm);
-int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, int respecthide);
-int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, int respecthide);
+int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, const bool respecthide);
+int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, const bool respecthide);
/* edit selection stuff */
void BM_active_face_set(BMesh *bm, BMFace *f);
-BMFace *BM_active_face_get(BMesh *bm, int sloppy, int selected);
+BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected);
void BM_editselection_center(BMEditSelection *ese, float r_center[3]);
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
@@ -82,13 +82,13 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]);
#define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
#define BM_select_history_store(bm, ele) _bm_select_history_store(bm, &(ele)->head)
-int _bm_select_history_check(BMesh *bm, const BMHeader *ele);
-int _bm_select_history_remove(BMesh *bm, BMHeader *ele);
+bool _bm_select_history_check(BMesh *bm, const BMHeader *ele);
+bool _bm_select_history_remove(BMesh *bm, BMHeader *ele);
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
void _bm_select_history_store(BMesh *bm, BMHeader *ele);
void BM_select_history_validate(BMesh *bm);
void BM_select_history_clear(BMesh *em);
-int BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
+bool BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
#endif /* __BMESH_MARKING_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 769ede0c2ca..e72ad5dae3c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -261,7 +261,7 @@ void BM_mesh_free(BMesh *bm)
*
* Updates the normals of a mesh.
*/
-void BM_mesh_normals_update(BMesh *bm, const short skip_hidden)
+void BM_mesh_normals_update(BMesh *bm, const bool skip_hidden)
{
BMVert *v;
BMFace *f;
@@ -362,8 +362,8 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from
{
/* switch multires data out of tangent space */
if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
- BMEditMesh *em = BMEdit_Create(bm, FALSE);
- DerivedMesh *dm = CDDM_from_editbmesh(em, TRUE, FALSE);
+ BMEditMesh *em = BMEdit_Create(bm, false);
+ DerivedMesh *dm = CDDM_from_editbmesh(em, true, false);
MDisps *mdisps;
BMFace *f;
BMIter iter;
@@ -455,7 +455,7 @@ void bmesh_edit_end(BMesh *bm, int UNUSED(flag))
#endif
/* compute normals, clear temp flags and flush selections */
- BM_mesh_normals_update(bm, TRUE);
+ BM_mesh_normals_update(bm, true);
BM_mesh_select_mode_flush(bm);
}
@@ -553,12 +553,12 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu
BMIter iter;
BMElem *ele;
int i;
- int is_any_error = 0;
+ bool is_any_error = 0;
for (i = 0; i < 3; i++) {
- const int is_dirty = (flag_types[i] & bm->elem_index_dirty);
+ const bool is_dirty = (flag_types[i] & bm->elem_index_dirty);
int index = 0;
- int is_error = FALSE;
+ bool is_error = false;
int err_val = 0;
int err_idx = 0;
@@ -567,7 +567,7 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu
if (BM_elem_index_get(ele) != index) {
err_val = BM_elem_index_get(ele);
err_idx = index;
- is_error = TRUE;
+ is_error = true;
}
}
@@ -575,13 +575,13 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu
index++;
}
- if ((is_error == TRUE) && (is_dirty == FALSE)) {
- is_any_error = TRUE;
+ if ((is_error == true) && (is_dirty == false)) {
+ is_any_error = true;
fprintf(stderr,
"Invalid Index: at %s, %s, %s[%d] invalid index %d, '%s', '%s'\n",
location, func, type_names[i], err_idx, err_val, msg_a, msg_b);
}
- else if ((is_error == FALSE) && (is_dirty == TRUE)) {
+ else if ((is_error == false) && (is_dirty == true)) {
#if 0 /* mostly annoying */
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 8baba568fb8..35ce1859c2b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -37,7 +37,7 @@ void BM_mesh_free(BMesh *bm);
void BM_mesh_data_free(BMesh *bm);
void BM_mesh_clear(BMesh *bm);
-void BM_mesh_normals_update(BMesh *bm, const short skip_hidden);
+void BM_mesh_normals_update(BMesh *bm, const bool skip_hidden);
void bmesh_edit_begin(BMesh *bm, int type_flag);
void bmesh_edit_end(BMesh *bm, int type_flag);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 26400f4a7c4..d92526fbed2 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -163,7 +163,7 @@ char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
}
/* Mesh -> BMesh */
-void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
+void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, bool set_key, int act_key_nr)
{
MVert *mvert;
BLI_array_declare(verts);
@@ -280,7 +280,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
/* this is necessary for selection counts to work properly */
if (mvert->flag & SELECT) {
- BM_vert_select_set(bm, v, TRUE);
+ BM_vert_select_set(bm, v, true);
}
normal_short_to_float_v3(v->no, mvert->no);
@@ -328,7 +328,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
/* this is necessary for selection counts to work properly */
if (medge->flag & SELECT) {
- BM_edge_select_set(bm, e, TRUE);
+ BM_edge_select_set(bm, e, true);
}
/* Copy Custom Data */
@@ -395,7 +395,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
/* this is necessary for selection counts to work properly */
if (mpoly->flag & ME_FACE_SEL) {
- BM_face_select_set(bm, f, TRUE);
+ BM_face_select_set(bm, f, true);
}
f->mat_nr = mpoly->mat_nr;
@@ -549,7 +549,7 @@ BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
}
}
-void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
+void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface)
{
MLoop *mloop;
MPoly *mpoly;
@@ -757,11 +757,11 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
if (vertMap) MEM_freeN(vertMap);
}
- if (dotess) {
+ if (do_tessface) {
BKE_mesh_tessface_calc(me);
}
- mesh_update_customdata_pointers(me, dotess);
+ mesh_update_customdata_pointers(me, do_tessface);
{
BMEditSelection *selected;
@@ -825,12 +825,12 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
* bmesh and the mesh are out of sync */
(oldverts != NULL)) /* not used here, but 'oldverts' is used later for applying 'ofs' */
{
- int act_is_basis = FALSE;
+ bool act_is_basis = false;
/* find if this key is a basis for any others */
for (currkey = me->key->block.first; currkey; currkey = currkey->next) {
if (bm->shapenr - 1 == currkey->relative) {
- act_is_basis = TRUE;
+ act_is_basis = true;
break;
}
}
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.h b/source/blender/bmesh/intern/bmesh_mesh_conv.h
index 55ac39c6745..7fe4b8fe58b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.h
@@ -38,7 +38,7 @@ void BM_mesh_cd_flag_ensure(BMesh *bm, struct Mesh *mesh, const char cd_flag);
void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag);
char BM_mesh_cd_flag_from_bmesh(BMesh *bm);
-void BM_mesh_bm_from_me(BMesh *bm, struct Mesh *me, int set_key, int act_key_nr);
-void BM_mesh_bm_to_me(BMesh *bm, struct Mesh *me, int dotess);
+void BM_mesh_bm_from_me(BMesh *bm, struct Mesh *me, bool set_key, int act_key_nr);
+void BM_mesh_bm_to_me(BMesh *bm, struct Mesh *me, bool do_tessface);
#endif /* __BMESH_MESH_CONV_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c
index 8ab5f10361f..e6eee16e49c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_validate.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c
@@ -49,9 +49,9 @@
/**
* Check of this BMesh is valid, this function can be slow since its intended to help with debugging.
*
- * \return TRUE when the mesh is valid.
+ * \return true when the mesh is valid.
*/
-int BM_mesh_validate(BMesh *bm)
+bool BM_mesh_validate(BMesh *bm)
{
int errtot;
@@ -106,11 +106,11 @@ int BM_mesh_validate(BMesh *bm)
if (l_iter->e != e) {
ERRMSG("edge %d: has invalid loop, loop is of face %d", i, BM_elem_index_get(l_iter->f));
}
- else if (BM_vert_in_edge(e, l_iter->v) == FALSE) {
+ else if (BM_vert_in_edge(e, l_iter->v) == false) {
ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d",
i, BM_elem_index_get(l_iter->f));
}
- else if (BM_vert_in_edge(e, l_iter->next->v) == FALSE) {
+ else if (BM_vert_in_edge(e, l_iter->next->v) == false) {
ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d",
i, BM_elem_index_get(l_iter->f));
}
@@ -181,7 +181,7 @@ int BM_mesh_validate(BMesh *bm)
ERRMSG("Finished - errors %d", errtot);
- return TRUE;
+ return true;
}
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.h b/source/blender/bmesh/intern/bmesh_mesh_validate.h
index 6839dc74d25..f89141387d8 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_validate.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.h
@@ -30,6 +30,6 @@
* \ingroup bmesh
*/
-int BM_mesh_validate(BMesh *bm);
+bool BM_mesh_validate(BMesh *bm);
#endif /* __BMESH_MESH_VALIDATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index 9a99d5b96d1..d98598cac89 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -64,36 +64,36 @@
* \note dissolves vert, in more situations then BM_disk_dissolve
* (e.g. if the vert is part of a wire edge, etc).
*/
-int BM_vert_dissolve(BMesh *bm, BMVert *v)
+bool BM_vert_dissolve(BMesh *bm, BMVert *v)
{
const int len = BM_vert_edge_count(v);
if (len == 1) {
BM_vert_kill(bm, v); /* will kill edges too */
- return TRUE;
+ return true;
}
else if (!BM_vert_is_manifold(v)) {
if (!v->e) {
BM_vert_kill(bm, v);
- return TRUE;
+ return true;
}
else if (!v->e->l) {
if (len == 2) {
- return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
+ return (BM_vert_collapse_edge(bm, v->e, v, true) != NULL);
}
else {
/* used to kill the vertex here, but it may be connected to faces.
* so better do nothing */
- return FALSE;
+ return false;
}
}
else {
- return FALSE;
+ return false;
}
}
else if (len == 2 && BM_vert_face_count(v) == 1) {
/* boundary vertex on a face */
- return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
+ return (BM_vert_collapse_edge(bm, v->e, v, true) != NULL);
}
else {
return BM_disk_dissolve(bm, v);
@@ -103,14 +103,14 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v)
/**
* dissolves all faces around a vert, and removes it.
*/
-int BM_disk_dissolve(BMesh *bm, BMVert *v)
+bool BM_disk_dissolve(BMesh *bm, BMVert *v)
{
BMFace *f, *f2;
BMEdge *e, *keepedge = NULL, *baseedge = NULL;
int len = 0;
if (!BM_vert_is_manifold(v)) {
- return FALSE;
+ return false;
}
if (v->e) {
@@ -135,62 +135,62 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
* increasing valence to four. this may be hackish. . */
BMLoop *loop = e->l;
if (loop->v == v) loop = loop->next;
- if (!BM_face_split(bm, loop->f, v, loop->v, NULL, NULL, FALSE))
- return FALSE;
+ if (!BM_face_split(bm, loop->f, v, loop->v, NULL, NULL, false))
+ return false;
if (!BM_disk_dissolve(bm, v)) {
- return FALSE;
+ return false;
}
#else
- if (UNLIKELY(!BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE))) {
- return FALSE;
+ if (UNLIKELY(!BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, true))) {
+ return false;
}
- else if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, FALSE, TRUE))) {
- return FALSE;
+ else if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, false, true))) {
+ return false;
}
#endif
- return TRUE;
+ return true;
}
else if (keepedge == NULL && len == 2) {
/* collapse the vertex */
- e = BM_vert_collapse_faces(bm, v->e, v, 1.0, TRUE, TRUE);
+ e = BM_vert_collapse_faces(bm, v->e, v, 1.0, true, true);
if (!e) {
- return FALSE;
+ return false;
}
/* handle two-valence */
f = e->l->f;
f2 = e->l->radial_next->f;
- if (f != f2 && !BM_faces_join_pair(bm, f, f2, e, TRUE)) {
- return FALSE;
+ if (f != f2 && !BM_faces_join_pair(bm, f, f2, e, true)) {
+ return false;
}
- return TRUE;
+ return true;
}
if (keepedge) {
- int done = FALSE;
+ bool done = false;
while (!done) {
- done = TRUE;
+ done = true;
e = v->e;
do {
f = NULL;
len = bmesh_radial_length(e->l);
if (len == 2 && (e != baseedge) && (e != keepedge)) {
- f = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE);
+ f = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, true);
/* return if couldn't join faces in manifold
* conditions */
/* !disabled for testing why bad things happen */
if (!f) {
- return FALSE;
+ return false;
}
}
if (f) {
- done = FALSE;
+ done = false;
break;
}
e = bmesh_disk_edge_next(e, v);
@@ -199,10 +199,10 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
/* collapse the vertex */
/* note, the baseedge can be a boundary of manifold, use this as join_faces arg */
- e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, !BM_edge_is_boundary(baseedge), TRUE);
+ e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, !BM_edge_is_boundary(baseedge), true);
if (!e) {
- return FALSE;
+ return false;
}
/* get remaining two faces */
@@ -211,13 +211,13 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
if (f != f2) {
/* join two remaining faces */
- if (!BM_faces_join_pair(bm, f, f2, e, TRUE)) {
- return FALSE;
+ if (!BM_faces_join_pair(bm, f, f2, e, true)) {
+ return false;
}
}
}
- return TRUE;
+ return true;
}
/**
@@ -235,7 +235,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
*
* \return pointer to the combined face
*/
-BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const short do_del)
+BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const bool do_del)
{
BMLoop *l1, *l2;
BMEdge *jed = NULL;
@@ -302,7 +302,7 @@ BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f)
if (v_iter == v2) {
BMLoop *nl;
- f_iter = BM_face_split(bm, f_iter, v1, v2, &nl, NULL, FALSE);
+ f_iter = BM_face_split(bm, f_iter, v1, v2, &nl, NULL, false);
if (r_f) {
*r_f = f_iter;
@@ -336,22 +336,22 @@ BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f)
* other side). NULL if the split fails.
*/
BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l,
- BMEdge *example, const short nodouble)
+ BMEdge *example, const bool no_double)
{
- const int has_mdisp = CustomData_has_layer(&bm->ldata, CD_MDISPS);
+ const bool has_mdisp = CustomData_has_layer(&bm->ldata, CD_MDISPS);
BMFace *nf, *of;
BLI_assert(v1 != v2);
/* do we have a multires layer? */
if (has_mdisp) {
- of = BM_face_copy(bm, f, FALSE, FALSE);
+ of = BM_face_copy(bm, f, false, false);
}
#ifdef USE_BMESH_HOLES
- nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, nodouble);
+ nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, no_double);
#else
- nf = bmesh_sfme(bm, f, v1, v2, r_l, example, nodouble);
+ nf = bmesh_sfme(bm, f, v1, v2, r_l, example, no_double);
#endif
if (nf) {
@@ -414,15 +414,15 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[
BLI_assert(v1 != v2);
- of = BM_face_copy(bm, f, TRUE, TRUE);
+ of = BM_face_copy(bm, f, true, true);
if (!r_l)
r_l = &l_dummy;
#ifdef USE_BMESH_HOLES
- nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, FALSE);
+ nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, false);
#else
- nf = bmesh_sfme(bm, f, v1, v2, r_l, example, FALSE);
+ nf = bmesh_sfme(bm, f, v1, v2, r_l, example, false);
#endif
/* bmesh_sfme returns in r_l a Loop for nf going from v1 to v2.
* The radial_next is for f and goes from v2 to v1 */
@@ -445,7 +445,7 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[
do {
if (l_iter->v == newv) {
/* this interpolates both loop and vertex data */
- BM_loop_interp_from_face(bm, l_iter, of, TRUE, TRUE);
+ BM_loop_interp_from_face(bm, l_iter, of, true, true);
}
} while ((l_iter = l_iter->radial_next) != e_iter->l);
}
@@ -482,7 +482,7 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[
* \returns The New Edge
*/
BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
- const short join_faces, const short kill_degenerate_faces)
+ const bool join_faces, const bool kill_degenerate_faces)
{
BMEdge *ne = NULL;
BMVert *tv = bmesh_edge_other_vert_get(ke, kv);
@@ -534,10 +534,10 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
}
if (BLI_array_count(faces) >= 2) {
- BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), TRUE);
+ BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), true);
if (f2) {
BMLoop *nl = NULL;
- if (BM_face_split(bm, f2, tv, tv2, &nl, NULL, FALSE)) {
+ if (BM_face_split(bm, f2, tv, tv2, &nl, NULL, false)) {
ne = nl->e;
}
}
@@ -549,7 +549,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
/* single face or no faces */
/* same as BM_vert_collapse_edge() however we already
* have vars to perform this operation so don't call. */
- ne = bmesh_jekv(bm, ke, kv, TRUE);
+ ne = bmesh_jekv(bm, ke, kv, true);
/* ne = BM_edge_exists(tv, tv2); */ /* same as return above */
if (ne && kill_degenerate_faces) {
@@ -589,7 +589,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
* \return The New Edge
*/
BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
- const short kill_degenerate_faces)
+ const bool kill_degenerate_faces)
{
/* nice example implementation but we want loops to have their customdata
* accounted for */
@@ -618,7 +618,7 @@ BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
#else
/* with these args faces are never joined, same as above
* but account for loop customdata */
- return BM_vert_collapse_faces(bm, ke, kv, 1.0f, FALSE, kill_degenerate_faces);
+ return BM_vert_collapse_faces(bm, ke, kv, 1.0f, false, kill_degenerate_faces);
#endif
}
@@ -641,7 +641,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
BMFace **oldfaces = NULL;
BMEdge *e_dummy;
BLI_array_staticdeclare(oldfaces, 32);
- const int do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS));
+ const bool do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS));
/* we need this for handling multi-res */
if (!r_e) {
@@ -662,7 +662,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
/* flag existing faces so we can differentiate oldfaces from new faces */
for (i = 0; i < BLI_array_count(oldfaces); i++) {
BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP);
- oldfaces[i] = BM_face_copy(bm, oldfaces[i], TRUE, TRUE);
+ oldfaces[i] = BM_face_copy(bm, oldfaces[i], true, true);
BM_ELEM_API_FLAG_DISABLE(oldfaces[i], _FLAG_OVERLAP);
}
}
@@ -761,16 +761,18 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts)
return nv;
}
+#if 0
/**
* Checks if a face is valid in the data structure
*/
-int BM_face_validate(BMFace *face, FILE *err)
+bool BM_face_validate(BMFace *face, FILE *err)
{
BMIter iter;
BLI_array_declare(verts);
BMVert **verts = NULL;
BMLoop *l;
- int ret = 1, i, j;
+ int i, j;
+ bool ret = true;
if (face->len == 2) {
fprintf(err, "warning: found two-edged face. face ptr: %p\n", face);
@@ -784,7 +786,7 @@ int BM_face_validate(BMFace *face, FILE *err)
fprintf(err, "Found bmesh edge with identical verts!\n");
fprintf(err, " edge ptr: %p, vert: %p\n", l->e, l->e->v1);
fflush(err);
- ret = 0;
+ ret = false;
}
}
@@ -798,7 +800,7 @@ int BM_face_validate(BMFace *face, FILE *err)
fprintf(err, "Found duplicate verts in bmesh face!\n");
fprintf(err, " face ptr: %p, vert: %p\n", face, verts[i]);
fflush(err);
- ret = 0;
+ ret = false;
}
}
}
@@ -806,7 +808,7 @@ int BM_face_validate(BMFace *face, FILE *err)
BLI_array_free(verts);
return ret;
}
-
+#endif
/**
* Calculate the 2 loops which _would_ make up the newly rotated Edge
@@ -822,14 +824,14 @@ int BM_face_validate(BMFace *face, FILE *err)
*
* \note #BM_edge_rotate_check must have already run.
*/
-void BM_edge_calc_rotate(BMEdge *e, int ccw,
+void BM_edge_calc_rotate(BMEdge *e, const bool ccw,
BMLoop **r_l1, BMLoop **r_l2)
{
BMVert *v1, *v2;
BMFace *fa, *fb;
/* this should have already run */
- BLI_assert(BM_edge_rotate_check(e) == TRUE);
+ BLI_assert(BM_edge_rotate_check(e) == true);
/* we know this will work */
BM_edge_face_pair(e, &fa, &fb);
@@ -855,7 +857,7 @@ void BM_edge_calc_rotate(BMEdge *e, int ccw,
* Quick check to see if we could rotate the edge,
* use this to avoid calling exceptions on common cases.
*/
-int BM_edge_rotate_check(BMEdge *e)
+bool BM_edge_rotate_check(BMEdge *e)
{
BMFace *fa, *fb;
if (BM_edge_face_pair(e, &fa, &fb)) {
@@ -868,7 +870,7 @@ int BM_edge_rotate_check(BMEdge *e)
* (ie - the next edge doesn't share the same faces).
* since we can't rotate usefully in this case. */
if (la->v == lb->v) {
- return FALSE;
+ return false;
}
/* mirror of the check above but in the opposite direction */
@@ -876,13 +878,13 @@ int BM_edge_rotate_check(BMEdge *e)
lb = BM_face_other_vert_loop(fb, e->v1, e->v2);
if (la->v == lb->v) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -897,7 +899,7 @@ int BM_edge_rotate_check(BMEdge *e)
* \param l1,l2 are the loops of the proposed verts to rotate too and should
* be the result of calling #BM_edge_calc_rotate
*/
-int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
+bool BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
{
/* note: for these vars 'old' just means initial edge state. */
@@ -924,7 +926,7 @@ int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
BMVert *v1_alt, *v2_alt;
/* this should have already run */
- BLI_assert(BM_edge_rotate_check(e) == TRUE);
+ BLI_assert(BM_edge_rotate_check(e) == true);
BM_edge_ordered_verts(e, &v1_old, &v2_old);
@@ -965,12 +967,12 @@ int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
cross_v3_v3v3(cross_old, ed_dir_old, ed_dir_v1_old);
cross_v3_v3v3(cross_new, ed_dir_new, ed_dir_v1_new);
if (dot_v3v3(cross_old, cross_new) < 0.0f) { /* does this flip? */
- return FALSE;
+ return false;
}
cross_v3_v3v3(cross_old, ed_dir_old, ed_dir_v2_old);
cross_v3_v3v3(cross_new, ed_dir_new, ed_dir_v2_new);
if (dot_v3v3(cross_old, cross_new) < 0.0f) { /* does this flip? */
- return FALSE;
+ return false;
}
negate_v3_v3(ed_dir_new_flip, ed_dir_new);
@@ -979,14 +981,14 @@ int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
if ((dot_v3v3(ed_dir_new, ed_dir_v1_new) > 0.999f) ||
(dot_v3v3(ed_dir_new_flip, ed_dir_v2_new) > 0.999f))
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-int BM_edge_rotate_check_beauty(BMEdge *e,
- BMLoop *l1, BMLoop *l2)
+bool BM_edge_rotate_check_beauty(BMEdge *e,
+ BMLoop *l1, BMLoop *l2)
{
/* Stupid check for now:
* Could compare angles of surrounding edges
@@ -1009,7 +1011,7 @@ int BM_edge_rotate_check_beauty(BMEdge *e,
*
* \see header definition for \a check_flag enum.
*/
-BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_flag)
+BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag)
{
BMVert *v1, *v2;
BMLoop *l1, *l2;
@@ -1066,7 +1068,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
f_hflag_prev_2 = l2->f->head.hflag;
/* don't delete the edge, manually remove the egde after so we can copy its attributes */
- f = BM_faces_join_pair(bm, l1->f, l2->f, NULL, TRUE);
+ f = BM_faces_join_pair(bm, l1->f, l2->f, NULL, true);
if (f == NULL) {
return NULL;
@@ -1075,7 +1077,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
/* note, this assumes joining the faces _didnt_ also remove the verts.
* the #BM_edge_rotate_check will ensure this, but its possibly corrupt state or future edits
* break this */
- if (!BM_face_split(bm, f, v1, v2, NULL, NULL, TRUE)) {
+ if (!BM_face_split(bm, f, v1, v2, NULL, NULL, true)) {
return NULL;
}
else {
diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h
index 790f0cb6267..358268cb589 100644
--- a/source/blender/bmesh/intern/bmesh_mods.h
+++ b/source/blender/bmesh/intern/bmesh_mods.h
@@ -29,18 +29,18 @@
#include <stdio.h>
-int BM_vert_dissolve(BMesh *bm, BMVert *v);
+bool BM_vert_dissolve(BMesh *bm, BMVert *v);
-int BM_disk_dissolve(BMesh *bm, BMVert *v);
+bool BM_disk_dissolve(BMesh *bm, BMVert *v);
-BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const short do_del);
+BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const bool do_del);
BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f);
BMFace *BM_face_split(BMesh *bm, BMFace *f,
BMVert *v1, BMVert *v2,
BMLoop **r_l,
- BMEdge *example, const short nodouble);
+ BMEdge *example, const bool no_double);
BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
BMVert *v1, BMVert *v2,
@@ -48,25 +48,25 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
BMLoop **r_l, BMEdge *example);
BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
- const short join_faces, const short kill_degenerate_faces);
+ const bool join_faces, const bool kill_degenerate_faces);
BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
- const short kill_degenerate_faces);
+ const bool kill_degenerate_faces);
BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent);
BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts);
-int BM_face_validate(BMFace *face, FILE *err);
+bool BM_face_validate(BMFace *face, FILE *err);
-void BM_edge_calc_rotate(BMEdge *e, int ccw,
+void BM_edge_calc_rotate(BMEdge *e, const bool ccw,
BMLoop **r_l1, BMLoop **r_l2);
-int BM_edge_rotate_check(BMEdge *e);
-int BM_edge_rotate_check_degenerate(BMEdge *e,
+bool BM_edge_rotate_check(BMEdge *e);
+bool BM_edge_rotate_check_degenerate(BMEdge *e,
BMLoop *l1, BMLoop *l2);
-int BM_edge_rotate_check_beauty(BMEdge *e,
+bool BM_edge_rotate_check_beauty(BMEdge *e,
BMLoop *l1, BMLoop *l2);
-BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_flag);
+BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag);
/* flags for BM_edge_rotate */
enum {
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index b8fbfbee37f..fd6571d136e 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -244,19 +244,19 @@ void BMO_push(BMesh *bm, BMOperator *op);
void BMO_pop(BMesh *bm);
/*executes an operator*/
-int BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...);
+bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...);
/* initializes, but doesn't execute an operator. this is so you can
* gain access to the outputs of the operator. note that you have
* to execute/finish (BMO_op_exec and BMO_op_finish) yourself. */
-int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...);
+bool BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...);
/* va_list version, used to implement the above two functions,
* plus EDBM_op_callf in editmesh_utils.c. */
-int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist);
+bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist);
/* test whether a named slot exists */
-int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
+bool BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
/* get a pointer to a slot. this may be removed layer on from the public API. */
BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
@@ -301,8 +301,8 @@ void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
-void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
-int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const bool i);
+bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len);
@@ -360,11 +360,11 @@ void BMO_slot_buffer_flag_disable(BMesh *bm,
/* tool-flags all elements inside an element slot array with flag flag. */
void BMO_slot_buffer_hflag_enable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
- const char htype, const char hflag, const char do_flush);
+ const char htype, const char hflag, const bool do_flush);
/* clears tool-flag flag from all elements inside a slot array. */
void BMO_slot_buffer_hflag_disable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
- const char htype, const char hflag, const char do_flush);
+ const char htype, const char hflag, const bool do_flush);
/* puts every element of type 'type' (which is a bitmask) with header
* flag 'flag', into a slot. note: ignores hidden elements
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index ad116011421..053d70349e8 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -80,7 +80,7 @@ BLI_INLINE void BMO_slot_map_bool_insert(BMOperator *op, BMOpSlot *slot,
void *element, const int val)
{
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
- BLI_assert(val == FALSE || val == TRUE);
+ BLI_assert(val == false || val == true);
BMO_slot_map_insert(op, slot, element, &val, sizeof(int));
}
@@ -173,16 +173,16 @@ BLI_INLINE int BMO_slot_map_int_get(BMOpSlot *slot, const void *element)
return 0;
}
-BLI_INLINE int BMO_slot_map_bool_get(BMOpSlot *slot, const void *element)
+BLI_INLINE bool BMO_slot_map_bool_get(BMOpSlot *slot, const void *element)
{
int *val;
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
val = (int *) BMO_slot_map_data_get(slot, element);
- BLI_assert(val == NULL || *val == FALSE || *val == TRUE);
- if (val) return *val;
+ BLI_assert(val == NULL || *val == false || *val == true);
+ if (val) return (bool)*val;
- return 0;
+ return false;
}
BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot *slot, const void *element)
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index fbf51b7dfdf..3308a014d25 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -238,7 +238,7 @@ void BMO_op_finish(BMesh *bm, BMOperator *op)
*
* \return Success if the slot if found.
*/
-int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
+bool BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
{
int slot_code = bmo_name_to_slotcode(slot_args, identifier);
return (slot_code >= 0);
@@ -390,7 +390,7 @@ void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
slot->data.i = i;
}
-void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
+void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const bool i)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
@@ -495,7 +495,7 @@ int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name
return slot->data.i;
}
-int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
+bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
@@ -549,7 +549,7 @@ void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
*/
static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag,
- const short test_for_enabled)
+ const bool test_for_enabled)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@@ -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(ELEM(true, false, test_for_enabled));
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
@@ -579,12 +579,12 @@ static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag,
int BMO_mesh_enabled_flag_count(BMesh *bm, const char htype, const short oflag)
{
- return bmo_mesh_flag_count(bm, htype, oflag, TRUE);
+ return bmo_mesh_flag_count(bm, htype, oflag, true);
}
int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag)
{
- return bmo_mesh_flag_count(bm, htype, oflag, FALSE);
+ return bmo_mesh_flag_count(bm, htype, oflag, false);
}
void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char htype, const short oflag)
@@ -795,14 +795,12 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_
*/
static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag,
- const short test_for_enabled)
+ const bool test_for_enabled)
{
BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
int totelement = 0, i = 0;
const int respecthide = (op->flag & BMO_FLAG_RESPECT_HIDE) != 0;
- BLI_assert(ELEM(test_for_enabled, TRUE, FALSE));
-
if (test_for_enabled)
totelement = BM_mesh_elem_hflag_count_enabled(bm, htype, hflag, respecthide);
else
@@ -858,14 +856,14 @@ void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
{
- bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, TRUE);
+ bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, true);
}
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
{
- bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, FALSE);
+ bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, false);
}
void BMO_slot_buffer_from_single(BMOperator *op, BMOpSlot *slot, BMHeader *ele)
@@ -934,13 +932,13 @@ void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const cha
static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag,
- const short test_for_enabled)
+ const bool test_for_enabled)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
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(ELEM(true, false, test_for_enabled));
if (test_for_enabled)
totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag);
@@ -997,14 +995,14 @@ void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, TRUE);
+ bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, true);
}
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, FALSE);
+ bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, false);
}
/**
@@ -1015,13 +1013,13 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
*/
void BMO_slot_buffer_hflag_enable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
- const char htype, const char hflag, const char do_flush)
+ const char htype, const char hflag, const bool do_flush)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMElem **data = (BMElem **)slot->data.buf;
int i;
- const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
- const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
+ const bool do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
+ const bool do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
@@ -1031,11 +1029,11 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm,
continue;
if (do_flush_select) {
- BM_elem_select_set(bm, *data, TRUE);
+ BM_elem_select_set(bm, *data, true);
}
if (do_flush_hide) {
- BM_elem_hide_set(bm, *data, FALSE);
+ BM_elem_hide_set(bm, *data, false);
}
BM_elem_flag_enable(*data, hflag);
@@ -1050,13 +1048,13 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm,
*/
void BMO_slot_buffer_hflag_disable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
- const char htype, const char hflag, const char do_flush)
+ const char htype, const char hflag, const bool do_flush)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMElem **data = (BMElem **)slot->data.buf;
int i;
- const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
- const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
+ const bool do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
+ const bool do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
@@ -1066,11 +1064,11 @@ void BMO_slot_buffer_hflag_disable(BMesh *bm,
continue;
if (do_flush_select) {
- BM_elem_select_set(bm, *data, FALSE);
+ BM_elem_select_set(bm, *data, false);
}
if (do_flush_hide) {
- BM_elem_hide_set(bm, *data, FALSE);
+ BM_elem_hide_set(bm, *data, false);
}
BM_elem_flag_disable(*data, hflag);
@@ -1482,7 +1480,7 @@ void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
BLI_addhead(&bm->errorstack, err);
}
-int BMO_error_occurred(BMesh *bm)
+bool BMO_error_occurred(BMesh *bm)
{
return bm->errorstack.first != NULL;
}
@@ -1616,7 +1614,7 @@ static int bmo_opname_to_opcode(const char *opname)
* Order is not important so `Hfev` is also valid (all unflagged verts, edges and faces).
*/
-int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, va_list vlist)
+bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, va_list vlist)
{
// BMOpDefine *def;
char *opname, *ofmt, *fmt;
@@ -1653,7 +1651,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
if (i == -1) {
MEM_freeN(ofmt);
- return FALSE;
+ return false;
}
BMO_op_init(bm, op, flag, opname);
@@ -1816,7 +1814,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
}
MEM_freeN(ofmt);
- return TRUE;
+ return true;
error:
/* non urgent todo - explain exactly what is failing */
@@ -1841,14 +1839,14 @@ error:
MEM_freeN(ofmt);
BMO_op_finish(bm, op);
- return FALSE;
+ return false;
#undef GOTO_ERROR
}
-int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...)
+bool BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...)
{
va_list list;
@@ -1856,14 +1854,14 @@ int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...
if (!BMO_op_vinitf(bm, op, flag, fmt, list)) {
printf("%s: failed\n", __func__);
va_end(list);
- return FALSE;
+ return false;
}
va_end(list);
- return TRUE;
+ return true;
}
-int BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...)
+bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...)
{
va_list list;
BMOperator op;
@@ -1872,12 +1870,12 @@ int BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...)
if (!BMO_op_vinitf(bm, &op, flag, fmt, list)) {
printf("%s: failed, format is:\n \"%s\"\n", __func__, fmt);
va_end(list);
- return FALSE;
+ return false;
}
BMO_op_exec(bm, &op);
BMO_op_finish(bm, &op);
va_end(list);
- return TRUE;
+ return true;
}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 4545c9bb564..19b7de6c550 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -50,7 +50,7 @@
* Used for tessellator
*/
-static short testedgesidef(const float v1[2], const float v2[2], const float v3[2])
+static bool testedgesidef(const float v1[2], const float v2[2], const float v3[2])
{
/* is v3 to the right of v1 - v2 ? With exception: v3 == v1 || v3 == v2 */
double inp;
@@ -59,13 +59,13 @@ static short testedgesidef(const float v1[2], const float v2[2], const float v3[
inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
if (inp < 0.0) {
- return FALSE;
+ return false;
}
else if (inp == 0) {
- if (v1[0] == v3[0] && v1[1] == v3[1]) return FALSE;
- if (v2[0] == v3[0] && v2[1] == v3[1]) return FALSE;
+ if (v1[0] == v3[0] && v1[1] == v3[1]) return false;
+ if (v2[0] == v3[0] && v2[1] == v3[1]) return false;
}
- return TRUE;
+ return true;
}
/**
@@ -498,7 +498,7 @@ void BM_face_normal_flip(BMesh *bm, BMFace *f)
/* detects if two line segments cross each other (intersects).
* note, there could be more winding cases then there needs to be. */
-static int line_crosses_v2f(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
+static bool line_crosses_v2f(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
{
#define GETMIN2_AXIS(a, b, ma, mb, axis) \
@@ -526,7 +526,7 @@ static int line_crosses_v2f(const float v1[2], const float v2[2], const float v3
w5 = !testedgesidef(v3, v1, v4);
if (w1 == w2 && w2 == w3 && w3 == w4 && w4 == w5) {
- return TRUE;
+ return true;
}
GETMIN2(v1, v2, mv1, mv2);
@@ -549,7 +549,7 @@ static int line_crosses_v2f(const float v1[2], const float v2[2], const float v3
return (mv4[1] >= mv1[1] && mv3[1] <= mv2[1]);
}
- return FALSE;
+ return false;
#undef GETMIN2_AXIS
#undef GETMIN2
@@ -567,7 +567,7 @@ static int line_crosses_v2f(const float v1[2], const float v2[2], const float v3
* instead of projecting co directly into f's orientation space,
* so there might be accuracy issues.
*/
-int BM_face_point_inside_test(BMFace *f, const float co[3])
+bool BM_face_point_inside_test(BMFace *f, const float co[3])
{
int ax, ay;
float co2[2], cent[2] = {0.0f, 0.0f}, out[2] = {FLT_MAX * 0.5f, FLT_MAX * 0.5f};
@@ -614,7 +614,7 @@ int BM_face_point_inside_test(BMFace *f, const float co[3])
return crosses % 2 != 0;
}
-static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i, int v2i, int v3i)
+static bool bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i, int v2i, int v3i)
{
BMLoop *l_iter;
BMLoop *l_first;
@@ -627,7 +627,7 @@ static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
/* v3 must be on the left side of [v1, v2] line, else we know [v1, v3] is outside of f! */
if (testedgesidef(v1, v2, v3)) {
- return FALSE;
+ return false;
}
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
@@ -649,10 +649,10 @@ static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
else
printf("%d in (%d, %d, %d)\n", v1i, i, v3i, v2i);
#endif
- return FALSE;
+ return false;
}
} while ((l_iter = l_iter->next) != l_first);
- return TRUE;
+ return true;
}
/**
@@ -665,7 +665,7 @@ static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
* \param abscoss Must be allocated by caller, and at least f->len length
* (allow to avoid allocating a new one for each tri!).
*/
-static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, float *abscoss)
+static BMLoop *find_ear(BMFace *f, float (*verts)[3], const bool use_beauty, float *abscoss)
{
BMLoop *bestear = NULL;
@@ -726,7 +726,8 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
/* float angle, bestangle = 180.0f; */
float cos, tcos, bestcos = 1.0f;
float *tcoss;
- int isear, i = 0, j, len;
+ bool is_ear;
+ int i = 0, j, len;
/* Compute cos of all corners! */
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
@@ -745,7 +746,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
l_iter = l_first;
tcoss = abscoss;
do {
- isear = TRUE;
+ is_ear = true;
v1 = l_iter->prev->v;
v2 = l_iter->v;
@@ -753,7 +754,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
/* We may have already internal edges... */
if (BM_edge_exists(v1, v3)) {
- isear = FALSE;
+ is_ear = false;
}
else if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(v1),
BM_elem_index_get(v2), BM_elem_index_get(v3)))
@@ -762,10 +763,10 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
printf("(%d, %d, %d) would not be a valid tri!\n",
BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3));
#endif
- isear = FALSE;
+ is_ear = false;
}
- if (isear) {
+ if (is_ear) {
#if 0 /* Old, already commented code */
/* if this code comes back, it needs to be converted to radians */
angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]);
@@ -845,9 +846,10 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
* \note newedgeflag sets a flag layer flag, obviously not the header flag.
*/
void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const short newedge_oflag,
- const short newface_oflag, BMFace **newfaces, const short use_beauty)
+ const short newface_oflag, BMFace **newfaces, const bool use_beauty)
{
- int i, done, nvert, nf_i = 0;
+ int i, nvert, nf_i = 0;
+ bool done;
BMLoop *newl;
BMLoop *l_iter;
BMLoop *l_first;
@@ -877,14 +879,14 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const s
projectverts[i][2] = 0.0f;
}
- done = FALSE;
+ done = false;
while (!done && f->len > 3) {
- done = TRUE;
+ done = true;
l_iter = find_ear(f, projectverts, use_beauty, abscoss);
if (l_iter) {
- done = FALSE;
+ done = false;
/* printf("Subdividing face...\n");*/
- f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &newl, NULL, TRUE);
+ f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &newl, NULL, true);
if (UNLIKELY(!f)) {
fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__);
@@ -918,7 +920,7 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const s
while (l_iter->f->len > 3) {
nextloop = l_iter->next->next;
f = BM_face_split(bm, l_iter->f, l_iter->v, nextloop->v,
- &newl, NULL, TRUE);
+ &newl, NULL, true);
if (!f) {
printf("triangle fan step of triangulator failed.\n");
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index e5777d3611b..0b888a3efd1 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -42,11 +42,11 @@ void BM_vert_normal_update(BMVert *v);
void BM_vert_normal_update_all(BMVert *v);
void BM_face_normal_flip(BMesh *bm, BMFace *f);
-int BM_face_point_inside_test(BMFace *f, const float co[3]);
+bool BM_face_point_inside_test(BMFace *f, const float co[3]);
void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
const short newedge_oflag, const short newface_oflag, BMFace **newfaces,
- const short use_beauty);
+ const bool use_beauty);
void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index b5b6c69bd7e..23d7af5277c 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -43,7 +43,7 @@
* Returns whether or not a given vertex is
* is part of a given edge.
*/
-int BM_vert_in_edge(BMEdge *e, BMVert *v)
+bool BM_vert_in_edge(BMEdge *e, BMVert *v)
{
return bmesh_vert_in_edge(e, v);
}
@@ -208,9 +208,9 @@ BMLoop *BM_vert_find_first_loop(BMVert *v)
}
/**
- * Returns TRUE if the vertex is used in a given face.
+ * Returns true if the vertex is used in a given face.
*/
-int BM_vert_in_face(BMFace *f, BMVert *v)
+bool BM_vert_in_face(BMFace *f, BMVert *v)
{
BMLoop *l_iter, *l_first;
@@ -226,19 +226,19 @@ int BM_vert_in_face(BMFace *f, BMVert *v)
#endif
do {
if (l_iter->v == v) {
- return TRUE;
+ return true;
}
} while ((l_iter = l_iter->next) != l_first);
}
- return FALSE;
+ return false;
}
/**
* Compares the number of vertices in an array
* that appear in a given face
*/
-int BM_verts_in_face(BMFace *f, BMVert **varr, int len)
+int BM_verts_in_face_count(BMFace *f, BMVert **varr, int len)
{
BMLoop *l_iter, *l_first;
@@ -281,7 +281,7 @@ int BM_verts_in_face(BMFace *f, BMVert **varr, int len)
/**
* Returns whether or not a given edge is is part of a given face.
*/
-int BM_edge_in_face(BMFace *f, BMEdge *e)
+bool BM_edge_in_face(BMFace *f, BMEdge *e)
{
BMLoop *l_iter;
BMLoop *l_first;
@@ -290,17 +290,17 @@ int BM_edge_in_face(BMFace *f, BMEdge *e)
do {
if (l_iter->e == e) {
- return TRUE;
+ return true;
}
} while ((l_iter = l_iter->next) != l_first);
- return FALSE;
+ return false;
}
/**
* Returns whether or not a given edge is is part of a given loop.
*/
-int BM_edge_in_loop(BMEdge *e, BMLoop *l)
+bool BM_edge_in_loop(BMEdge *e, BMLoop *l)
{
return (l->e == e || l->prev->e == e);
}
@@ -309,7 +309,7 @@ int BM_edge_in_loop(BMEdge *e, BMLoop *l)
* Returns whether or not two vertices are in
* a given edge
*/
-int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
+bool BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
{
return bmesh_verts_in_edge(v1, v2, e);
}
@@ -487,9 +487,9 @@ float BM_edge_calc_length_squared(BMEdge *e)
* Utility function, since enough times we have an edge
* and want to access 2 connected faces.
*
- * \return TRUE when only 2 faces are found.
+ * \return true when only 2 faces are found.
*/
-int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
+bool BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
{
BMLoop *la, *lb;
@@ -500,12 +500,12 @@ int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
{
*r_fa = la->f;
*r_fb = lb->f;
- return TRUE;
+ return true;
}
else {
*r_fa = NULL;
*r_fb = NULL;
- return FALSE;
+ return false;
}
}
@@ -513,9 +513,9 @@ int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
* Utility function, since enough times we have an edge
* and want to access 2 connected loops.
*
- * \return TRUE when only 2 faces are found.
+ * \return true when only 2 faces are found.
*/
-int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
+bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
{
BMLoop *la, *lb;
@@ -526,12 +526,12 @@ int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
{
*r_la = la;
*r_lb = lb;
- return TRUE;
+ return true;
}
else {
*r_la = NULL;
*r_lb = NULL;
- return FALSE;
+ return false;
}
}
@@ -589,7 +589,7 @@ int BM_vert_face_count(BMVert *v)
* Tests whether or not the vertex is part of a wire edge.
* (ie: has no faces attached to it)
*/
-int BM_vert_is_wire(BMVert *v)
+bool BM_vert_is_wire(BMVert *v)
{
if (v->e) {
BMEdge *e_first, *e_iter;
@@ -597,14 +597,14 @@ int BM_vert_is_wire(BMVert *v)
e_first = e_iter = v->e;
do {
if (e_iter->l) {
- return FALSE;
+ return false;
}
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -612,9 +612,9 @@ int BM_vert_is_wire(BMVert *v)
* Tests whether or not the edge is part of a wire.
* (ie: has no faces attached to it)
*/
-int BM_edge_is_wire(BMEdge *e)
+bool BM_edge_is_wire(BMEdge *e)
{
- return (e->l) ? FALSE : TRUE;
+ return (e->l == NULL);
}
/**
@@ -624,7 +624,7 @@ int BM_edge_is_wire(BMEdge *e)
* 3: Is part of a an edge with more than 2 faces.
* 4: Is part of a wire edge.
*/
-int BM_vert_is_manifold(BMVert *v)
+bool BM_vert_is_manifold(BMVert *v)
{
BMEdge *e, *oe;
BMLoop *l;
@@ -632,7 +632,7 @@ int BM_vert_is_manifold(BMVert *v)
if (v->e == NULL) {
/* loose vert */
- return FALSE;
+ return false;
}
/* count edges while looking for non-manifold edges */
@@ -643,7 +643,7 @@ int BM_vert_is_manifold(BMVert *v)
* edges with 1 face user are OK, otherwise we could
* use BM_edge_is_manifold() here */
if (e->l == NULL || bmesh_radial_length(e->l) > 2) {
- return FALSE;
+ return false;
}
len++;
} while ((e = bmesh_disk_edge_next(e, v)) != oe);
@@ -677,10 +677,10 @@ int BM_vert_is_manifold(BMVert *v)
if (count < len) {
/* vert shared by multiple regions */
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/**
@@ -689,7 +689,7 @@ int BM_vert_is_manifold(BMVert *v)
*/
#if 1 /* fast path for checking manifold */
-int BM_edge_is_manifold(BMEdge *e)
+bool BM_edge_is_manifold(BMEdge *e)
{
const BMLoop *l = e->l;
return (l && (l->radial_next != l) && /* not 0 or 1 face users */
@@ -700,10 +700,10 @@ int BM_edge_is_manifold(BMEdge *e)
{
int count = BM_edge_face_count(e);
if (count == 2) {
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
#endif
@@ -714,7 +714,7 @@ int BM_edge_is_manifold(BMEdge *e)
*/
#if 1 /* fast path for checking boundary */
-int BM_edge_is_boundary(BMEdge *e)
+bool BM_edge_is_boundary(BMEdge *e)
{
const BMLoop *l = e->l;
return (l && (l->radial_next == l));
@@ -724,10 +724,10 @@ int BM_edge_is_boundary(BMEdge *e)
{
int count = BM_edge_face_count(e);
if (count == 1) {
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
#endif
@@ -757,7 +757,7 @@ int BM_face_share_face_count(BMFace *f1, BMFace *f2)
/**
* same as #BM_face_share_face_count but returns a bool
*/
-int BM_face_share_face_check(BMFace *f1, BMFace *f2)
+bool BM_face_share_face_check(BMFace *f1, BMFace *f2)
{
BMIter iter1, iter2;
BMEdge *e;
@@ -766,11 +766,11 @@ int BM_face_share_face_check(BMFace *f1, BMFace *f2)
BM_ITER_ELEM (e, &iter1, f1, BM_EDGES_OF_FACE) {
BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2))
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/**
@@ -793,9 +793,9 @@ int BM_face_share_edge_count(BMFace *f1, BMFace *f2)
}
/**
- * Returns TRUE if the faces share an edge
+ * Returns true if the faces share an edge
*/
-int BM_face_share_edge_check(BMFace *f1, BMFace *f2)
+bool BM_face_share_edge_check(BMFace *f1, BMFace *f2)
{
BMLoop *l_iter;
BMLoop *l_first;
@@ -803,17 +803,17 @@ int BM_face_share_edge_check(BMFace *f1, BMFace *f2)
l_iter = l_first = BM_FACE_FIRST_LOOP(f1);
do {
if (bmesh_radial_face_find(l_iter->e, f2)) {
- return TRUE;
+ return true;
}
} while ((l_iter = l_iter->next) != l_first);
- return FALSE;
+ return false;
}
/**
- * Test if e1 shares any faces with e2
+ * Test if e1 shares any faces with e2
*/
-int BM_edge_share_face_check(BMEdge *e1, BMEdge *e2)
+bool BM_edge_share_face_check(BMEdge *e1, BMEdge *e2)
{
BMLoop *l;
BMFace *f;
@@ -823,18 +823,18 @@ int BM_edge_share_face_check(BMEdge *e1, BMEdge *e2)
do {
f = l->f;
if (bmesh_radial_face_find(e2, f)) {
- return TRUE;
+ return true;
}
l = l->radial_next;
} while (l != e1->l);
}
- return FALSE;
+ return false;
}
/**
* Test if e1 shares any quad faces with e2
*/
-int BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
+bool BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
{
BMLoop *l;
BMFace *f;
@@ -845,19 +845,19 @@ int BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
f = l->f;
if (f->len == 4) {
if (bmesh_radial_face_find(e2, f)) {
- return TRUE;
+ return true;
}
}
l = l->radial_next;
} while (l != e1->l);
}
- return FALSE;
+ return false;
}
/**
* Tests to see if e1 shares a vertex with e2
*/
-int BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2)
+bool BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2)
{
return (e1->v1 == e2->v1 ||
e1->v1 == e2->v2 ||
@@ -1007,7 +1007,7 @@ void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3])
normalize_v3(v_prev);
normalize_v3(v_next);
- if (compare_v3v3(v_prev, v_next, FLT_EPSILON) == FALSE) {
+ if (compare_v3v3(v_prev, v_next, FLT_EPSILON) == false) {
float dir[3];
float nor[3]; /* for this purpose doesn't need to be normalized */
add_v3_v3v3(dir, v_prev, v_next);
@@ -1279,10 +1279,10 @@ BMEdge *BM_edge_find_double(BMEdge *e)
* \note Making a face here is valid but in some cases you wont want to
* make a face thats part of another.
*
- * \returns TRUE for overlap
+ * \returns true for overlap
*
*/
-int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
+bool BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
{
BMIter viter;
BMFace *f;
@@ -1290,12 +1290,12 @@ int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
- amount = BM_verts_in_face(f, varr, len);
+ amount = BM_verts_in_face_count(f, varr, len);
if (amount >= len) {
if (r_overlapface) {
*r_overlapface = f;
}
- return TRUE;
+ return true;
}
}
}
@@ -1304,7 +1304,7 @@ int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
*r_overlapface = NULL;
}
- return FALSE;
+ return false;
}
/**
@@ -1312,7 +1312,7 @@ int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
* there is a face with exactly those vertices
* (and only those vertices).
*/
-int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
+bool BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
{
BMIter viter;
BMFace *f;
@@ -1320,12 +1320,12 @@ int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
- amount = BM_verts_in_face(f, varr, len);
+ amount = BM_verts_in_face_count(f, varr, len);
if (amount == len && amount == f->len) {
if (r_existface) {
*r_existface = f;
}
- return TRUE;
+ return true;
}
}
}
@@ -1333,7 +1333,7 @@ int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
if (r_existface) {
*r_existface = NULL;
}
- return FALSE;
+ return false;
}
@@ -1349,12 +1349,12 @@ int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
*
* \a earr and \a varr can be in any order, however they _must_ form a closed loop.
*/
-int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
+bool BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
{
BMFace *f;
BMEdge *e;
BMVert *v;
- int ok;
+ bool ok;
int tot_tag;
BMIter fiter;
@@ -1394,10 +1394,10 @@ int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &fiter, earr[i], BM_FACES_OF_EDGE) {
if (!BM_elem_flag_test(f, BM_ELEM_INTERNAL_TAG)) {
- ok = TRUE;
+ ok = true;
BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
if (!BM_elem_flag_test(v, BM_ELEM_INTERNAL_TAG)) {
- ok = FALSE;
+ ok = false;
break;
}
}
@@ -1416,20 +1416,20 @@ int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
if (tot_tag == 0) {
/* no faces use only boundary verts, quit early */
- return FALSE;
+ return false;
}
/* 2) loop over non-boundary edges that use boundary verts,
* check each have 2 tagges faces connected (faces that only use 'varr' verts) */
- ok = TRUE;
+ ok = true;
for (i = 0; i < len; i++) {
BM_ITER_ELEM (e, &fiter, varr[i], BM_EDGES_OF_VERT) {
if (/* non-boundary edge */
- BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG) == FALSE &&
+ BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG) == false &&
/* ...using boundary verts */
- BM_elem_flag_test(e->v1, BM_ELEM_INTERNAL_TAG) == TRUE &&
- BM_elem_flag_test(e->v2, BM_ELEM_INTERNAL_TAG) == TRUE)
+ BM_elem_flag_test(e->v1, BM_ELEM_INTERNAL_TAG) == true &&
+ BM_elem_flag_test(e->v2, BM_ELEM_INTERNAL_TAG) == true)
{
int tot_face_tag = 0;
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
@@ -1439,14 +1439,14 @@ int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
}
if (tot_face_tag != 2) {
- ok = FALSE;
+ ok = false;
break;
}
}
}
- if (ok == FALSE) {
+ if (ok == false) {
break;
}
}
@@ -1455,25 +1455,25 @@ int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
}
/* same as 'BM_face_exists_multi' but built vert array from edges */
-int BM_face_exists_multi_edge(BMEdge **earr, int len)
+bool BM_face_exists_multi_edge(BMEdge **earr, int len)
{
BMVert **varr = BLI_array_alloca(varr, len);
- int ok;
+ bool ok;
int i, i_next;
/* first check if verts have edges, if not we can bail out early */
- ok = TRUE;
+ ok = true;
for (i = len - 1, i_next = 0; i_next < len; (i = i_next++)) {
if (!(varr[i] = BM_edge_share_vert(earr[i], earr[i_next]))) {
- ok = FALSE;
+ ok = false;
break;
}
}
- if (ok == FALSE) {
+ if (ok == false) {
BMESH_ASSERT(0);
- return FALSE;
+ return false;
}
ok = BM_face_exists_multi(varr, earr, len);
@@ -1482,13 +1482,13 @@ int BM_face_exists_multi_edge(BMEdge **earr, int len)
}
/* convenience functions for checking flags */
-int BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag)
+bool BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag)
{
return (BM_elem_flag_test(e->v1, hflag) ||
BM_elem_flag_test(e->v2, hflag));
}
-int BM_face_is_any_vert_flag_test(BMFace *f, const char hflag)
+bool BM_face_is_any_vert_flag_test(BMFace *f, const char hflag)
{
BMLoop *l_iter;
BMLoop *l_first;
@@ -1496,13 +1496,13 @@ int BM_face_is_any_vert_flag_test(BMFace *f, const char hflag)
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (BM_elem_flag_test(l_iter->v, hflag)) {
- return TRUE;
+ return true;
}
} while ((l_iter = l_iter->next) != l_first);
- return FALSE;
+ return false;
}
-int BM_face_is_any_edge_flag_test(BMFace *f, const char hflag)
+bool BM_face_is_any_edge_flag_test(BMFace *f, const char hflag)
{
BMLoop *l_iter;
BMLoop *l_first;
@@ -1510,8 +1510,8 @@ int BM_face_is_any_edge_flag_test(BMFace *f, const char hflag)
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
if (BM_elem_flag_test(l_iter->e, hflag)) {
- return TRUE;
+ return true;
}
} while ((l_iter = l_iter->next) != l_first);
- return FALSE;
+ return false;
}
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index a9d6719c491..4641fa86fb0 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -27,19 +27,19 @@
* \ingroup bmesh
*/
-int BM_vert_in_face(BMFace *f, BMVert *v);
-int BM_verts_in_face(BMFace *f, BMVert **varr, int len);
+bool BM_vert_in_face(BMFace *f, BMVert *v);
+int BM_verts_in_face_count(BMFace *f, BMVert **varr, int len);
-int BM_edge_in_face(BMFace *f, BMEdge *e);
-int BM_edge_in_loop(BMEdge *e, BMLoop *l);
+bool BM_edge_in_face(BMFace *f, BMEdge *e);
+bool BM_edge_in_loop(BMEdge *e, BMLoop *l);
-int BM_vert_in_edge(BMEdge *e, BMVert *v);
-int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
+bool BM_vert_in_edge(BMEdge *e, BMVert *v);
+bool BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
float BM_edge_calc_length(BMEdge *e);
float BM_edge_calc_length_squared(BMEdge *e);
-int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb);
-int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb);
+bool BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb);
+bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb);
BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v);
BMLoop *BM_edge_other_loop(BMEdge *e, BMLoop *l);
BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v);
@@ -54,12 +54,12 @@ int BM_edge_face_count(BMEdge *e);
int BM_vert_face_count(BMVert *v);
BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e);
-int BM_vert_is_wire(BMVert *v);
-int BM_edge_is_wire(BMEdge *e);
+bool BM_vert_is_wire(BMVert *v);
+bool BM_edge_is_wire(BMEdge *e);
-int BM_vert_is_manifold(BMVert *v);
-int BM_edge_is_manifold(BMEdge *e);
-int BM_edge_is_boundary(BMEdge *e);
+bool BM_vert_is_manifold(BMVert *v);
+bool BM_edge_is_manifold(BMEdge *e);
+bool BM_edge_is_boundary(BMEdge *e);
float BM_loop_calc_face_angle(BMLoop *l);
void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]);
@@ -79,21 +79,21 @@ BMLoop *BM_face_find_longest_loop(BMFace *f);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
BMEdge *BM_edge_find_double(BMEdge *e);
-int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_existface);
+bool BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_existface);
-int BM_face_exists(BMVert **varr, int len, BMFace **r_existface);
+bool BM_face_exists(BMVert **varr, int len, BMFace **r_existface);
-int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len);
-int BM_face_exists_multi_edge(BMEdge **earr, int len);
+bool BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len);
+bool BM_face_exists_multi_edge(BMEdge **earr, int len);
int BM_face_share_face_count(BMFace *f1, BMFace *f2);
int BM_face_share_edge_count(BMFace *f1, BMFace *f2);
-int BM_face_share_face_check(BMFace *f1, BMFace *f2);
-int BM_face_share_edge_check(BMFace *f1, BMFace *f2);
-int BM_edge_share_face_check(BMEdge *e1, BMEdge *e2);
-int BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2);
-int BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2);
+bool BM_face_share_face_check(BMFace *f1, BMFace *f2);
+bool BM_face_share_edge_check(BMFace *f1, BMFace *f2);
+bool BM_edge_share_face_check(BMEdge *e1, BMEdge *e2);
+bool BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2);
+bool BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2);
BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2);
BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v);
@@ -103,8 +103,8 @@ void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2);
void BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
BMLoop *edge_loop);
-int BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag);
-int BM_face_is_any_vert_flag_test(BMFace *f, const char hflag);
-int BM_face_is_any_edge_flag_test(BMFace *f, const char hflag);
+bool BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag);
+bool BM_face_is_any_vert_flag_test(BMFace *f, const char hflag);
+bool BM_face_is_any_edge_flag_test(BMFace *f, const char hflag);
#endif /* __BMESH_QUERIES_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c
index b58e61a3066..2f568a498c5 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -40,16 +40,16 @@
* MISC utility functions.
*/
-int bmesh_vert_in_edge(BMEdge *e, BMVert *v)
+bool bmesh_vert_in_edge(BMEdge *e, BMVert *v)
{
- if (e->v1 == v || e->v2 == v) return TRUE;
- return FALSE;
+ if (e->v1 == v || e->v2 == v) return true;
+ return false;
}
-int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
+bool bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
{
- if (e->v1 == v1 && e->v2 == v2) return TRUE;
- else if (e->v1 == v2 && e->v2 == v1) return TRUE;
- return FALSE;
+ if (e->v1 == v1 && e->v2 == v2) return true;
+ else if (e->v1 == v2 && e->v2 == v1) return true;
+ return false;
}
BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v)
@@ -63,19 +63,19 @@ BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v)
return NULL;
}
-int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
+bool bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
{
if (e->v1 == orig) {
e->v1 = newv;
e->v1_disk_link.next = e->v1_disk_link.prev = NULL;
- return TRUE;
+ return true;
}
else if (e->v2 == orig) {
e->v2 = newv;
e->v2_disk_link.next = e->v2_disk_link.prev = NULL;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/**
@@ -165,7 +165,7 @@ BLI_INLINE BMDiskLink *bmesh_disk_edge_link_from_vert(BMEdge *e, BMVert *v)
}
}
-int bmesh_disk_edge_append(BMEdge *e, BMVert *v)
+void bmesh_disk_edge_append(BMEdge *e, BMVert *v)
{
if (!v->e) {
BMDiskLink *dl1 = bmesh_disk_edge_link_from_vert(e, v);
@@ -187,8 +187,6 @@ int bmesh_disk_edge_append(BMEdge *e, BMVert *v)
if (dl3)
dl3->next = e;
}
-
- return TRUE;
}
void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
@@ -280,23 +278,23 @@ int bmesh_disk_count(BMVert *v)
}
}
-int bmesh_disk_validate(int len, BMEdge *e, BMVert *v)
+bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v)
{
BMEdge *e_iter;
if (!BM_vert_in_edge(e, v))
- return FALSE;
+ return false;
if (bmesh_disk_count(v) != len || len == 0)
- return FALSE;
+ return false;
e_iter = e;
do {
if (len != 1 && bmesh_disk_edge_prev(e_iter, v) == e_iter) {
- return FALSE;
+ return false;
}
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e);
- return TRUE;
+ return true;
}
/**
@@ -362,34 +360,34 @@ BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v)
}
/*****radial cycle functions, e.g. loops surrounding edges**** */
-int bmesh_radial_validate(int radlen, BMLoop *l)
+bool bmesh_radial_validate(int radlen, BMLoop *l)
{
BMLoop *l_iter = l;
int i = 0;
if (bmesh_radial_length(l) != radlen)
- return FALSE;
+ return false;
do {
if (UNLIKELY(!l_iter)) {
BMESH_ASSERT(0);
- return FALSE;
+ return false;
}
if (l_iter->e != l->e)
- return FALSE;
+ return false;
if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2)
- return FALSE;
+ return false;
if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) {
BMESH_ASSERT(0);
- return FALSE;
+ return false;
}
i++;
} while ((l_iter = l_iter->radial_next) != l);
- return TRUE;
+ return true;
}
/**
@@ -511,7 +509,7 @@ void bmesh_radial_append(BMEdge *e, BMLoop *l)
l->e = e;
}
-int bmesh_radial_face_find(BMEdge *e, BMFace *f)
+bool bmesh_radial_face_find(BMEdge *e, BMFace *f)
{
BMLoop *l_iter;
int i, len;
@@ -519,9 +517,9 @@ int bmesh_radial_face_find(BMEdge *e, BMFace *f)
len = bmesh_radial_length(e->l);
for (i = 0, l_iter = e->l; i < len; i++, l_iter = l_iter->radial_next) {
if (l_iter->f == f)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/**
@@ -545,7 +543,7 @@ int bmesh_radial_facevert_count(BMLoop *l, BMVert *v)
}
/*****loop cycle functions, e.g. loops surrounding a face**** */
-int bmesh_loop_validate(BMFace *f)
+bool bmesh_loop_validate(BMFace *f)
{
int i;
int len = f->len;
@@ -554,7 +552,7 @@ int bmesh_loop_validate(BMFace *f)
l_first = BM_FACE_FIRST_LOOP(f);
if (l_first == NULL) {
- return FALSE;
+ return false;
}
/* Validate that the face loop cycle is the length specified by f->len */
@@ -562,22 +560,22 @@ int bmesh_loop_validate(BMFace *f)
if ((l_iter->f != f) ||
(l_iter == l_first))
{
- return FALSE;
+ return false;
}
}
if (l_iter != l_first) {
- return FALSE;
+ return false;
}
/* Validate the loop->prev links also form a cycle of length f->len */
for (i = 1, l_iter = l_first->prev; i < len; i++, l_iter = l_iter->prev) {
if (l_iter == l_first) {
- return FALSE;
+ return false;
}
}
if (l_iter != l_first) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h
index b19df4660b8..e67f1e4fb49 100644
--- a/source/blender/bmesh/intern/bmesh_structure.h
+++ b/source/blender/bmesh/intern/bmesh_structure.h
@@ -42,10 +42,10 @@
struct ListBase;
/* LOOP CYCLE MANAGEMENT */
-int bmesh_loop_validate(BMFace *f);
+bool bmesh_loop_validate(BMFace *f);
/* DISK CYCLE MANAGMENT */
-int bmesh_disk_edge_append(BMEdge *e, BMVert *v);
+void bmesh_disk_edge_append(BMEdge *e, BMVert *v);
void bmesh_disk_edge_remove(BMEdge *e, BMVert *v);
BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v);
BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v);
@@ -60,19 +60,19 @@ void bmesh_radial_loop_remove(BMLoop *l, BMEdge *e);
* bmesh_radial_loop_next(BMLoop *l) / prev.
* just use member access l->radial_next, l->radial_prev now */
-int bmesh_radial_face_find(BMEdge *e, BMFace *f);
+bool bmesh_radial_face_find(BMEdge *e, BMFace *f);
int bmesh_radial_facevert_count(BMLoop *l, BMVert *v);
BMLoop *bmesh_radial_faceloop_find_first(BMLoop *l, BMVert *v);
BMLoop *bmesh_radial_faceloop_find_next(BMLoop *l, BMVert *v);
BMLoop *bmesh_radial_faceloop_find_vert(BMFace *f, BMVert *v);
-int bmesh_radial_validate(int radlen, BMLoop *l);
+bool bmesh_radial_validate(int radlen, BMLoop *l);
/* EDGE UTILITIES */
-int bmesh_vert_in_edge(BMEdge *e, BMVert *v);
-int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
-int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv); /*relink edge*/
+bool bmesh_vert_in_edge(BMEdge *e, BMVert *v);
+bool bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
+bool bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv); /* relink edge */
BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v);
BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2);
-int bmesh_disk_validate(int len, BMEdge *e, BMVert *v);
+bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v);
#endif /* __BMESH_STRUCTURE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 538a9058ed5..bbe02a49967 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -34,42 +34,42 @@
#include "intern/bmesh_private.h"
#include "intern/bmesh_walkers_private.h"
-static int bmw_mask_check_vert(BMWalker *walker, BMVert *v)
+static bool bmw_mask_check_vert(BMWalker *walker, BMVert *v)
{
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
- return FALSE;
+ return false;
}
else if (walker->mask_vert && !BMO_elem_flag_test(walker->bm, v, walker->mask_vert)) {
- return FALSE;
+ return false;
}
else {
- return TRUE;
+ return true;
}
}
-static int bmw_mask_check_edge(BMWalker *walker, BMEdge *e)
+static bool bmw_mask_check_edge(BMWalker *walker, BMEdge *e)
{
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
- return FALSE;
+ return false;
}
else if (walker->mask_edge && !BMO_elem_flag_test(walker->bm, e, walker->mask_edge)) {
- return FALSE;
+ return false;
}
else {
- return TRUE;
+ return true;
}
}
-static int bmw_mask_check_face(BMWalker *walker, BMFace *f)
+static bool bmw_mask_check_face(BMWalker *walker, BMFace *f)
{
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
- return FALSE;
+ return false;
}
else if (walker->mask_face && !BMO_elem_flag_test(walker->bm, f, walker->mask_face)) {
- return FALSE;
+ return false;
}
else {
- return TRUE;
+ return true;
}
}
@@ -164,7 +164,7 @@ static void *bmw_ShellWalker_step(BMWalker *walker)
{
BMEdge *curedge, *next = NULL;
BMVert *ov = NULL;
- int restrictpass = 1;
+ bool restrictpass = true;
BMwShellWalker shellWalk = *((BMwShellWalker *)BMW_current_state(walker));
if (!BLI_ghash_haskey(walker->visithash, shellWalk.base)) {
@@ -447,7 +447,7 @@ static void bmw_LoopWalker_begin(BMWalker *walker, void *data)
lwalk->is_single = (vert_edge_count[0] == 2 && vert_edge_count[1] == 2);
/* could also check that vertex*/
- if ((lwalk->is_boundary == FALSE) &&
+ if ((lwalk->is_boundary == false) &&
(vert_edge_count[0] == 3 || vert_edge_count[1] == 3))
{
BMIter iter;
@@ -548,19 +548,19 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
/* typical loopiong over edges in the middle of a mesh */
/* however, why use 2 here at all? I guess for internal ngon loops it can be useful. Antony R. */
- ((vert_edge_tot == 4 || vert_edge_tot == 2) && owalk.is_boundary == FALSE) ||
+ ((vert_edge_tot == 4 || vert_edge_tot == 2) && owalk.is_boundary == false) ||
/* walk over boundary of faces but stop at corners */
- (owalk.is_boundary == TRUE && owalk.is_single == FALSE && vert_edge_tot > 2) ||
+ (owalk.is_boundary == true && owalk.is_single == false && vert_edge_tot > 2) ||
/* initial edge was a boundary, so is this edge and vertex is only apart of this face
* this lets us walk over the the boundary of an ngon which is handy */
- (owalk.is_boundary == TRUE && owalk.is_single == TRUE && vert_edge_tot == 2 && BM_edge_is_boundary(e)))
+ (owalk.is_boundary == true && owalk.is_single == true && vert_edge_tot == 2 && BM_edge_is_boundary(e)))
{
i = 0;
stopi = vert_edge_tot / 2;
while (1) {
- if ((owalk.is_boundary == FALSE) && (i == stopi)) {
+ if ((owalk.is_boundary == false) && (i == stopi)) {
break;
}
@@ -589,7 +589,7 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
bmw_mask_check_edge(walker, l->e) &&
!BLI_ghash_haskey(walker->visithash, l->e))
{
- if (!(owalk.is_boundary == FALSE && i != stopi)) {
+ if (!(owalk.is_boundary == false && i != stopi)) {
lwalk = BMW_state_add(walker);
lwalk->cur = l->e;
lwalk->lastv = v;
@@ -642,47 +642,47 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
/* Check whether the face loop should includes the face specified
* by the given BMLoop */
-static int bmw_FaceLoopWalker_include_face(BMWalker *walker, BMLoop *l)
+static bool bmw_FaceLoopWalker_include_face(BMWalker *walker, BMLoop *l)
{
/* face must have degree 4 */
if (l->f->len != 4) {
- return FALSE;
+ return false;
}
if (!bmw_mask_check_face(walker, l->f)) {
- return FALSE;
+ return false;
}
/* the face must not have been already visite */
if (BLI_ghash_haskey(walker->visithash, l->f) && BLI_ghash_haskey(walker->secvisithash, l->e)) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/* Check whether the face loop can start from the given edge */
-static int bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
+static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
{
/* There is no face loop starting from a wire edge */
if (BM_edge_is_wire(e)) {
- return FALSE;
+ return false;
}
/* Don't start a loop from a boundary edge if it cannot
* be extended to cover any faces */
if (BM_edge_is_boundary(e)) {
if (!bmw_FaceLoopWalker_include_face(walker, e->l)) {
- return FALSE;
+ return false;
}
}
/* Don't start a face loop from non-manifold edges */
if (!BM_edge_is_manifold(e)) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
@@ -697,7 +697,7 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
lwalk = BMW_state_add(walker);
lwalk->l = e->l;
- lwalk->nocalc = 0;
+ lwalk->no_calc = false;
BLI_ghash_insert(walker->visithash, lwalk->l->f, NULL);
/* rewin */
@@ -708,7 +708,7 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
lwalk = BMW_state_add(walker);
*lwalk = owalk;
- lwalk->nocalc = 0;
+ lwalk->no_calc = false;
BLI_ghash_free(walker->secvisithash, NULL, NULL);
walker->secvisithash = BLI_ghash_ptr_new("bmesh walkers 3");
@@ -740,7 +740,7 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker)
l = l->radial_next;
- if (lwalk->nocalc) {
+ if (lwalk->no_calc) {
return f;
}
@@ -758,11 +758,11 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker)
lwalk->l = l;
if (l->f->len != 4) {
- lwalk->nocalc = 1;
+ lwalk->no_calc = true;
lwalk->l = origl;
}
else {
- lwalk->nocalc = 0;
+ lwalk->no_calc = false;
}
BLI_ghash_insert(walker->secvisithash, l->e, NULL);
diff --git a/source/blender/bmesh/intern/bmesh_walkers_private.h b/source/blender/bmesh/intern/bmesh_walkers_private.h
index fc563932c3c..09dd4f18d89 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_private.h
+++ b/source/blender/bmesh/intern/bmesh_walkers_private.h
@@ -62,14 +62,14 @@ typedef struct BMwLoopWalker {
BMEdge *cur, *start;
BMVert *lastv, *startv;
BMFace *f_hub;
- short is_boundary; /* boundary looping changes behavior */
- short is_single; /* single means the edge verts are only connected to 1 face */
+ bool is_boundary; /* boundary looping changes behavior */
+ bool is_single; /* single means the edge verts are only connected to 1 face */
} BMwLoopWalker;
typedef struct BMwFaceLoopWalker {
BMwGenericWalker header;
BMLoop *l;
- int nocalc;
+ bool no_calc;
} BMwFaceLoopWalker;
typedef struct BMwEdgeringWalker {
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index eb8e84da63f..c56af821a93 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -34,7 +34,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
{
const float offset = BMO_slot_float_get(op->slots_in, "offset");
const int seg = BMO_slot_int_get(op->slots_in, "segments");
- const int vonly = BMO_slot_bool_get(op->slots_in, "vertex_only");
+ const bool vonly = BMO_slot_bool_get(op->slots_in, "vertex_only");
if (offset > 0) {
BMOIter siter;
@@ -43,7 +43,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
/* first flush 'geom' into flags, this makes it possible to check connected data,
* BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
- BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index c7cd1e742d8..3a0e18b9ee5 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -106,7 +106,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
}
for (i = 0; i < BLI_array_count(verts_pair); i++) {
- nf = BM_face_split(bm, f, verts_pair[i][0], verts_pair[i][1], &nl, NULL, FALSE);
+ nf = BM_face_split(bm, f, verts_pair[i][0], verts_pair[i][1], &nl, NULL, false);
f = nf;
if (!nl || !nf) {
@@ -221,7 +221,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
int c = 0, cl1 = 0, cl2 = 0;
/* merge-bridge support */
- const int use_merge = BMO_slot_bool_get(op->slots_in, "use_merge");
+ const bool use_merge = BMO_slot_bool_get(op->slots_in, "use_merge");
const float merge_factor = BMO_slot_float_get(op->slots_in, "merge_factor");
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
@@ -508,7 +508,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
vv2[i2],
vv2[i2next],
vv1[i1next],
- f_example, TRUE);
+ f_example, true);
if (UNLIKELY((f == NULL) || (f->len != 4))) {
fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
}
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index 2ea5914ca92..ae07c2cf0bc 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -87,8 +87,8 @@ BLI_INLINE BMDiskLink *rs_edge_link_get(BMEdge *e, BMVert *v, EdgeData *e_data)
&(((EdgeData *)e_data)->v2_disk_link);
}
-static int rotsys_append_edge(BMEdge *e, BMVert *v,
- EdgeData *edata, VertData *vdata)
+static bool rotsys_append_edge(BMEdge *e, BMVert *v,
+ EdgeData *edata, VertData *vdata)
{
EdgeData *ed = &edata[BM_elem_index_get(e)];
VertData *vd = &vdata[BM_elem_index_get(v)];
@@ -116,7 +116,7 @@ static int rotsys_append_edge(BMEdge *e, BMVert *v,
}
}
- return TRUE;
+ return true;
}
static void UNUSED_FUNCTION(rotsys_remove_edge)(BMEdge *e, BMVert *v,
@@ -613,10 +613,10 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
BM_elem_index_set(v2, -1); /* set_dirty! */
//BM_edge_create(bm, cv, v2, NULL, 0);
- BM_vert_select_set(bm, v2, TRUE);
+ BM_vert_select_set(bm, v2, true);
if (lastv) {
e2 = BM_edge_create(bm, lastv, v2, NULL, 0);
- BM_edge_select_set(bm, e2, TRUE);
+ BM_edge_select_set(bm, e2, true);
}
lastv = v2;
@@ -742,7 +742,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
BMVert *endv;
EPathNode *node;
int i;
- const int use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
+ const bool use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
BMOpSlot *slot_restrict = BMO_slot_get(op->slots_in, "restrict");
@@ -899,10 +899,10 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
BMEdge **edges = NULL;
PathBase *pathbase;
BLI_array_declare(edges);
- int use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
- int use_fill_check = BMO_slot_bool_get(op->slots_in, "use_fill_check");
- const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
- const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
+ const bool use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
+ const bool use_fill_check = BMO_slot_bool_get(op->slots_in, "use_fill_check");
+ const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
+ const bool use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
int i, j, group = 0;
unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
BMOpSlot *slot_restrict = BMO_slot_get(op->slots_in, "restrict");
@@ -1047,9 +1047,9 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
v2 = verts[0];
}
- if ((use_fill_check == FALSE) ||
+ if ((use_fill_check == false) ||
/* fairly expensive check - see if there are already faces filling this area */
- (BM_face_exists_multi_edge(edges, i) == FALSE))
+ (BM_face_exists_multi_edge(edges, i) == false))
{
f = BM_face_create_ngon(bm, v1, v2, edges, i, BM_CREATE_NO_DOUBLE);
if (f && !BMO_elem_flag_test(bm, f, ELE_ORIG)) {
@@ -1287,7 +1287,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMFace *f;
int totv = 0, tote = 0, totf = 0, amount;
const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
- const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
+ const bool use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
/* count number of each element type we were passe */
BMO_ITER (h, &oiter, op->slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE) {
@@ -1321,7 +1321,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
if (totf == 0 && totv >= 4 && totv == tote + 2) {
/* find a free standing vertex and 2 endpoint verts */
BMVert *v_free = NULL, *v_a = NULL, *v_b = NULL;
- int ok = TRUE;
+ bool ok = true;
BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
@@ -1339,26 +1339,26 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
if (tot_edges == 0) {
/* only accept 1 free vert */
if (v_free == NULL) v_free = v;
- else ok = FALSE; /* only ever want one of these */
+ else ok = false; /* only ever want one of these */
}
else if (tot_edges == 1) {
if (v_a == NULL) v_a = v;
else if (v_b == NULL) v_b = v;
- else ok = FALSE; /* only ever want 2 of these */
+ else ok = false; /* only ever want 2 of these */
}
else if (tot_edges == 2) {
/* do nothing, regular case */
}
else {
- ok = FALSE; /* if a vertex has 3+ edge users then cancel - this is only simple cases */
+ ok = false; /* if a vertex has 3+ edge users then cancel - this is only simple cases */
}
- if (ok == FALSE) {
+ if (ok == false) {
break;
}
}
- if (ok == TRUE && v_free && v_a && v_b) {
+ if (ok == true && v_free && v_a && v_b) {
e = BM_edge_create(bm, v_free, v_a, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_NEW);
@@ -1377,7 +1377,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_initf(bm, &op2, op->flag,
"edgenet_fill edges=%fe use_fill_check=%b mat_nr=%i use_smooth=%b",
- ELE_NEW, TRUE, mat_nr, use_smooth);
+ ELE_NEW, true, mat_nr, use_smooth);
BMO_op_exec(bm, &op2);
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index d23c6d7332a..47b2497816f 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -41,7 +41,7 @@
#define VERT_MARK 1
-static int UNUSED_FUNCTION(check_hole_in_region) (BMesh * bm, BMFace * f)
+static bool UNUSED_FUNCTION(check_hole_in_region) (BMesh * bm, BMFace * f)
{
BMWalker regwalker;
BMIter liter2;
@@ -62,14 +62,14 @@ static int UNUSED_FUNCTION(check_hole_in_region) (BMesh * bm, BMFace * f)
BMO_elem_flag_test(bm, l2->f, FACE_MARK))
{
if (!BMO_elem_flag_test(bm, l2->e, EDGE_MARK)) {
- return FALSE;
+ return false;
}
}
}
}
BMW_end(&regwalker);
- return TRUE;
+ return true;
}
void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
@@ -83,7 +83,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMWalker regwalker;
int i;
- int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
+ const bool use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
if (use_verts) {
/* tag verts that start out with only 2 edges,
@@ -147,7 +147,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
while (faces[tot])
tot++;
- f = BM_faces_join(bm, faces, tot, TRUE);
+ f = BM_faces_join(bm, faces, tot, true);
if (!f) {
BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED,
"Could not create merged face");
@@ -171,7 +171,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
if (BM_vert_edge_count(v) == 2) {
- BM_vert_collapse_edge(bm, v->e, v, TRUE);
+ BM_vert_collapse_edge(bm, v->e, v, true);
}
}
}
@@ -212,7 +212,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
/* BMESH_TODO - check on delaying edge removal since we may end up removing more then
* one edge, and later reference a removed edge */
- BM_faces_join_pair(bm, fa, fb, e, TRUE);
+ BM_faces_join_pair(bm, fa, fb, e, true);
}
}
@@ -225,7 +225,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
/* clean up extreneous 2-valence vertice */
for (i = 0; i < BLI_array_count(verts); i++) {
if (verts[i]->e) {
- BM_vert_collapse_edge(bm, verts[i]->e, verts[i], TRUE);
+ BM_vert_collapse_edge(bm, verts[i]->e, verts[i], true);
}
}
@@ -251,7 +251,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
BMIter viter;
BMVert *v;
- int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
+ const bool use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
if (use_verts) {
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
@@ -268,7 +268,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
/* BMESH_TODO - check on delaying edge removal since we may end up removing more then
* one edge, and later reference a removed edge */
- BM_faces_join_pair(bm, fa, fb, e, TRUE);
+ BM_faces_join_pair(bm, fa, fb, e, true);
}
}
@@ -276,20 +276,20 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
if (BM_vert_edge_count(v) == 2) {
- BM_vert_collapse_edge(bm, v->e, v, TRUE);
+ BM_vert_collapse_edge(bm, v->e, v, true);
}
}
}
}
}
-static int test_extra_verts(BMesh *bm, BMVert *v)
+static bool test_extra_verts(BMesh *bm, BMVert *v)
{
BMIter iter, liter, iter2, iter3;
BMFace *f, *f2;
BMLoop *l;
BMEdge *e;
- int found;
+ bool found;
/* test faces around verts for verts that would be wrongly killed
* by dissolve faces. */
@@ -302,31 +302,31 @@ static int test_extra_verts(BMesh *bm, BMVert *v)
* then dissolve faces won't destroy it.
* also if it forms a boundary with one
* of the face region */
- found = FALSE;
+ found = false;
e = BM_iter_new(&iter2, bm, BM_EDGES_OF_VERT, l->v);
for ( ; e; e = BM_iter_step(&iter2)) {
if (BM_edge_is_boundary(e)) {
- found = TRUE;
+ found = true;
}
f2 = BM_iter_new(&iter3, bm, BM_FACES_OF_EDGE, e);
for ( ; f2; f2 = BM_iter_step(&iter3)) {
if (!BMO_elem_flag_test(bm, f2, FACE_MARK)) {
- found = TRUE;
+ found = true;
break;
}
}
- if (found == TRUE) {
+ if (found == true) {
break;
}
}
- if (found == FALSE) {
- return FALSE;
+ if (found == false) {
+ return false;
}
}
}
}
- return TRUE;
+ return true;
}
void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
{
@@ -346,9 +346,9 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
/* previously the faces were joined, but collapsing between 2 edges
* gives some advantage/difference in using vertex-dissolve over edge-dissolve */
#if 0
- BM_vert_collapse_faces(bm, v->e, v, 1.0f, TRUE, TRUE);
+ BM_vert_collapse_faces(bm, v->e, v, 1.0f, true, true);
#else
- BM_vert_collapse_edge(bm, v->e, v, TRUE);
+ BM_vert_collapse_edge(bm, v->e, v, true);
#endif
continue;
@@ -480,7 +480,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
const float angle_max = (float)M_PI / 2.0f;
const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op->slots_in, "angle_limit"));
- const int do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
+ const bool do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries,
(BMVert **)BMO_SLOT_AS_BUFFER(vinput), vinput->len,
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index f288901c272..1448129ccde 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -213,13 +213,13 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst)
!BMO_elem_flag_test(bm_src, v, DUPE_DONE))
{
BMIter iter;
- int isolated = 1;
+ bool isolated = true;
v2 = copy_vertex(bm_src, v, bm_dst, vhash);
BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) {
- isolated = 0;
+ isolated = false;
break;
}
}
@@ -227,7 +227,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst)
if (isolated) {
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT)) {
- isolated = 0;
+ isolated = false;
break;
}
}
@@ -386,7 +386,7 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
BMOperator *splitop = op;
BMOperator dupeop;
BMOperator delop;
- const short use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces");
+ const bool use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces");
/* initialize our sub-operator */
BMO_op_init(bm, &dupeop, op->flag, "duplicate");
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c
index b4b50a60877..378f790ef32 100644
--- a/source/blender/bmesh/operators/bmo_edgesplit.c
+++ b/source/blender/bmesh/operators/bmo_edgesplit.c
@@ -37,17 +37,17 @@
/* keep this operator fast, its used in a modifier */
void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
{
- const int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
+ const bool use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
- BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, false);
if (use_verts) {
/* this slows down the operation but its ok because the modifier doesn't use */
- BMO_slot_buffer_hflag_enable(bm, op->slots_in, "verts", BM_VERT, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "verts", BM_VERT, BM_ELEM_TAG, false);
}
/* this is where everything happens */
- BM_mesh_edgesplit(bm, use_verts, TRUE);
+ BM_mesh_edgesplit(bm, use_verts, true);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_INTERNAL_TAG);
}
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 2cca3fcb24a..4fde6150f05 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -112,7 +112,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
l3 = l->next;
l4 = l2->next;
- f3 = BM_face_create_quad_tri(bm, l3->v, l4->v, l2->v, l->v, f, FALSE);
+ f3 = BM_face_create_quad_tri(bm, l3->v, l4->v, l2->v, l->v, f, false);
/* XXX, no error check here, why? - Campbell */
l_tmp = BM_FACE_FIRST_LOOP(f3);
@@ -225,7 +225,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
f_verts[3] = e_new->v2;
}
/* not sure what to do about example face, pass NULL for now */
- f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, FALSE);
+ f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, false);
bm_extrude_copy_face_loop_attributes(bm, f);
if (BMO_elem_flag_test(bm, e, EXT_INPUT))
@@ -248,7 +248,7 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
BMOIter siter;
BMVert *v, *dupev;
BMEdge *e;
- const int has_vskin = CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN);
+ const bool has_vskin = CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN);
for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
dupev = BM_vert_create(bm, v->co, v, 0);
@@ -273,7 +273,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
BMEdge *e, *e_new;
BMVert *v, *v2;
BMFace *f;
- int found, fwd, delorig = FALSE;
+ bool found, fwd, delorig = false;
BMOpSlot *slot_facemap_out;
BMOpSlot *slot_edges_exclude;
@@ -293,20 +293,20 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
continue;
}
- found = FALSE; /* found a face that isn't input? */
+ found = false; /* found a face that isn't input? */
edge_face_tot = 0; /* edge/face count */
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) {
- found = TRUE;
- delorig = TRUE;
+ found = true;
+ delorig = true;
break;
}
edge_face_tot++;
}
- if ((edge_face_tot > 1) && (found == FALSE)) {
+ if ((edge_face_tot > 1) && (found == false)) {
/* edge has a face user, that face isn't extrude input */
BMO_elem_flag_enable(bm, e, EXT_DEL);
}
@@ -316,26 +316,26 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* calculate verts to delete */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (v->e) { /* only deal with verts attached to geometry [#33651] */
- found = FALSE;
+ found = false;
BM_ITER_ELEM (e, &viter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, EXT_INPUT) || !BMO_elem_flag_test(bm, e, EXT_DEL)) {
- found = TRUE;
+ found = true;
break;
}
}
/* avoid an extra loop */
- if (found == TRUE) {
+ if (found == true) {
BM_ITER_ELEM (f, &viter, v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) {
- found = TRUE;
+ found = true;
break;
}
}
}
- if (found == FALSE) {
+ if (found == false) {
BMO_elem_flag_enable(bm, v, EXT_DEL);
}
}
@@ -347,7 +347,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
}
- if (delorig == TRUE) {
+ if (delorig == true) {
BMO_op_initf(bm, &delop, op->flag,
"delete geom=%fvef context=%i",
EXT_DEL, DEL_ONLYTAGGED);
@@ -435,7 +435,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
/* not sure what to do about example face, pass NULL for now */
- f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, FALSE);
+ f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, false);
bm_extrude_copy_face_loop_attributes(bm, f);
}
@@ -665,7 +665,7 @@ void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &reverseop);
/* Extrude the region */
- BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region use_keep_orig=%b", TRUE);
+ BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region use_keep_orig=%b", true);
BMO_slot_copy(op, slots_in, "geom",
&extrudeop, slots_in, "geom");
BMO_op_exec(bm, &extrudeop);
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index e2da4f4f89c..5d8689b9da6 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -136,12 +136,12 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
}
/* Create new hull face */
- f = BM_face_create_quad_tri_v(bm, t->v, 3, example, TRUE);
+ f = BM_face_create_quad_tri_v(bm, t->v, 3, example, true);
BM_face_copy_shared(bm, f);
}
/* Mark face for 'geom.out' slot and select */
BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
- BM_face_select_set(bm, f, TRUE);
+ BM_face_select_set(bm, f, true);
/* Mark edges for 'geom.out' slot */
for (i = 0; i < 3; i++) {
@@ -200,7 +200,7 @@ static int hull_final_edges_lookup(HullFinalEdges *final_edges,
adj = BLI_ghash_lookup(final_edges->edges, v1);
if (!adj)
- return FALSE;
+ return false;
return !!final_edges_find_link(adj, v2);
}
@@ -268,17 +268,17 @@ static void hull_remove_overlapping(BMesh *bm, GHash *hull_triangles,
HullTriangle *t = BLI_ghashIterator_getKey(&hull_iter);
BMIter bm_iter1, bm_iter2;
BMFace *f;
- int f_on_hull;
+ bool f_on_hull;
BM_ITER_ELEM (f, &bm_iter1, t->v[0], BM_FACES_OF_VERT) {
BMEdge *e;
/* Check that all the face's edges are on the hull,
* otherwise can't reuse it */
- f_on_hull = TRUE;
+ f_on_hull = true;
BM_ITER_ELEM (e, &bm_iter2, f, BM_EDGES_OF_FACE) {
if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) {
- f_on_hull = FALSE;
+ f_on_hull = false;
break;
}
}
@@ -288,7 +288,7 @@ static void hull_remove_overlapping(BMesh *bm, GHash *hull_triangles,
if (BM_vert_in_face(f, t->v[1]) &&
BM_vert_in_face(f, t->v[2]) && f_on_hull)
{
- t->skip = TRUE;
+ t->skip = true;
BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
BMO_elem_flag_enable(bm, f, HULL_FLAG_HOLE);
}
@@ -330,18 +330,18 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
* input set */
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
if (BMO_elem_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
- int del = TRUE;
+ bool del = true;
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, HULL_FLAG_INPUT)) {
- del = FALSE;
+ del = false;
break;
}
}
BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT)) {
- del = FALSE;
+ del = false;
break;
}
}
@@ -353,11 +353,11 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
if (BMO_elem_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
- int del = TRUE;
+ bool del = true;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT)) {
- del = FALSE;
+ del = false;
break;
}
}
@@ -396,13 +396,13 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
/* Mark edges too if all adjacent faces are holes and the edge is
* not already isolated */
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
- int hole = TRUE;
- int any_faces = FALSE;
+ bool hole = true;
+ bool any_faces = false;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
- any_faces = TRUE;
+ any_faces = true;
if (!BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
- hole = FALSE;
+ hole = false;
break;
}
}
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index cef1181f63b..ef99dae5ac9 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -92,13 +92,13 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
void bmo_inset_exec(BMesh *bm, BMOperator *op)
{
- const int use_outset = BMO_slot_bool_get(op->slots_in, "use_outset");
- const int use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == FALSE);
- const int use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
- const int use_even_boundry = use_even_offset; /* could make own option */
- const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
- const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
- const float depth = BMO_slot_float_get(op->slots_in, "depth");
+ const bool use_outset = BMO_slot_bool_get(op->slots_in, "use_outset");
+ const bool use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == false);
+ const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
+ const bool use_even_boundry = use_even_offset; /* could make own option */
+ const bool use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
+ const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
+ const float depth = BMO_slot_float_get(op->slots_in, "depth");
int edge_info_len = 0;
@@ -111,13 +111,13 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
BMFace *f;
int i, j, k;
- if (use_outset == FALSE) {
- BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ if (use_outset == false) {
+ BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);
+ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
}
else {
- BM_mesh_elem_hflag_enable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_slot_buffer_hflag_disable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_enable_all(bm, BM_FACE, BM_ELEM_TAG, false);
+ BMO_slot_buffer_hflag_disable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
}
/* first count all inset edges we will split */
@@ -411,11 +411,11 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
/* this saves expensive/slow glue check for common cases */
if (r_vout_len > 2) {
- int ok = TRUE;
+ bool ok = true;
/* last step, NULL this vertex if has a tagged face */
BM_ITER_ELEM (f, &iter, v_split, BM_FACES_OF_VERT) {
if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
- ok = FALSE;
+ ok = false;
break;
}
}
@@ -471,7 +471,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
#endif
/* no need to check doubles, we KNOW there won't be any */
/* yes - reverse face is correct in this case */
- f = BM_face_create_quad_tri_v(bm, varr, j, es->l->f, FALSE);
+ f = BM_face_create_quad_tri_v(bm, varr, j, es->l->f, false);
BMO_elem_flag_enable(bm, f, ELE_NEW);
/* copy for loop data, otherwise UV's and vcols are no good.
@@ -548,7 +548,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
/* done correcting edge verts normals */
/* untag verts */
- BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, false);
/* tag face verts */
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
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);
}
}
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index 4b897a24c8a..fa8beb3716c 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -53,9 +53,9 @@
void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
{
- Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
- Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
- int set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
+ Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
+ Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
+ bool set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
BM_mesh_bm_from_me(bm, me, set_key, ob->shapenr);
@@ -72,14 +72,14 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, op->flag,
"bmesh_to_mesh mesh=%p object=%p skip_tessface=%b",
- me, ob, TRUE);
+ me, ob, true);
}
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
{
Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
/* Object *ob = BMO_slot_ptr_get(op, "object"); */
- int dotess = !BMO_slot_bool_get(op->slots_in, "skip_tessface");
+ const bool dotess = !BMO_slot_bool_get(op->slots_in, "skip_tessface");
BM_mesh_bm_to_me(bm, me, dotess);
}
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index 61b061dd21f..48b2f76665c 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -53,8 +53,8 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
float dist = BMO_slot_float_get(op->slots_in, "merge_dist");
int i, ototvert /*, ototedge */;
int axis = BMO_slot_int_get(op->slots_in, "axis");
- int mirroru = BMO_slot_bool_get(op->slots_in, "mirror_u");
- int mirrorv = BMO_slot_bool_get(op->slots_in, "mirror_v");
+ bool mirror_u = BMO_slot_bool_get(op->slots_in, "mirror_u");
+ bool mirror_v = BMO_slot_bool_get(op->slots_in, "mirror_v");
BMOpSlot *slot_targetmap;
ototvert = bm->totvert;
@@ -97,7 +97,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
v = BM_iter_step(&iter);
}
- if (mirroru || mirrorv) {
+ if (mirror_u || mirror_v) {
BMFace *f;
BMLoop *l;
MLoopUV *luv;
@@ -109,9 +109,9 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV);
for (i = 0; i < totlayer; i++) {
luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i);
- if (mirroru)
+ if (mirror_u)
luv->uv[0] = 1.0f - luv->uv[0];
- if (mirrorv)
+ if (mirror_v)
luv->uv[1] = 1.0f - luv->uv[1];
}
}
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index c582f710f43..011002718d3 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -420,7 +420,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
v2 = eva[icoface[a][1]];
v3 = eva[icoface[a][2]];
- eftemp = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, FALSE);
+ eftemp = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, false);
BM_ITER_ELEM (l, &liter, eftemp, BM_LOOPS_OF_FACE) {
BMO_elem_flag_enable(bm, l->e, EDGE_MARK);
@@ -438,7 +438,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
"cuts=%i "
"use_grid_fill=%b use_sphere=%b",
EDGE_MARK, dia, (1 << (subdiv - 1)) - 1,
- TRUE, TRUE);
+ true, true);
BMO_op_exec(bm, &bmop);
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
@@ -488,14 +488,14 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
tv[monkeyf[i][1] + i - monkeyo],
tv[monkeyf[i][2] + i - monkeyo],
(monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeyf[i][3] + i - monkeyo] : NULL,
- NULL, FALSE);
+ NULL, false);
BM_face_create_quad_tri(bm,
tv[monkeynv + monkeyf[i][2] + i - monkeyo],
tv[monkeynv + monkeyf[i][1] + i - monkeyo],
tv[monkeynv + monkeyf[i][0] + i - monkeyo],
(monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeynv + monkeyf[i][3] + i - monkeyo] : NULL,
- NULL, FALSE);
+ NULL, false);
}
MEM_freeN(tv);
@@ -508,8 +508,8 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
{
const float dia = BMO_slot_float_get(op->slots_in, "diameter");
const int segs = BMO_slot_int_get(op->slots_in, "segments");
- const int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
- const int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
+ const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
+ const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL;
float vec[3], mat[4][4], phi, phid;
@@ -547,7 +547,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
if (a && cap_ends) {
BMFace *f;
- f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, FALSE);
+ f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, false);
BMO_elem_flag_enable(bm, f, FACE_NEW);
}
@@ -565,7 +565,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
if (cap_ends) {
BMFace *f;
- f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, FALSE);
+ f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, false);
BMO_elem_flag_enable(bm, f, FACE_NEW);
}
@@ -584,8 +584,8 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
float dia2 = BMO_slot_float_get(op->slots_in, "diameter2");
float depth = BMO_slot_float_get(op->slots_in, "depth");
int segs = BMO_slot_int_get(op->slots_in, "segments");
- int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
- int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
+ const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
+ const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
int a;
if (!segs)
@@ -634,12 +634,12 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
if (cap_ends) {
BMFace *f;
- f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, FALSE);
+ f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, false);
BMO_elem_flag_enable(bm, f, FACE_NEW);
- f = BM_face_create_quad_tri(bm, cent2, v2, lastv2, NULL, NULL, FALSE);
+ f = BM_face_create_quad_tri(bm, cent2, v2, lastv2, NULL, NULL, false);
BMO_elem_flag_enable(bm, f, FACE_NEW);
}
- BM_face_create_quad_tri(bm, lastv1, lastv2, v2, v1, NULL, FALSE);
+ BM_face_create_quad_tri(bm, lastv1, lastv2, v2, v1, NULL, false);
}
else {
firstv1 = v1;
@@ -656,9 +656,9 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
if (cap_ends) {
BMFace *f;
- f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, FALSE);
+ f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, false);
BMO_elem_flag_enable(bm, f, FACE_NEW);
- f = BM_face_create_quad_tri(bm, cent2, firstv2, v2, NULL, NULL, FALSE);
+ f = BM_face_create_quad_tri(bm, cent2, firstv2, v2, NULL, NULL, false);
BMO_elem_flag_enable(bm, f, FACE_NEW);
}
@@ -666,7 +666,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
}
- BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
+ BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, false);
BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
@@ -738,14 +738,14 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, v8, VERT_MARK);
/* the four sides */
- BM_face_create_quad_tri(bm, v5, v6, v2, v1, NULL, FALSE);
- BM_face_create_quad_tri(bm, v6, v7, v3, v2, NULL, FALSE);
- BM_face_create_quad_tri(bm, v7, v8, v4, v3, NULL, FALSE);
- BM_face_create_quad_tri(bm, v8, v5, v1, v4, NULL, FALSE);
+ BM_face_create_quad_tri(bm, v5, v6, v2, v1, NULL, false);
+ BM_face_create_quad_tri(bm, v6, v7, v3, v2, NULL, false);
+ BM_face_create_quad_tri(bm, v7, v8, v4, v3, NULL, false);
+ BM_face_create_quad_tri(bm, v8, v5, v1, v4, NULL, false);
/* top/bottom */
- BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
- BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, FALSE);
+ BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, false);
+ BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, false);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 2f7011e6731..7beac676868 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -41,7 +41,7 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot
BMIter liter;
BMLoop *l;
BMVert *v2, *doub;
- int split = FALSE;
+ bool split = false;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
v2 = BMO_slot_map_elem_get(slot_targetmap, l->v);
@@ -52,14 +52,14 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot
(v2 != l->next->v))
{
doub = l->v;
- split = TRUE;
+ split = true;
break;
}
}
if (split && doub != v2) {
BMLoop *nl;
- BMFace *f2 = BM_face_split(bm, f, doub, v2, &nl, NULL, FALSE);
+ BMFace *f2 = BM_face_split(bm, f, doub, v2, &nl, NULL, false);
remdoubles_splitface(f, bm, op, slot_targetmap);
remdoubles_splitface(f2, bm, op, slot_targetmap);
@@ -87,12 +87,12 @@ int remdoubles_face_overlaps(BMesh *bm, BMVert **varr,
amount = BM_verts_in_face(bm, f, varr, len);
if (amount >= len) {
if (overlapface) *overlapface = f;
- return TRUE;
+ return true;
}
f = BM_iter_step(&vertfaces);
}
}
- return FALSE;
+ return false;
}
#endif
diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c
index 548e1adf17d..baabcffd162 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -185,21 +185,21 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < num_total; i++) {
fm = f_ext[i].f;
if (!BMO_elem_flag_test(bm, fm, FACE_MARK) && !BM_elem_flag_test(fm, BM_ELEM_HIDDEN)) {
- int cont = TRUE;
- for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
+ bool cont = true;
+ for (idx = 0; idx < num_sels && cont == true; idx++) {
fs = f_ext[indices[idx]].f;
switch (type) {
case SIMFACE_MATERIAL:
if (fm->mat_nr == fs->mat_nr) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
case SIMFACE_IMAGE:
if (f_ext[i].t == f_ext[indices[idx]].t) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -207,7 +207,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
angle = angle_normalized_v3v3(fs->no, fm->no); /* if the angle between the normals -> 0 */
if (angle <= thresh_radians) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -217,7 +217,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
delta_fl = f_ext[i].d - f_ext[indices[idx]].d;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
}
break;
@@ -226,7 +226,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
delta_fl = f_ext[i].area - f_ext[indices[idx]].area;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -234,7 +234,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
delta_i = fm->len - fs->len;
if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -242,7 +242,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
delta_fl = f_ext[i].perim - f_ext[indices[idx]].perim;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
default:
@@ -373,15 +373,15 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < num_total; i++) {
e = e_ext[i].e;
if (!BMO_elem_flag_test(bm, e, EDGE_MARK) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
- int cont = TRUE;
- for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
+ bool cont = true;
+ for (idx = 0; idx < num_sels && cont == true; idx++) {
es = e_ext[indices[idx]].e;
switch (type) {
case SIMEDGE_LENGTH:
delta_fl = e_ext[i].length - e_ext[indices[idx]].length;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -394,7 +394,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
if (angle / (float)(M_PI / 2.0) <= thresh) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -402,7 +402,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
delta_i = e_ext[i].faces - e_ext[indices[idx]].faces;
if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -411,12 +411,12 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
if (e_ext[indices[idx]].faces == 2) {
if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
}
}
else {
- cont = FALSE;
+ cont = false;
}
break;
@@ -430,7 +430,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
}
break;
@@ -445,7 +445,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
}
break;
@@ -453,14 +453,14 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
case SIMEDGE_SEAM:
if (BM_elem_flag_test(e, BM_ELEM_SEAM) == BM_elem_flag_test(es, BM_ELEM_SEAM)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
- cont = FALSE;
+ cont = false;
}
break;
case SIMEDGE_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 = FALSE;
+ cont = false;
}
break;
default:
@@ -562,15 +562,15 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < num_total; i++) {
v = v_ext[i].v;
if (!BMO_elem_flag_test(bm, v, VERT_MARK) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
- int cont = TRUE;
- for (idx = 0; idx < num_sels && cont == TRUE; idx++) {
+ bool cont = true;
+ for (idx = 0; idx < num_sels && cont == true; idx++) {
vs = v_ext[indices[idx]].v;
switch (type) {
case SIMVERT_NORMAL:
/* compare the angle between the normals */
if (angle_normalized_v3v3(v->no, vs->no) <= thresh_radians) {
BMO_elem_flag_enable(bm, v, VERT_MARK);
- cont = FALSE;
+ cont = false;
}
break;
case SIMVERT_FACE:
@@ -578,7 +578,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
delta_i = v_ext[i].num_faces - v_ext[indices[idx]].num_faces;
if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, v, VERT_MARK);
- cont = FALSE;
+ cont = false;
}
break;
@@ -586,7 +586,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
if (defvert_find_shared(v_ext[i].dvert, v_ext[indices[idx]].dvert) != -1) {
BMO_elem_flag_enable(bm, v, VERT_MARK);
- cont = FALSE;
+ cont = false;
}
}
break;
@@ -595,7 +595,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
delta_i = v_ext[i].num_edges - v_ext[indices[idx]].num_edges;
if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, v, VERT_MARK);
- cont = FALSE;
+ cont = false;
}
break;
default:
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index ce584686757..ba755a866de 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -180,7 +180,7 @@ static void init_laplacian_matrix(LaplacianSystem *sys)
float *v1, *v2, *v3, *v4;
float w1, w2, w3, w4;
int i, j;
- int has_4_vert;
+ bool has_4_vert;
unsigned int idv1, idv2, idv3, idv4, idv[4];
BMEdge *e;
BMFace *f;
@@ -297,7 +297,7 @@ static void fill_laplacian_matrix(LaplacianSystem *sys)
float *v1, *v2, *v3, *v4;
float w2, w3, w4;
int i, j;
- int has_4_vert;
+ bool has_4_vert;
unsigned int idv1, idv2, idv3, idv4, idv[4];
BMEdge *e;
@@ -537,7 +537,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
{
int i;
int m_vertex_id;
- int usex, usey, usez, preserve_volume;
+ bool usex, usey, usez, preserve_volume;
float lambda_factor, lambda_border;
float w;
BMOIter siter;
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 7407eb4423a..ff5fce8f5c5 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -90,7 +90,7 @@ static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v1, BMVert *v2, BMFace *
}
if (curf) {
- face = BM_face_split(bm, curf, v1, v2, &nl, NULL, FALSE);
+ face = BM_face_split(bm, curf, v1, v2, &nl, NULL, false);
if (r_nf) *r_nf = face;
return nl ? nl->e : NULL;
@@ -715,8 +715,8 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BMFace *face;
BLI_array_declare(verts);
float smooth, fractal, along_normal;
- int use_sphere, cornertype, use_single_edge, use_grid_fill, use_only_quads;
- int skey, seed, i, j, matched, a, b, numcuts, totesel;
+ bool use_sphere, use_single_edge, use_grid_fill, use_only_quads;
+ int cornertype, skey, seed, i, j, matched, a, b, numcuts, totesel;
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
@@ -983,7 +983,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BLI_array_grow_items(loops_split, numcuts);
for (j = 0; j < numcuts; j++) {
- int ok = TRUE;
+ bool ok = true;
/* Check for special case: [#32500]
* This edge pair could be used by more then one face,
@@ -1006,7 +1006,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BLI_assert(other_loop->prev->v != loops[a]->v);
BLI_assert(other_loop->next->v != loops[a]->v);
- ok = FALSE;
+ ok = false;
break;
}
}
@@ -1014,7 +1014,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
}
- if (ok == TRUE) {
+ if (ok == true) {
loops_split[j][0] = loops[a];
loops_split[j][1] = loops[b];
}
@@ -1036,10 +1036,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
for (j = 0; j < BLI_array_count(loops_split); j++) {
if (loops_split[j][0]) {
- BLI_assert(BM_edge_exists(loops_split[j][0]->v, loops_split[j][1]->v) == FALSE);
+ BLI_assert(BM_edge_exists(loops_split[j][0]->v, loops_split[j][1]->v) == NULL);
/* BMFace *nf = */ /* UNUSED */
- BM_face_split(bm, face, loops_split[j][0]->v, loops_split[j][1]->v, &nl, NULL, FALSE);
+ BM_face_split(bm, face, loops_split[j][0]->v, loops_split[j][1]->v, &nl, NULL, false);
}
}
@@ -1123,7 +1123,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
BMElem *ele;
for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
- BM_elem_select_set(bm, ele, TRUE);
+ BM_elem_select_set(bm, ele, true);
}
}
else if (seltype == SUBDIV_SELECT_LOOPCUT) {
@@ -1131,10 +1131,10 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
BMElem *ele;
/* deselect input */
- BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
- BM_elem_select_set(bm, ele, TRUE);
+ BM_elem_select_set(bm, ele, true);
if (ele->head.htype == BM_VERT) {
BMEdge *e;
@@ -1145,13 +1145,13 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
BM_elem_flag_test(e->v1, BM_ELEM_SELECT) &&
BM_elem_flag_test(e->v2, BM_ELEM_SELECT))
{
- BM_edge_select_set(bm, e, TRUE);
+ BM_edge_select_set(bm, e, true);
}
else if (BM_elem_flag_test(e, BM_ELEM_SELECT) &&
(!BM_elem_flag_test(e->v1, BM_ELEM_SELECT) ||
!BM_elem_flag_test(e->v2, BM_ELEM_SELECT)))
{
- BM_edge_select_set(bm, e, FALSE);
+ BM_edge_select_set(bm, e, false);
}
}
}
diff --git a/source/blender/bmesh/operators/bmo_symmetrize.c b/source/blender/bmesh/operators/bmo_symmetrize.c
index 172f0d40b27..0bfc81f83cf 100644
--- a/source/blender/bmesh/operators/bmo_symmetrize.c
+++ b/source/blender/bmesh/operators/bmo_symmetrize.c
@@ -176,7 +176,7 @@ static void symm_split_asymmetric_edges(Symm *symm)
plane_co[symm->axis][0],
plane_co[symm->axis][1],
plane_co[symm->axis][2],
- &lambda, TRUE);
+ &lambda, true);
BLI_assert(r);
madd_v3_v3v3fl(co, e->v1->co, edge_dir, lambda);
@@ -244,7 +244,7 @@ typedef struct {
int len;
/* True only if none of the polygon's edges were split */
- int already_symmetric;
+ bool already_symmetric;
BMFace *src_face;
} SymmPoly;
@@ -261,11 +261,11 @@ static void symm_poly_with_splits(const Symm *symm,
/* Count vertices and check for edge splits */
out->len = f->len;
- out->already_symmetric = TRUE;
+ out->already_symmetric = true;
BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
if (BLI_ghash_haskey(symm->edge_split_map, l->e)) {
out->len++;
- out->already_symmetric = FALSE;
+ out->already_symmetric = false;
}
}
@@ -332,11 +332,11 @@ static BMVert *symm_poly_mirror_dst(const Symm *symm,
return NULL;
}
-static int symm_poly_next_crossing(const Symm *symm,
- const SymmPoly *sp,
- int start,
- int *l1,
- int *l2)
+static bool symm_poly_next_crossing(const Symm *symm,
+ const SymmPoly *sp,
+ int start,
+ int *l1,
+ int *l2)
{
int i;
@@ -347,12 +347,12 @@ static int symm_poly_next_crossing(const Symm *symm,
if ((symm_poly_co_side(symm, sp, *l1) == SYMM_SIDE_KILL) ^
(symm_poly_co_side(symm, sp, *l2) == SYMM_SIDE_KILL))
{
- return TRUE;
+ return true;
}
}
BLI_assert(!"symm_poly_next_crossing failed");
- return FALSE;
+ return false;
}
static BMFace *symm_face_create_v(BMesh *bm, BMFace *example,
@@ -378,7 +378,7 @@ static BMFace *symm_face_create_v(BMesh *bm, BMFace *example,
f_new = BM_face_create(bm, fv, fe, len, BM_CREATE_NO_DOUBLE);
if (example)
BM_elem_attrs_copy(bm, bm, example, f_new);
- BM_face_select_set(bm, f_new, TRUE);
+ BM_face_select_set(bm, f_new, true);
BMO_elem_flag_enable(bm, f_new, SYMM_OUTPUT_GEOM);
return f_new;
@@ -465,15 +465,15 @@ static void symm_mirror_polygons(Symm *symm)
BMO_ITER (f, &oiter, symm->op->slots_in, "input", BM_FACE) {
BMIter iter;
BMLoop *l;
- int mirror_all = TRUE, ignore_all = TRUE;
+ bool mirror_all = true, ignore_all = true;
/* Check if entire polygon can be mirrored or ignored */
BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
const SymmSide side = symm_co_side(symm, l->v->co);
if (side == SYMM_SIDE_KILL)
- mirror_all = FALSE;
+ mirror_all = false;
else if (side == SYMM_SIDE_KEEP)
- ignore_all = FALSE;
+ ignore_all = false;
}
if (mirror_all) {
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 663ee463a2c..744f706681d 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -52,7 +52,7 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
float (*projectverts)[3] = NULL;
BLI_array_declare(projectverts);
int i;
- const int use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
+ const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "face_map.out");
for (face = BMO_iter_new(&siter, op->slots_in, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
@@ -138,7 +138,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6);
if (fac1 > fac2) {
- e = BM_edge_rotate(bm, e, FALSE, BM_EDGEROT_CHECK_EXISTS);
+ e = BM_edge_rotate(bm, e, false, BM_EDGEROT_CHECK_EXISTS);
if (e) {
BMO_elem_flag_enable(bm, e, ELE_NEW);
@@ -195,7 +195,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
BMFace *f = BM_face_create_quad_tri(bm,
sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL,
- NULL, TRUE);
+ NULL, true);
BMLoop *l;
BMIter liter;
diff --git a/source/blender/bmesh/operators/bmo_unsubdivide.c b/source/blender/bmesh/operators/bmo_unsubdivide.c
index fae7db3d175..784e695efb0 100644
--- a/source/blender/bmesh/operators/bmo_unsubdivide.c
+++ b/source/blender/bmesh/operators/bmo_unsubdivide.c
@@ -55,5 +55,5 @@ void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
}
/* do all the real work here */
- BM_mesh_decimate_unsubdivide_ex(bm, iterations, TRUE);
+ BM_mesh_decimate_unsubdivide_ex(bm, iterations, true);
}
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 64dbf0cc0e7..37dbfdd9ffe 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -122,8 +122,8 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMEdge *e, *e2;
- const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
- const int is_single = BMO_slot_buffer_count(op->slots_in, "edges") == 1;
+ const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
+ const bool is_single = BMO_slot_buffer_count(op->slots_in, "edges") == 1;
short check_flag = is_single ?
BM_EDGEROT_CHECK_EXISTS :
BM_EDGEROT_CHECK_EXISTS | BM_EDGEROT_CHECK_DEGENERATE;
@@ -140,8 +140,8 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
if (BM_edge_face_pair(e, &fa, &fb)) {
/* check we're untouched */
- if (BMO_elem_flag_test(bm, fa, FACE_TAINT) == FALSE &&
- BMO_elem_flag_test(bm, fb, FACE_TAINT) == FALSE)
+ if (BMO_elem_flag_test(bm, fa, FACE_TAINT) == false &&
+ BMO_elem_flag_test(bm, fb, FACE_TAINT) == false)
{
if (!(e2 = BM_edge_rotate(bm, e, use_ccw, check_flag))) {
@@ -172,14 +172,14 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
#define SEL_FLAG 1
#define SEL_ORIG 2
-static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
+static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, const bool use_faces)
{
BMVert *v;
BMEdge *e;
BMIter eiter;
BMOIter siter;
- if (!usefaces) {
+ if (!use_faces) {
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
@@ -216,14 +216,14 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
}
}
-static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
+static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, const bool use_faces)
{
BMVert *v;
BMEdge *e;
BMIter eiter;
BMOIter siter;
- if (!usefaces) {
+ if (!use_faces) {
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
@@ -265,8 +265,8 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
{
- int use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
- int constrict = BMO_slot_bool_get(op->slots_in, "use_constrict");
+ const bool use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
+ const bool constrict = BMO_slot_bool_get(op->slots_in, "use_constrict");
BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_ALL_NOLOOP, SEL_ORIG);
@@ -314,7 +314,8 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(fstack);
BMLoop *l, *l2;
float maxx, maxx_test, cent[3];
- int i, i_max, flagflip = BMO_slot_bool_get(op->slots_in, "use_flip");
+ int i, i_max;
+ const bool use_flip = BMO_slot_bool_get(op->slots_in, "use_flip");
startf = NULL;
maxx = -1.0e10;
@@ -349,7 +350,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BM_face_normal_flip(bm, startf);
BMO_elem_flag_toggle(bm, startf, FACE_FLIP);
- if (flagflip)
+ if (use_flip)
BM_elem_flag_toggle(startf, BM_ELEM_TAG);
}
@@ -381,11 +382,11 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BM_face_normal_flip(bm, l2->f);
BMO_elem_flag_toggle(bm, l2->f, FACE_FLIP);
- if (flagflip)
+ if (use_flip)
BM_elem_flag_toggle(l2->f, BM_ELEM_TAG);
}
else if (BM_elem_flag_test(l2->f, BM_ELEM_TAG) || BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
- if (flagflip) {
+ if (use_flip) {
BM_elem_flag_disable(l->f, BM_ELEM_TAG);
BM_elem_flag_disable(l2->f, BM_ELEM_TAG);
}
@@ -489,11 +490,11 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
BMFace *fs; /* current face */
BMIter l_iter; /* iteration loop */
- const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
+ const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
- if (use_ccw == FALSE) { /* same loops direction */
+ if (use_ccw == false) { /* same loops direction */
BMLoop *lf; /* current face loops */
MLoopUV *f_luv; /* first face loop uv */
float p_uv[2]; /* previous uvs */
@@ -594,11 +595,11 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
BMFace *fs; /* current face */
BMIter l_iter; /* iteration loop */
- const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
+ const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
- if (use_ccw == FALSE) { /* same loops direction */
+ if (use_ccw == false) { /* same loops direction */
BMLoop *lf; /* current face loops */
MLoopCol *f_lcol; /* first face loop color */
MLoopCol p_col; /* previous color */
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
index 7401704310f..0d603faf3c4 100644
--- a/source/blender/bmesh/operators/bmo_wireframe.c
+++ b/source/blender/bmesh/operators/bmo_wireframe.c
@@ -134,34 +134,34 @@ static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3
}
/* check if we are the only tagged loop-face around this edge */
-static int bm_loop_is_radial_boundary(BMLoop *l_first)
+static bool bm_loop_is_radial_boundary(BMLoop *l_first)
{
BMLoop *l = l_first->radial_next;
if (l == l_first) {
- return TRUE; /* a real boundary */
+ return true; /* a real boundary */
}
else {
do {
if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
- return FALSE;
+ return false;
}
} while ((l = l->radial_next) != l_first);
}
- return TRUE;
+ return true;
}
extern float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
{
- const int use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary");
- const int use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
- const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
- const int use_crease = (BMO_slot_bool_get(op->slots_in, "use_crease") &&
- CustomData_has_layer(&bm->edata, CD_CREASE));
- const float depth = BMO_slot_float_get(op->slots_in, "thickness");
- const float inset = depth;
+ const bool use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary");
+ const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
+ const bool use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
+ const bool use_crease = (BMO_slot_bool_get(op->slots_in, "use_crease") &&
+ CustomData_has_layer(&bm->edata, CD_CREASE));
+ const float depth = BMO_slot_float_get(op->slots_in, "thickness");
+ const float inset = depth;
const int totvert_orig = bm->totvert;
@@ -203,7 +203,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
}
/* setup tags, all faces and verts will be tagged which will be duplicated */
- BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);
BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
verts_loop_tot += f_src->len;
@@ -239,13 +239,13 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
}
/* conflicts with BM_vert_calc_mean_tagged_edge_length */
- if (use_relative_offset == FALSE) {
+ if (use_relative_offset == false) {
BM_elem_flag_disable(v_src, BM_ELEM_TAG);
}
}
if (use_relative_offset) {
- BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
+ BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, false);
}
verts_loop = MEM_mallocN(sizeof(BMVert **) * verts_loop_tot, __func__);
@@ -332,7 +332,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
BMVert *v_pos1 = verts_pos[i_1];
BMVert *v_pos2 = verts_pos[i_2];
- f_new = BM_face_create_quad_tri(bm, v_l1, v_l2, v_neg2, v_neg1, f_src, FALSE);
+ f_new = BM_face_create_quad_tri(bm, v_l1, v_l2, v_neg2, v_neg1, f_src, false);
BM_elem_flag_enable(f_new, BM_ELEM_TAG);
l_new = BM_FACE_FIRST_LOOP(f_new);
@@ -341,7 +341,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
BM_elem_attrs_copy(bm, bm, l_next, l_new->next);
BM_elem_attrs_copy(bm, bm, l_next, l_new->next->next);
- f_new = BM_face_create_quad_tri(bm, v_l2, v_l1, v_pos1, v_pos2, f_src, FALSE);
+ f_new = BM_face_create_quad_tri(bm, v_l2, v_l1, v_pos1, v_pos2, f_src, false);
BM_elem_flag_enable(f_new, BM_ELEM_TAG);
l_new = BM_FACE_FIRST_LOOP(f_new);
@@ -357,7 +357,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
BMVert *v_b1 = verts_boundary[i_1];
BMVert *v_b2 = verts_boundary[i_2];
- f_new = BM_face_create_quad_tri(bm, v_b2, v_b1, v_neg1, v_neg2, f_src, FALSE);
+ f_new = BM_face_create_quad_tri(bm, v_b2, v_b1, v_neg1, v_neg2, f_src, false);
BM_elem_flag_enable(f_new, BM_ELEM_TAG);
l_new = BM_FACE_FIRST_LOOP(f_new);
@@ -366,7 +366,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
BM_elem_attrs_copy(bm, bm, l, l_new->next);
BM_elem_attrs_copy(bm, bm, l, l_new->next->next);
- f_new = BM_face_create_quad_tri(bm, v_b1, v_b2, v_pos2, v_pos1, f_src, FALSE);
+ f_new = BM_face_create_quad_tri(bm, v_b1, v_b2, v_pos2, v_pos1, f_src, false);
BM_elem_flag_enable(f_new, BM_ELEM_TAG);
l_new = BM_FACE_FIRST_LOOP(f_new);
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
index 5e1d58150fa..47b507603f4 100644
--- a/source/blender/bmesh/tools/BME_bevel.c
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -90,7 +90,7 @@ static BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BM
float factor, float weight, float maxfactor, float *max)
{
BME_TransData *vtd;
- int is_new = 0;
+ int is_new = false;
if (v == NULL) {
return NULL;
@@ -100,7 +100,7 @@ static BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BM
vtd = BLI_memarena_alloc(td->ma, sizeof(*vtd));
BLI_ghash_insert(td->gh, v, vtd);
td->len++;
- is_new = 1;
+ is_new = true;
}
vtd->bm = bm;
@@ -151,12 +151,12 @@ static void BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
{
BMFace *f;
BMEdge *e;
- int done;
+ bool done;
if (v->e) {
- done = FALSE;
+ done = false;
while (!done) {
- done = TRUE;
+ done = true;
e = v->e; /*loop the edge looking for a edge to dissolve*/
do {
f = NULL;
@@ -164,14 +164,14 @@ static void BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
f = bmesh_jfke(bm, e->l->f, e->l->radial_next->f, e);
}
if (f) {
- done = FALSE;
+ done = false;
break;
}
e = bmesh_disk_edge_next(e, v);
} while (e != v->e);
}
- BM_vert_collapse_edge(bm, v->e, v, TRUE);
- // bmesh_jekv(bm, v->e, v, FALSE);
+ BM_vert_collapse_edge(bm, v->e, v, true);
+ // bmesh_jekv(bm, v->e, v, false);
}
}
@@ -539,18 +539,18 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
se = l->next->e;
jf = NULL;
if (kl->v == kv) {
- BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, TRUE);
+ BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, true);
ke = kl->e;
/* BMESH-TODO: jfke doesn't handle customdata */
jf = bmesh_jfke(bm, kl->prev->radial_next->f, kl->f, kl->prev->e);
- BM_vert_collapse_edge(bm, ke, kv, FALSE);
+ BM_vert_collapse_edge(bm, ke, kv, false);
}
else {
- BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, TRUE);
+ BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, true);
ke = kl->e;
/* BMESH-TODO: jfke doesn't handle customdata */
jf = bmesh_jfke(bm, kl->next->radial_next->f, kl->f, kl->next->e);
- BM_vert_collapse_edge(bm, ke, kv, FALSE);
+ BM_vert_collapse_edge(bm, ke, kv, false);
}
/* find saved loop pointer */
l = se->l;
@@ -585,18 +585,18 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
se = l->e;
jf = NULL;
if (kl->v == kv) {
- BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, TRUE);
+ BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, true);
ke = kl->e;
/* BMESH-TODO: jfke doesn't handle customdata */
jf = bmesh_jfke(bm, kl->prev->radial_next->f, kl->f, kl->prev->e);
- BM_vert_collapse_edge(bm, ke, kv, FALSE);
+ BM_vert_collapse_edge(bm, ke, kv, false);
}
else {
- BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, TRUE);
+ BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, true);
ke = kl->e;
/* BMESH-TODO: jfke doesn't handle customdata */
jf = bmesh_jfke(bm, kl->next->radial_next->f, kl->f, kl->next->e);
- BM_vert_collapse_edge(bm, ke, kv, FALSE);
+ BM_vert_collapse_edge(bm, ke, kv, false);
}
/* find saved loop pointer */
l = se->l;
@@ -607,7 +607,7 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
}
if (!BMO_elem_flag_test(bm, v1, BME_BEVEL_NONMAN) || !BMO_elem_flag_test(bm, v2, BME_BEVEL_NONMAN)) {
- BM_face_split(bm, f, v2, v1, &l, e, TRUE);
+ BM_face_split(bm, f, v2, v1, &l, e, true);
BMO_elem_flag_enable(bm, l->e, BME_BEVEL_BEVEL);
l = l->radial_next;
}
@@ -636,7 +636,7 @@ static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
l = l->next->next;
/* "cut off" this corner */
- /* f = */ BM_face_split(bm, l->f, v2, v1, NULL, l->e, TRUE);
+ /* f = */ BM_face_split(bm, l->f, v2, v1, NULL, l->e, true);
return l;
}
@@ -1069,7 +1069,7 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
/* get rid of beveled edge */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, e, BME_BEVEL_ORIG)) {
- BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE);
+ BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, true);
}
}
@@ -1083,9 +1083,9 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
if (l->v != v) l = l->next;
if (l2->v != v) l2 = l2->next;
if (l->f->len > 3)
- BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e, TRUE); /* clip this corner off */
+ BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e, true); /* clip this corner off */
if (l2->f->len > 3)
- BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, TRUE); /* clip this corner off */
+ BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, true); /* clip this corner off */
curedge = bmesh_disk_edge_next(curedge, v);
} while (curedge != v->e);
BME_Bevel_Dissolve_Disk(bm, v);
diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h
index 4a557c20ae3..d3eaf1c6670 100644
--- a/source/blender/bmesh/tools/bmesh_decimate.h
+++ b/source/blender/bmesh/tools/bmesh_decimate.h
@@ -27,15 +27,15 @@
* \ingroup bmesh
*/
-void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, const int do_triangulate);
+void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, const bool do_triangulate);
-void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int tag_only);
+void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool tag_only);
void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations);
-void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries,
+void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
BMVert **vinput_arr, const int vinput_len,
BMEdge **einput_arr, const int einput_len);
-void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries);
+void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries);
/* these weights are accumulated so too high values may reach 'inf' too quickly */
#define BM_MESH_DECIM_WEIGHT_MAX 100000.0f
diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c
index 794afb3e0d2..57a35d2f6a9 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c
@@ -134,7 +134,7 @@ static void bm_decim_calc_target_co(BMEdge *e, float optimize_co[3],
}
}
-static int bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_co[3])
+static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_co[3])
{
BMIter liter;
BMLoop *l;
@@ -175,13 +175,13 @@ static int bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_c
* (first making it zero area, then flipping again) */
if (dot_v3v3(cross_exist, cross_optim) <= FLT_EPSILON) {
//printf("no flip\n");
- return TRUE;
+ return true;
}
}
}
}
- return FALSE;
+ return false;
}
static void bm_decim_build_edge_cost_single(BMEdge *e,
@@ -291,15 +291,15 @@ static void bm_decim_build_edge_cost(BMesh *bm,
* collapsing edges so even has some advantage over decimating quads
* directly.
*
- * \return TRUE if any faces were triangulated.
+ * \return true if any faces were triangulated.
*/
-static int bm_decim_triangulate_begin(BMesh *bm)
+static bool bm_decim_triangulate_begin(BMesh *bm)
{
BMIter iter;
BMFace *f;
- // int has_quad; // could optimize this a little
- int has_cut = FALSE;
+ // bool has_quad; // could optimize this a little
+ bool has_cut = false;
BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
@@ -345,7 +345,7 @@ static int bm_decim_triangulate_begin(BMesh *bm)
}
#ifdef USE_SAFETY_CHECKS
- if (BM_edge_exists(l_a->v, l_b->v) == FALSE)
+ if (BM_edge_exists(l_a->v, l_b->v) == false)
#endif
{
BMFace *f_new;
@@ -355,7 +355,7 @@ static int bm_decim_triangulate_begin(BMesh *bm)
* - if there is a quad that has a free standing edge joining it along
* where we want to split the face, there isnt a good way we can handle this.
* currently that edge will get removed when joining the tris back into a quad. */
- f_new = BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE);
+ f_new = BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, false);
if (f_new) {
/* the value of this doesn't matter, only that the 2 loops match and have unique values */
@@ -370,7 +370,7 @@ static int bm_decim_triangulate_begin(BMesh *bm)
BM_face_normal_update(f);
BM_face_normal_update(f_new);
- has_cut = TRUE;
+ has_cut = true;
}
}
}
@@ -410,15 +410,15 @@ static void bm_decim_triangulate_end(BMesh *bm)
BM_vert_in_edge(e, l_b->next->v) ? l_b->prev->v : l_b->next->v,
};
- BLI_assert(ELEM3(vquad[0], vquad[1], vquad[2], vquad[3]) == FALSE);
- BLI_assert(ELEM3(vquad[1], vquad[0], vquad[2], vquad[3]) == FALSE);
- BLI_assert(ELEM3(vquad[2], vquad[1], vquad[0], vquad[3]) == FALSE);
- BLI_assert(ELEM3(vquad[3], vquad[1], vquad[2], vquad[0]) == FALSE);
+ BLI_assert(ELEM3(vquad[0], vquad[1], vquad[2], vquad[3]) == false);
+ BLI_assert(ELEM3(vquad[1], vquad[0], vquad[2], vquad[3]) == false);
+ BLI_assert(ELEM3(vquad[2], vquad[1], vquad[0], vquad[3]) == false);
+ BLI_assert(ELEM3(vquad[3], vquad[1], vquad[2], vquad[0]) == false);
if (is_quad_convex_v3(vquad[0]->co, vquad[1]->co, vquad[2]->co, vquad[3]->co)) {
/* highly unlikely to fail, but prevents possible double-ups */
BMFace *f[2] = {l_a->f, l_b->f};
- BM_faces_join(bm, f, 2, TRUE);
+ BM_faces_join(bm, f, 2, true);
}
}
}
@@ -445,7 +445,7 @@ static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_cle
//#define USE_SEAM
/* these don't need to be updated, since they will get removed when the edge collapses */
BMLoop *l_clear, *l_other;
- const int is_manifold = BM_edge_is_manifold(l->e);
+ const bool is_manifold = BM_edge_is_manifold(l->e);
int side;
/* l defines the vert to collapse into */
@@ -467,7 +467,7 @@ static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_cle
/* now we have both corners of the face 'l->f' */
for (side = 0; side < 2; side++) {
#ifdef USE_SEAM
- int is_seam = FALSE;
+ bool is_seam = false;
#endif
void *src[2];
BMFace *f_exit = is_manifold ? l->radial_next->f : NULL;
@@ -507,7 +507,7 @@ static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_cle
#ifdef USE_SEAM
/* break out unless we find a match */
- is_seam = TRUE;
+ is_seam = true;
#endif
/* ok. we have a loop. now be smart with it! */
@@ -523,7 +523,7 @@ static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_cle
if (CustomData_data_equals(type, cd_src[0], cd_iter)) {
CustomData_bmesh_interp_n(&bm->ldata, cd_src, w, NULL, 2, l_iter->head.data, i);
#ifdef USE_SEAM
- is_seam = FALSE;
+ is_seam = false;
#endif
}
}
@@ -598,7 +598,7 @@ BLI_INLINE int bm_edge_is_manifold_or_boundary(BMLoop *l)
#endif
}
-static int bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
+static bool bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
{
/* simply check that there is no overlap between faces and edges of each vert,
* (excluding the 2 faces attached to 'e' and 'e' its self) */
@@ -609,7 +609,7 @@ static int bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
e_iter = e_first;
do {
if (!bm_edge_is_manifold_or_boundary(e_iter->l)) {
- return TRUE;
+ return true;
}
bm_edge_tag_disable(e_iter);
} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v1)) != e_first);
@@ -617,7 +617,7 @@ static int bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
e_iter = e_first;
do {
if (!bm_edge_is_manifold_or_boundary(e_iter->l)) {
- return TRUE;
+ return true;
}
bm_edge_tag_disable(e_iter);
} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v2)) != e_first);
@@ -673,11 +673,11 @@ static int bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
e_iter = e_first;
do {
if (bm_edge_tag_test(e_iter)) {
- return TRUE;
+ return true;
}
} while ((e_iter = bmesh_disk_edge_next(e_iter, e_first->v2)) != e_first);
- return FALSE;
+ return false;
}
/**
@@ -690,13 +690,13 @@ static int bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
* \param e_clear_other let caller know what edges we remove besides \a e_clear
* \param customdata_flag merge factor, scales from 0 - 1 ('v_clear' -> 'v_other')
*/
-static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e_clear_other[2],
+static bool bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e_clear_other[2],
#ifdef USE_CUSTOMDATA
- const CD_UseFlag customdata_flag,
- const float customdata_fac
+ const CD_UseFlag customdata_flag,
+ const float customdata_fac
#else
- const CD_UseFlag UNUSED(customdata_flag),
- const float UNUSED(customdata_fac)
+ const CD_UseFlag UNUSED(customdata_flag),
+ const float UNUSED(customdata_fac)
#endif
)
{
@@ -708,11 +708,11 @@ static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e
if (BM_edge_is_manifold(e_clear)) {
BMLoop *l_a, *l_b;
BMEdge *e_a_other[2], *e_b_other[2];
- int ok;
+ bool ok;
ok = BM_edge_loop_pair(e_clear, &l_a, &l_b);
- BLI_assert(ok == TRUE);
+ BLI_assert(ok == true);
BLI_assert(l_a->f->len == 3);
BLI_assert(l_b->f->len == 3);
@@ -749,7 +749,7 @@ static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e
if (ELEM(e_a_other[0], e_b_other[0], e_b_other[1]) ||
ELEM(e_a_other[1], e_b_other[0], e_b_other[1]))
{
- return FALSE;
+ return false;
}
r_e_clear_other[0] = BM_elem_index_get(e_a_other[0]);
@@ -782,7 +782,7 @@ static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e
// BM_mesh_validate(bm);
- return TRUE;
+ return true;
}
else if (BM_edge_is_boundary(e_clear)) {
/* same as above but only one triangle */
@@ -829,10 +829,10 @@ static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e
// BM_mesh_validate(bm);
- return TRUE;
+ return true;
}
else {
- return FALSE;
+ return false;
}
}
@@ -869,7 +869,7 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
}
/* use for customdata merging */
- if (LIKELY(compare_v3v3(e->v1->co, e->v2->co, FLT_EPSILON) == FALSE)) {
+ if (LIKELY(compare_v3v3(e->v1->co, e->v2->co, FLT_EPSILON) == false)) {
customdata_fac = line_point_factor_v3(optimize_co, e->v1->co, e->v2->co);
#if 0
/* simple test for stupid collapse */
@@ -946,7 +946,7 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
else
e_outer = l->prev->e;
- BLI_assert(BM_vert_in_edge(e_outer, l->v) == FALSE);
+ BLI_assert(BM_vert_in_edge(e_outer, l->v) == false);
bm_decim_build_edge_cost_single(e_outer, vquadrics, vweights, eheap, eheap_table);
}
@@ -972,14 +972,14 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
* \param vweights Optional array of vertex aligned weights [0 - 1],
* a vertex group is the usual source for this.
*/
-void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, const int do_triangulate)
+void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, const bool do_triangulate)
{
Heap *eheap; /* edge heap */
HeapNode **eheap_table; /* edge index aligned table pointing to the eheap */
Quadric *vquadrics; /* vert index aligned quadrics */
int tot_edge_orig;
int face_tot_target;
- int use_triangulate;
+ bool use_triangulate;
CD_UseFlag customdata_flag = 0;
@@ -1015,7 +1015,7 @@ void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, c
/* iterative edge collapse and maintain the eheap */
while ((bm->totface > face_tot_target) &&
- (BLI_heap_is_empty(eheap) == FALSE) &&
+ (BLI_heap_is_empty(eheap) == false) &&
(BLI_heap_node_value(BLI_heap_top(eheap)) != COST_INVALID))
{
// const float value = BLI_heap_node_value(BLI_heap_top(eheap));
@@ -1033,7 +1033,7 @@ void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, c
#ifdef USE_TRIANGULATE
- if (do_triangulate == FALSE) {
+ if (do_triangulate == false) {
/* its possible we only had triangles, skip this step in that case */
if (LIKELY(use_triangulate)) {
/* temp convert quads to triangles */
diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
index f67f01e4585..3a724769f2a 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
@@ -69,7 +69,7 @@ static int dissolve_elem_cmp(const void *a1, const void *a2)
return 0;
}
-void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries,
+void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
BMVert **vinput_arr, const int vinput_len,
BMEdge **einput_arr, const int einput_len)
{
@@ -117,7 +117,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int
BMFace *nf = BM_faces_join_pair(bm, e->l->f,
e->l->radial_next->f,
e,
- FALSE); /* join faces */
+ false); /* join faces */
/* there may be some errors, we don't mind, just move on */
if (nf) {
@@ -148,7 +148,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int
for (i = bm->totedge - 1; i != -1; i--) {
e_iter = earray[i];
- if (BM_edge_is_wire(e_iter) && (BM_elem_flag_test(e_iter, BM_ELEM_TAG) == FALSE)) {
+ if (BM_edge_is_wire(e_iter) && (BM_elem_flag_test(e_iter, BM_ELEM_TAG) == false)) {
/* edge has become wire */
int vidx_reverse;
BMVert *v1 = e_iter->v1;
@@ -179,7 +179,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int
if (LIKELY(v != NULL) &&
BM_vert_edge_count(v) == 2)
{
- BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
+ BM_vert_collapse_edge(bm, v->e, v, true); /* join edges */
}
}
}
@@ -210,7 +210,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int
/* check twice because cumulative effect could dissolve over angle limit */
bm_vert_edge_face_angle(v) < angle_limit)
{
- BMEdge *ne = BM_vert_collapse_edge(bm, v->e, v, TRUE); /* join edges */
+ BMEdge *ne = BM_vert_collapse_edge(bm, v->e, v, true); /* join edges */
if (ne && ne->l) {
BM_edge_normals_update(ne);
@@ -223,7 +223,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const int
MEM_freeN(weight_elems);
}
-void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const int do_dissolve_boundaries)
+void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries)
{
int vinput_len;
int einput_len;
diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
index 71c1cedbd5e..9dc4b596568 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
@@ -36,7 +36,7 @@
#include "intern/bmesh_operators_private.h" /* own include */
-static int bm_vert_dissolve_fan_test(BMVert *v)
+static bool bm_vert_dissolve_fan_test(BMVert *v)
{
/* check if we should walk over these verts */
BMIter iter;
@@ -61,21 +61,21 @@ static int bm_vert_dissolve_fan_test(BMVert *v)
}
if ((tot_edge == 4) && (tot_edge_boundary == 0) && (tot_edge_manifold == 4)) {
- return TRUE;
+ return true;
}
else if ((tot_edge == 3) && (tot_edge_boundary == 0) && (tot_edge_manifold == 3)) {
- return TRUE;
+ return true;
}
else if ((tot_edge == 3) && (tot_edge_boundary == 2) && (tot_edge_manifold == 1)) {
- return TRUE;
+ return true;
}
else if ((tot_edge == 2) && (tot_edge_wire == 2)) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static int bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
+static bool bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
{
/* collapse under 2 conditions.
* - vert connects to 4 manifold edges (and 4 faces).
@@ -110,7 +110,7 @@ static int bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
if (tot_edge == 2) {
/* check for 2 wire verts only */
if (tot_edge_wire == 2) {
- return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
+ return (BM_vert_collapse_edge(bm, v->e, v, true) != NULL);
}
}
else if (tot_edge == 4) {
@@ -145,7 +145,7 @@ static int bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
if (l->f->len > 3) {
BMLoop *l_new;
BLI_assert(l->prev->v != l->next->v);
- BM_face_split(bm, l->f, l->prev->v, l->next->v, &l_new, NULL, TRUE);
+ BM_face_split(bm, l->f, l->prev->v, l->next->v, &l_new, NULL, true);
BM_elem_flag_merge_into(l_new->e, l->e, l->prev->e);
}
}
@@ -153,7 +153,7 @@ static int bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
return BM_vert_dissolve(bm, v);
}
- return FALSE;
+ return false;
}
enum {
@@ -170,7 +170,7 @@ enum {
/**
* \param tag_only so we can call this from an operator */
-void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int tag_only)
+void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool tag_only)
{
#ifdef USE_WALKER
# define ELE_VERT_TAG 1
@@ -191,14 +191,14 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int
/* if tag_only is set, we assyme the caller knows what verts to tag
* needed for the operator */
- if (tag_only == FALSE) {
+ if (tag_only == false) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
}
for (iter_step = 0; iter_step < iterations; iter_step++) {
- int iter_done;
+ bool iter_done;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG) && bm_vert_dissolve_fan_test(v)) {
@@ -215,7 +215,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int
/* main loop, keep tagging until we can't tag any more islands */
- while (TRUE) {
+ while (true) {
#ifdef USE_WALKER
BMWalker walker;
#else
@@ -273,7 +273,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int
vert_seek_b_tot = 0;
vert_seek_b[vert_seek_b_tot++] = v_first;
- while (TRUE) {
+ while (true) {
BMEdge *e;
if ((offset + depth) % nth) {
@@ -318,14 +318,16 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int
}
/* now we tagged all verts -1 for removal, lets loop over and rebuild faces */
- iter_done = FALSE;
+ iter_done = false;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_index_get(v) == VERT_INDEX_DO_COLLAPSE) {
- iter_done |= bm_vert_dissolve_fan(bm, v);
+ if (bm_vert_dissolve_fan(bm, v)) {
+ iter_done = true;
+ }
}
}
- if (iter_done == FALSE) {
+ if (iter_done == false) {
break;
}
}
@@ -340,5 +342,5 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const int
void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations)
{
- BM_mesh_decimate_unsubdivide_ex(bm, iterations, FALSE);
+ BM_mesh_decimate_unsubdivide_ex(bm, iterations, false);
}
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.c b/source/blender/bmesh/tools/bmesh_edgesplit.c
index b6a8c7985d6..1d3f973dbc0 100644
--- a/source/blender/bmesh/tools/bmesh_edgesplit.c
+++ b/source/blender/bmesh/tools/bmesh_edgesplit.c
@@ -98,14 +98,14 @@ static void bm_edgesplit_validate_seams(BMesh *bm)
MEM_freeN(vtouch);
}
-void BM_mesh_edgesplit(BMesh *bm, const int use_verts, const int tag_only)
+void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only)
{
BMIter iter;
BMEdge *e;
- if (tag_only == FALSE) {
- BM_mesh_elem_hflag_enable_all(bm, BM_EDGE | (use_verts ? BM_VERT : 0), BM_ELEM_TAG, FALSE);
+ if (tag_only == false) {
+ BM_mesh_elem_hflag_enable_all(bm, BM_EDGE | (use_verts ? BM_VERT : 0), BM_ELEM_TAG, false);
}
if (use_verts) {
@@ -117,8 +117,8 @@ void BM_mesh_edgesplit(BMesh *bm, const int use_verts, const int tag_only)
*/
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
- if (UNLIKELY(((BM_elem_flag_test(e->v1, BM_ELEM_TAG) == FALSE) &&
- (BM_elem_flag_test(e->v2, BM_ELEM_TAG) == FALSE))))
+ if (UNLIKELY(((BM_elem_flag_test(e->v1, BM_ELEM_TAG) == false) &&
+ (BM_elem_flag_test(e->v2, BM_ELEM_TAG) == false))))
{
BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
@@ -146,10 +146,10 @@ void BM_mesh_edgesplit(BMesh *bm, const int use_verts, const int tag_only)
if (use_verts) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- if (BM_elem_flag_test(e->v1, BM_ELEM_TAG) == FALSE) {
+ if (BM_elem_flag_test(e->v1, BM_ELEM_TAG) == false) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
}
- if (BM_elem_flag_test(e->v2, BM_ELEM_TAG) == FALSE) {
+ if (BM_elem_flag_test(e->v2, BM_ELEM_TAG) == false) {
BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
}
}
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.h b/source/blender/bmesh/tools/bmesh_edgesplit.h
index 687fdac0e00..8c1231dd794 100644
--- a/source/blender/bmesh/tools/bmesh_edgesplit.h
+++ b/source/blender/bmesh/tools/bmesh_edgesplit.h
@@ -27,6 +27,6 @@
* \ingroup bmesh
*/
-void BM_mesh_edgesplit(BMesh *bm, const int use_verts, const int tag_only);
+void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only);
#endif /* __BMESH_EDGESPLIT_H__ */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 2ecbaf778ce..0c1ee9b36ae 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -119,7 +119,7 @@ int EDBM_vert_color_check(struct BMEditMesh *em);
void EDBM_mesh_hide(struct BMEditMesh *em, int swap);
void EDBM_mesh_reveal(struct BMEditMesh *em);
-void EDBM_update_generic(struct BMEditMesh *em, const short do_tessface, const short is_destructive);
+void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive);
struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selected, int doIslands);
void EDBM_uv_element_map_free(struct UvElementMap *vmap);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 4fd85383446..d62eba9728c 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1346,7 +1346,7 @@ void EDBM_mesh_reveal(BMEditMesh *em)
/* so many tools call these that we better make it a generic function.
*/
-void EDBM_update_generic(BMEditMesh *em, const short do_tessface, const short is_destructive)
+void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive)
{
Object *ob = em->ob;
/* order of calling isn't important */
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index ce8153fb994..47e6baf8e93 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -115,8 +115,8 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
static const char *kwlist[] = {"mesh", "tessface", "destructive", NULL};
PyObject *py_me;
Mesh *me;
- int do_tessface = TRUE;
- int is_destructive = TRUE;
+ int do_tessface = true;
+ int is_destructive = true;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:update_edit_mesh", (char **)kwlist,
&py_me, &do_tessface, &is_destructive))
@@ -137,7 +137,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
}
{
- extern void EDBM_update_generic(BMEditMesh *em, const short do_tessface, const short is_destructive);
+ extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive);
EDBM_update_generic(me->edit_btmesh, do_tessface, is_destructive);
}
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index 32315195072..d4c8033589a 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -214,7 +214,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec
return -1;
}
else if (((size = ((MatrixObject *)value)->num_col) != ((MatrixObject *)value)->num_row) ||
- (ELEM(size, 3, 4) == FALSE))
+ (ELEM(size, 3, 4) == false))
{
PyErr_Format(PyExc_TypeError,
"%.200s: keyword \"%.200s\" expected a 3x3 or 4x4 matrix Matrix",
@@ -319,7 +319,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec
elem_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
&elem_array_len, (slot->slot_subtype.elem & BM_ALL_NOLOOP),
- TRUE, TRUE, slot_name);
+ true, true, slot_name);
/* error is set above */
if (elem_array == NULL) {
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index ea6e1e29f0b..ed7b48fb14f 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -120,11 +120,11 @@ static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
param = PyLong_AsLong(value);
- if (param == TRUE) {
+ if (param == true) {
BM_elem_flag_enable(self->ele, hflag);
return 0;
}
- else if (param == FALSE) {
+ else if (param == false) {
BM_elem_flag_disable(self->ele, hflag);
return 0;
}
@@ -854,7 +854,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
bm = self->bm;
- BM_mesh_bm_to_me(bm, me, FALSE);
+ BM_mesh_bm_to_me(bm, me, false);
/* we could have the user do this but if they forget blender can easy crash
* since the references arrays for the objects derived meshes are now invalid */
@@ -884,9 +884,9 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
Object *ob;
struct Scene *scene;
BMesh *bm;
- int use_deform = TRUE;
- int use_render = FALSE;
- int use_cage = FALSE;
+ int use_deform = true;
+ int use_render = false;
+ int use_cage = false;
DerivedMesh *dm;
const int mask = CD_MASK_BMESH;
@@ -984,7 +984,7 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *
BMesh *bm;
PyObject *py_mesh;
Mesh *me;
- int use_shape_key = FALSE;
+ int use_shape_key = false;
int shape_key_index = 0;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:from_mesh", (char **)kwlist,
@@ -1032,7 +1032,7 @@ static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value)
BPY_BM_CHECK_OBJ(self);
param = PyLong_AsLong(value);
- if (param != FALSE && param != TRUE) {
+ if (param != false && param != true) {
PyErr_SetString(PyExc_TypeError,
"expected a boolean type 0/1");
return NULL;
@@ -1056,7 +1056,7 @@ PyDoc_STRVAR(bpy_bmesh_normal_update_doc,
static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self, PyObject *args)
{
- int skip_hidden = FALSE;
+ int skip_hidden = false;
BPY_BM_CHECK_OBJ(self);
@@ -1163,7 +1163,7 @@ static PyObject *bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value)
BPY_BM_CHECK_OBJ(self);
param = PyLong_AsLong(value);
- if (param != FALSE && param != TRUE) {
+ if (param != false && param != true) {
PyErr_SetString(PyExc_TypeError,
"expected a boolean type 0/1");
return NULL;
@@ -1191,7 +1191,7 @@ static PyObject *bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value)
BPY_BM_CHECK_OBJ(self);
param = PyLong_AsLong(value);
- if (param != FALSE && param != TRUE) {
+ if (param != false && param != true) {
PyErr_SetString(PyExc_TypeError,
"expected a boolean type 0/1");
return NULL;
@@ -1258,7 +1258,7 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
&vert_seq_len, BM_VERT,
- TRUE, TRUE, "BMVert.copy_from_vert_interp(...)");
+ true, true, "BMVert.copy_from_vert_interp(...)");
if (vert_array == NULL) {
return NULL;
@@ -1508,8 +1508,8 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
static const char *kwlist[] = {"verts", "edges", NULL};
BMesh *bm = self->bm;
- int do_verts = TRUE;
- int do_edges = TRUE;
+ int do_verts = true;
+ int do_edges = true;
BMFace *f_cpy;
BPY_BM_CHECK_OBJ(self);
@@ -1649,8 +1649,8 @@ PyDoc_STRVAR(bpy_bmloop_copy_from_face_interp_doc,
static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args)
{
BPy_BMFace *py_face = NULL;
- int do_vertex = TRUE;
- int do_multires = TRUE;
+ int do_vertex = true;
+ int do_multires = true;
BPY_BM_CHECK_OBJ(self);
@@ -1818,7 +1818,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
&vert_seq_len, BM_VERT,
- TRUE, TRUE, "edges.new(...)");
+ true, true, "edges.new(...)");
if (vert_array == NULL) {
return NULL;
@@ -1896,7 +1896,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 3, PY_SSIZE_T_MAX,
&vert_seq_len, BM_VERT,
- TRUE, TRUE, "faces.new(...)");
+ true, true, "faces.new(...)");
if (vert_array == NULL) {
return NULL;
@@ -2049,7 +2049,7 @@ static PyObject *bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args)
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
&vert_seq_len, BM_VERT,
- TRUE, TRUE, "edges.get(...)");
+ true, true, "edges.get(...)");
if (vert_array == NULL) {
return NULL;
@@ -2101,7 +2101,7 @@ static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 1, PY_SSIZE_T_MAX,
&vert_seq_len, BM_VERT,
- TRUE, TRUE, "faces.get(...)");
+ true, true, "faces.get(...)");
if (vert_array == NULL) {
return NULL;
@@ -2228,7 +2228,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
{
static const char *kwlist[] = {"key", "reverse", NULL};
PyObject *keyfunc = NULL; /* optional */
- int reverse = FALSE; /* optional */
+ int do_reverse = false; /* optional */
const char htype = bm_iter_itype_htype_map[self->itype];
int n_elem;
@@ -2253,7 +2253,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
if (!PyArg_ParseTupleAndKeywords(args, kw,
"|Oi:BMElemSeq.sort",
(char **)kwlist,
- &keyfunc, &reverse))
+ &keyfunc, &do_reverse))
{
return NULL;
}
@@ -2323,7 +2323,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
range_vn_i(elem_idx, n_elem, 0);
/* Sort the index array according to the order of the 'keys' array */
- if (reverse)
+ if (do_reverse)
elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_descending;
else
elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_ascending;
@@ -2601,7 +2601,7 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s
{
BMIter iter;
int count = 0;
- int ok;
+ bool ok;
PyObject *list;
PyObject *item;
@@ -2613,14 +2613,14 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s
ok = BM_iter_init(&iter, self->bm, self->itype, self->py_ele ? self->py_ele->ele : NULL);
- BLI_assert(ok == TRUE);
+ BLI_assert(ok == true);
- if (UNLIKELY(ok == FALSE)) {
+ if (UNLIKELY(ok == false)) {
return list;
}
/* first loop up-until the start */
- for (ok = TRUE; ok; ok = (BM_iter_step(&iter) != NULL)) {
+ for (ok = true; ok; ok = (BM_iter_step(&iter) != NULL)) {
if (count == start) {
break;
}
@@ -3419,7 +3419,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self)
* function where the actual error will be caused by
* the previous action. */
#if 0
- if (BM_mesh_validate(self->bm) == FALSE) {
+ if (BM_mesh_validate(self->bm) == false) {
PyErr_Format(PyExc_ReferenceError,
"BMesh used by %.200s has become invalid",
Py_TYPE(self)->tp_name);
@@ -3464,7 +3464,7 @@ void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
*/
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
- const char do_unique_check, const char do_bm_check,
+ const bool do_unique_check, const bool do_bm_check,
const char *error_prefix)
{
BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL;
@@ -3531,17 +3531,17 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
if (do_unique_check) {
/* check for double verts! */
- int ok = TRUE;
+ bool ok = true;
for (i = 0; i < seq_len; i++) {
- if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == FALSE)) {
- ok = FALSE;
+ if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == false)) {
+ ok = false;
}
/* ensure we don't leave this enabled */
BM_elem_flag_disable(alloc[i], BM_ELEM_INTERNAL_TAG);
}
- if (ok == FALSE) {
+ if (ok == false) {
PyErr_Format(PyExc_ValueError,
"%s: found the same %.200s used multiple times",
error_prefix, BPy_BMElem_StringFromHType(htype));
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index d15918a3c11..8e6d04ec9ba 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -160,7 +160,7 @@ PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele); /* just checks ty
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
- const char do_unique_check, const char do_bm_check,
+ const bool do_unique_check, const bool do_bm_check,
const char *error_prefix);
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index b0870578f5a..f59676252d4 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -187,10 +187,10 @@ static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag
const int flag = GET_INT_FROM_POINTER(flag_p);
switch (PyLong_AsLong(value)) {
- case TRUE:
+ case true:
self->data->flag |= flag;
return 0;
- case FALSE:
+ case false:
self->data->flag &= ~flag;
return 0;
default:
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index dfcfbeb0ab5..33cb1f5d0fb 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -107,7 +107,7 @@ static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value)
if ((BPy_BMVert_Check(value) ||
BPy_BMEdge_Check(value) ||
- BPy_BMFace_Check(value)) == FALSE)
+ BPy_BMFace_Check(value)) == false)
{
PyErr_Format(PyExc_TypeError,
"Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
@@ -132,7 +132,7 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val
if ((BPy_BMVert_Check(value) ||
BPy_BMEdge_Check(value) ||
- BPy_BMFace_Check(value)) == FALSE)
+ BPy_BMFace_Check(value)) == false)
{
PyErr_Format(PyExc_TypeError,
"Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
@@ -141,7 +141,7 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val
BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.remove()");
- if (BM_select_history_remove(self->bm, value->ele) == FALSE) {
+ if (BM_select_history_remove(self->bm, value->ele) == false) {
PyErr_SetString(PyExc_ValueError,
"Element not found in selection history");
return NULL;
@@ -196,7 +196,7 @@ static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keyn
static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssize_t start, Py_ssize_t stop)
{
int count = 0;
- int ok;
+ bool ok;
PyObject *list;
PyObject *item;
@@ -210,12 +210,12 @@ static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssi
ok = (ese != NULL);
- if (UNLIKELY(ok == FALSE)) {
+ if (UNLIKELY(ok == false)) {
return list;
}
/* first loop up-until the start */
- for (ok = TRUE; ok; ok = ((ese = ese->next) != NULL)) {
+ for (ok = true; ok; ok = ((ese = ese->next) != NULL)) {
if (count == start) {
break;
}
@@ -429,7 +429,7 @@ int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
value_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
&value_len, BM_VERT | BM_EDGE | BM_FACE,
- TRUE, TRUE, "BMesh.select_history = value");
+ true, true, "BMesh.select_history = value");
if (value_array == NULL) {
return -1;
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index a43c5c18126..7c0adcfc997 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -90,7 +90,7 @@ static PyObject *bpy_bm_utils_vert_collapse_edge(PyObject *UNUSED(self), PyObjec
bm = py_edge->bm;
- e_new = BM_vert_collapse_edge(bm, py_edge->e, py_vert->v, TRUE);
+ e_new = BM_vert_collapse_edge(bm, py_edge->e, py_vert->v, true);
if (e_new) {
return BPy_BMEdge_CreatePyObject(bm, e_new);
@@ -156,7 +156,7 @@ static PyObject *bpy_bm_utils_vert_collapse_faces(PyObject *UNUSED(self), PyObje
bm = py_edge->bm;
- e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, CLAMPIS(fac, 0.0f, 1.0f), do_join_faces, TRUE);
+ e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, CLAMPIS(fac, 0.0f, 1.0f), do_join_faces, true);
if (e_new) {
return BPy_BMEdge_CreatePyObject(bm, e_new);
@@ -239,7 +239,7 @@ static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *ar
edge_array = BPy_BMElem_PySeq_As_Array(&bm, edge_seq, 0, PY_SSIZE_T_MAX,
&edge_array_len, BM_EDGE,
- TRUE, TRUE, "vert_separate(...)");
+ true, true, "vert_separate(...)");
if (edge_array == NULL) {
return NULL;
@@ -338,7 +338,7 @@ PyDoc_STRVAR(bpy_bm_utils_edge_rotate_doc,
static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args)
{
BPy_BMEdge *py_edge;
- int do_ccw = FALSE;
+ int do_ccw = false;
BMesh *bm;
BMEdge *e_new = NULL;
@@ -396,7 +396,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
/* optional */
PyObject *py_coords = NULL;
- int edge_exists = TRUE;
+ int edge_exists = true;
BPy_BMEdge *py_edge_example = NULL;
float *coords;
@@ -426,8 +426,8 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
}
/* this doubles for checking that the verts are in the same mesh */
- if (BM_vert_in_face(py_face->f, py_vert_a->v) == FALSE ||
- BM_vert_in_face(py_face->f, py_vert_b->v) == FALSE)
+ if (BM_vert_in_face(py_face->f, py_vert_a->v) == false ||
+ BM_vert_in_face(py_face->f, py_vert_b->v) == false)
{
PyErr_SetString(PyExc_ValueError,
"face_split(...): one of the verts passed is not found in the face");
@@ -496,7 +496,7 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *args)
BMFace **face_array;
Py_ssize_t face_seq_len = 0;
BMFace *f_new;
- int do_remove = TRUE;
+ int do_remove = true;
if (!PyArg_ParseTuple(args, "O|i:face_join", &py_face_array, &do_remove)) {
return NULL;
@@ -504,7 +504,7 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *args)
face_array = BPy_BMElem_PySeq_As_Array(&bm, py_face_array, 2, PY_SSIZE_T_MAX,
&face_seq_len, BM_FACE,
- TRUE, TRUE, "face_join(...)");
+ true, true, "face_join(...)");
if (face_array == NULL) {
return NULL; /* error will be set */