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
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/blender/bmesh/intern
parent6cdbd1b1aaae0f8b3018ecf2648699a0ea6d6be8 (diff)
use booleans for bmesh api.
Diffstat (limited to 'source/blender/bmesh/intern')
-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
33 files changed, 564 insertions, 560 deletions
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 {