diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-14 20:42:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-14 20:42:43 +0400 |
commit | b27854bd47104300a484e3b06185b2cb1fa0b774 (patch) | |
tree | 3be00fa743238e3a50283f56d595d978ed36667b /source/blender/python/bmesh/bmesh_py_types.c | |
parent | 6cdbd1b1aaae0f8b3018ecf2648699a0ea6d6be8 (diff) |
use booleans for bmesh api.
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_types.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index ea6e1e29f0b..ed7b48fb14f 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -120,11 +120,11 @@ static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag) param = PyLong_AsLong(value); - if (param == TRUE) { + if (param == true) { BM_elem_flag_enable(self->ele, hflag); return 0; } - else if (param == FALSE) { + else if (param == false) { BM_elem_flag_disable(self->ele, hflag); return 0; } @@ -854,7 +854,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args) bm = self->bm; - BM_mesh_bm_to_me(bm, me, FALSE); + BM_mesh_bm_to_me(bm, me, false); /* we could have the user do this but if they forget blender can easy crash * since the references arrays for the objects derived meshes are now invalid */ @@ -884,9 +884,9 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args) Object *ob; struct Scene *scene; BMesh *bm; - int use_deform = TRUE; - int use_render = FALSE; - int use_cage = FALSE; + int use_deform = true; + int use_render = false; + int use_cage = false; DerivedMesh *dm; const int mask = CD_MASK_BMESH; @@ -984,7 +984,7 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject * BMesh *bm; PyObject *py_mesh; Mesh *me; - int use_shape_key = FALSE; + int use_shape_key = false; int shape_key_index = 0; if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:from_mesh", (char **)kwlist, @@ -1032,7 +1032,7 @@ static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value) BPY_BM_CHECK_OBJ(self); param = PyLong_AsLong(value); - if (param != FALSE && param != TRUE) { + if (param != false && param != true) { PyErr_SetString(PyExc_TypeError, "expected a boolean type 0/1"); return NULL; @@ -1056,7 +1056,7 @@ PyDoc_STRVAR(bpy_bmesh_normal_update_doc, static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self, PyObject *args) { - int skip_hidden = FALSE; + int skip_hidden = false; BPY_BM_CHECK_OBJ(self); @@ -1163,7 +1163,7 @@ static PyObject *bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value) BPY_BM_CHECK_OBJ(self); param = PyLong_AsLong(value); - if (param != FALSE && param != TRUE) { + if (param != false && param != true) { PyErr_SetString(PyExc_TypeError, "expected a boolean type 0/1"); return NULL; @@ -1191,7 +1191,7 @@ static PyObject *bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value) BPY_BM_CHECK_OBJ(self); param = PyLong_AsLong(value); - if (param != FALSE && param != TRUE) { + if (param != false && param != true) { PyErr_SetString(PyExc_TypeError, "expected a boolean type 0/1"); return NULL; @@ -1258,7 +1258,7 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2, &vert_seq_len, BM_VERT, - TRUE, TRUE, "BMVert.copy_from_vert_interp(...)"); + true, true, "BMVert.copy_from_vert_interp(...)"); if (vert_array == NULL) { return NULL; @@ -1508,8 +1508,8 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw) static const char *kwlist[] = {"verts", "edges", NULL}; BMesh *bm = self->bm; - int do_verts = TRUE; - int do_edges = TRUE; + int do_verts = true; + int do_edges = true; BMFace *f_cpy; BPY_BM_CHECK_OBJ(self); @@ -1649,8 +1649,8 @@ PyDoc_STRVAR(bpy_bmloop_copy_from_face_interp_doc, static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args) { BPy_BMFace *py_face = NULL; - int do_vertex = TRUE; - int do_multires = TRUE; + int do_vertex = true; + int do_multires = true; BPY_BM_CHECK_OBJ(self); @@ -1818,7 +1818,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2, &vert_seq_len, BM_VERT, - TRUE, TRUE, "edges.new(...)"); + true, true, "edges.new(...)"); if (vert_array == NULL) { return NULL; @@ -1896,7 +1896,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 3, PY_SSIZE_T_MAX, &vert_seq_len, BM_VERT, - TRUE, TRUE, "faces.new(...)"); + true, true, "faces.new(...)"); if (vert_array == NULL) { return NULL; @@ -2049,7 +2049,7 @@ static PyObject *bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2, &vert_seq_len, BM_VERT, - TRUE, TRUE, "edges.get(...)"); + true, true, "edges.get(...)"); if (vert_array == NULL) { return NULL; @@ -2101,7 +2101,7 @@ static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 1, PY_SSIZE_T_MAX, &vert_seq_len, BM_VERT, - TRUE, TRUE, "faces.get(...)"); + true, true, "faces.get(...)"); if (vert_array == NULL) { return NULL; @@ -2228,7 +2228,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec { static const char *kwlist[] = {"key", "reverse", NULL}; PyObject *keyfunc = NULL; /* optional */ - int reverse = FALSE; /* optional */ + int do_reverse = false; /* optional */ const char htype = bm_iter_itype_htype_map[self->itype]; int n_elem; @@ -2253,7 +2253,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec if (!PyArg_ParseTupleAndKeywords(args, kw, "|Oi:BMElemSeq.sort", (char **)kwlist, - &keyfunc, &reverse)) + &keyfunc, &do_reverse)) { return NULL; } @@ -2323,7 +2323,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec range_vn_i(elem_idx, n_elem, 0); /* Sort the index array according to the order of the 'keys' array */ - if (reverse) + if (do_reverse) elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_descending; else elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_ascending; @@ -2601,7 +2601,7 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s { BMIter iter; int count = 0; - int ok; + bool ok; PyObject *list; PyObject *item; @@ -2613,14 +2613,14 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s ok = BM_iter_init(&iter, self->bm, self->itype, self->py_ele ? self->py_ele->ele : NULL); - BLI_assert(ok == TRUE); + BLI_assert(ok == true); - if (UNLIKELY(ok == FALSE)) { + if (UNLIKELY(ok == false)) { return list; } /* first loop up-until the start */ - for (ok = TRUE; ok; ok = (BM_iter_step(&iter) != NULL)) { + for (ok = true; ok; ok = (BM_iter_step(&iter) != NULL)) { if (count == start) { break; } @@ -3419,7 +3419,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self) * function where the actual error will be caused by * the previous action. */ #if 0 - if (BM_mesh_validate(self->bm) == FALSE) { + if (BM_mesh_validate(self->bm) == false) { PyErr_Format(PyExc_ReferenceError, "BMesh used by %.200s has become invalid", Py_TYPE(self)->tp_name); @@ -3464,7 +3464,7 @@ void bpy_bm_generic_invalidate(BPy_BMGeneric *self) */ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, const char htype, - const char do_unique_check, const char do_bm_check, + const bool do_unique_check, const bool do_bm_check, const char *error_prefix) { BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL; @@ -3531,17 +3531,17 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ if (do_unique_check) { /* check for double verts! */ - int ok = TRUE; + bool ok = true; for (i = 0; i < seq_len; i++) { - if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == FALSE)) { - ok = FALSE; + if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == false)) { + ok = false; } /* ensure we don't leave this enabled */ BM_elem_flag_disable(alloc[i], BM_ELEM_INTERNAL_TAG); } - if (ok == FALSE) { + if (ok == false) { PyErr_Format(PyExc_ValueError, "%s: found the same %.200s used multiple times", error_prefix, BPy_BMElem_StringFromHType(htype)); |