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 | |
parent | 6cdbd1b1aaae0f8b3018ecf2648699a0ea6d6be8 (diff) |
use booleans for bmesh api.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_api.c | 6 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_ops_call.c | 4 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 66 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.h | 2 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_meshdata.c | 4 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_select.c | 14 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_utils.c | 18 |
7 files changed, 57 insertions, 57 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index ce8153fb994..47e6baf8e93 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -115,8 +115,8 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, static const char *kwlist[] = {"mesh", "tessface", "destructive", NULL}; PyObject *py_me; Mesh *me; - int do_tessface = TRUE; - int is_destructive = TRUE; + int do_tessface = true; + int is_destructive = true; if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:update_edit_mesh", (char **)kwlist, &py_me, &do_tessface, &is_destructive)) @@ -137,7 +137,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, } { - extern void EDBM_update_generic(BMEditMesh *em, const short do_tessface, const short is_destructive); + extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive); EDBM_update_generic(me->edit_btmesh, do_tessface, is_destructive); } diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index 32315195072..d4c8033589a 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -214,7 +214,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec return -1; } else if (((size = ((MatrixObject *)value)->num_col) != ((MatrixObject *)value)->num_row) || - (ELEM(size, 3, 4) == FALSE)) + (ELEM(size, 3, 4) == false)) { PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" expected a 3x3 or 4x4 matrix Matrix", @@ -319,7 +319,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec elem_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX, &elem_array_len, (slot->slot_subtype.elem & BM_ALL_NOLOOP), - TRUE, TRUE, slot_name); + true, true, slot_name); /* error is set above */ if (elem_array == NULL) { diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index ea6e1e29f0b..ed7b48fb14f 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -120,11 +120,11 @@ static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag) param = PyLong_AsLong(value); - if (param == TRUE) { + if (param == true) { BM_elem_flag_enable(self->ele, hflag); return 0; } - else if (param == FALSE) { + else if (param == false) { BM_elem_flag_disable(self->ele, hflag); return 0; } @@ -854,7 +854,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args) bm = self->bm; - BM_mesh_bm_to_me(bm, me, FALSE); + BM_mesh_bm_to_me(bm, me, false); /* we could have the user do this but if they forget blender can easy crash * since the references arrays for the objects derived meshes are now invalid */ @@ -884,9 +884,9 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args) Object *ob; struct Scene *scene; BMesh *bm; - int use_deform = TRUE; - int use_render = FALSE; - int use_cage = FALSE; + int use_deform = true; + int use_render = false; + int use_cage = false; DerivedMesh *dm; const int mask = CD_MASK_BMESH; @@ -984,7 +984,7 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject * BMesh *bm; PyObject *py_mesh; Mesh *me; - int use_shape_key = FALSE; + int use_shape_key = false; int shape_key_index = 0; if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:from_mesh", (char **)kwlist, @@ -1032,7 +1032,7 @@ static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value) BPY_BM_CHECK_OBJ(self); param = PyLong_AsLong(value); - if (param != FALSE && param != TRUE) { + if (param != false && param != true) { PyErr_SetString(PyExc_TypeError, "expected a boolean type 0/1"); return NULL; @@ -1056,7 +1056,7 @@ PyDoc_STRVAR(bpy_bmesh_normal_update_doc, static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self, PyObject *args) { - int skip_hidden = FALSE; + int skip_hidden = false; BPY_BM_CHECK_OBJ(self); @@ -1163,7 +1163,7 @@ static PyObject *bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value) BPY_BM_CHECK_OBJ(self); param = PyLong_AsLong(value); - if (param != FALSE && param != TRUE) { + if (param != false && param != true) { PyErr_SetString(PyExc_TypeError, "expected a boolean type 0/1"); return NULL; @@ -1191,7 +1191,7 @@ static PyObject *bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value) BPY_BM_CHECK_OBJ(self); param = PyLong_AsLong(value); - if (param != FALSE && param != TRUE) { + if (param != false && param != true) { PyErr_SetString(PyExc_TypeError, "expected a boolean type 0/1"); return NULL; @@ -1258,7 +1258,7 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2, &vert_seq_len, BM_VERT, - TRUE, TRUE, "BMVert.copy_from_vert_interp(...)"); + true, true, "BMVert.copy_from_vert_interp(...)"); if (vert_array == NULL) { return NULL; @@ -1508,8 +1508,8 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw) static const char *kwlist[] = {"verts", "edges", NULL}; BMesh *bm = self->bm; - int do_verts = TRUE; - int do_edges = TRUE; + int do_verts = true; + int do_edges = true; BMFace *f_cpy; BPY_BM_CHECK_OBJ(self); @@ -1649,8 +1649,8 @@ PyDoc_STRVAR(bpy_bmloop_copy_from_face_interp_doc, static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args) { BPy_BMFace *py_face = NULL; - int do_vertex = TRUE; - int do_multires = TRUE; + int do_vertex = true; + int do_multires = true; BPY_BM_CHECK_OBJ(self); @@ -1818,7 +1818,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2, &vert_seq_len, BM_VERT, - TRUE, TRUE, "edges.new(...)"); + true, true, "edges.new(...)"); if (vert_array == NULL) { return NULL; @@ -1896,7 +1896,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 3, PY_SSIZE_T_MAX, &vert_seq_len, BM_VERT, - TRUE, TRUE, "faces.new(...)"); + true, true, "faces.new(...)"); if (vert_array == NULL) { return NULL; @@ -2049,7 +2049,7 @@ static PyObject *bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2, &vert_seq_len, BM_VERT, - TRUE, TRUE, "edges.get(...)"); + true, true, "edges.get(...)"); if (vert_array == NULL) { return NULL; @@ -2101,7 +2101,7 @@ static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args) vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 1, PY_SSIZE_T_MAX, &vert_seq_len, BM_VERT, - TRUE, TRUE, "faces.get(...)"); + true, true, "faces.get(...)"); if (vert_array == NULL) { return NULL; @@ -2228,7 +2228,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec { static const char *kwlist[] = {"key", "reverse", NULL}; PyObject *keyfunc = NULL; /* optional */ - int reverse = FALSE; /* optional */ + int do_reverse = false; /* optional */ const char htype = bm_iter_itype_htype_map[self->itype]; int n_elem; @@ -2253,7 +2253,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec if (!PyArg_ParseTupleAndKeywords(args, kw, "|Oi:BMElemSeq.sort", (char **)kwlist, - &keyfunc, &reverse)) + &keyfunc, &do_reverse)) { return NULL; } @@ -2323,7 +2323,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec range_vn_i(elem_idx, n_elem, 0); /* Sort the index array according to the order of the 'keys' array */ - if (reverse) + if (do_reverse) elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_descending; else elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_ascending; @@ -2601,7 +2601,7 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s { BMIter iter; int count = 0; - int ok; + bool ok; PyObject *list; PyObject *item; @@ -2613,14 +2613,14 @@ static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t s ok = BM_iter_init(&iter, self->bm, self->itype, self->py_ele ? self->py_ele->ele : NULL); - BLI_assert(ok == TRUE); + BLI_assert(ok == true); - if (UNLIKELY(ok == FALSE)) { + if (UNLIKELY(ok == false)) { return list; } /* first loop up-until the start */ - for (ok = TRUE; ok; ok = (BM_iter_step(&iter) != NULL)) { + for (ok = true; ok; ok = (BM_iter_step(&iter) != NULL)) { if (count == start) { break; } @@ -3419,7 +3419,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self) * function where the actual error will be caused by * the previous action. */ #if 0 - if (BM_mesh_validate(self->bm) == FALSE) { + if (BM_mesh_validate(self->bm) == false) { PyErr_Format(PyExc_ReferenceError, "BMesh used by %.200s has become invalid", Py_TYPE(self)->tp_name); @@ -3464,7 +3464,7 @@ void bpy_bm_generic_invalidate(BPy_BMGeneric *self) */ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, const char htype, - const char do_unique_check, const char do_bm_check, + const bool do_unique_check, const bool do_bm_check, const char *error_prefix) { BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL; @@ -3531,17 +3531,17 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ if (do_unique_check) { /* check for double verts! */ - int ok = TRUE; + bool ok = true; for (i = 0; i < seq_len; i++) { - if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == FALSE)) { - ok = FALSE; + if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == false)) { + ok = false; } /* ensure we don't leave this enabled */ BM_elem_flag_disable(alloc[i], BM_ELEM_INTERNAL_TAG); } - if (ok == FALSE) { + if (ok == false) { PyErr_Format(PyExc_ValueError, "%s: found the same %.200s used multiple times", error_prefix, BPy_BMElem_StringFromHType(htype)); diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h index d15918a3c11..8e6d04ec9ba 100644 --- a/source/blender/python/bmesh/bmesh_py_types.h +++ b/source/blender/python/bmesh/bmesh_py_types.h @@ -160,7 +160,7 @@ PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele); /* just checks ty void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, const char htype, - const char do_unique_check, const char do_bm_check, + const bool do_unique_check, const bool do_bm_check, const char *error_prefix); PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len); diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index b0870578f5a..f59676252d4 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -187,10 +187,10 @@ static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag const int flag = GET_INT_FROM_POINTER(flag_p); switch (PyLong_AsLong(value)) { - case TRUE: + case true: self->data->flag |= flag; return 0; - case FALSE: + case false: self->data->flag &= ~flag; return 0; default: diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c index dfcfbeb0ab5..33cb1f5d0fb 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.c +++ b/source/blender/python/bmesh/bmesh_py_types_select.c @@ -107,7 +107,7 @@ static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value) if ((BPy_BMVert_Check(value) || BPy_BMEdge_Check(value) || - BPy_BMFace_Check(value)) == FALSE) + BPy_BMFace_Check(value)) == false) { PyErr_Format(PyExc_TypeError, "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name); @@ -132,7 +132,7 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val if ((BPy_BMVert_Check(value) || BPy_BMEdge_Check(value) || - BPy_BMFace_Check(value)) == FALSE) + BPy_BMFace_Check(value)) == false) { PyErr_Format(PyExc_TypeError, "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name); @@ -141,7 +141,7 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.remove()"); - if (BM_select_history_remove(self->bm, value->ele) == FALSE) { + if (BM_select_history_remove(self->bm, value->ele) == false) { PyErr_SetString(PyExc_ValueError, "Element not found in selection history"); return NULL; @@ -196,7 +196,7 @@ static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keyn static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssize_t start, Py_ssize_t stop) { int count = 0; - int ok; + bool ok; PyObject *list; PyObject *item; @@ -210,12 +210,12 @@ static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssi ok = (ese != NULL); - if (UNLIKELY(ok == FALSE)) { + if (UNLIKELY(ok == false)) { return list; } /* first loop up-until the start */ - for (ok = TRUE; ok; ok = ((ese = ese->next) != NULL)) { + for (ok = true; ok; ok = ((ese = ese->next) != NULL)) { if (count == start) { break; } @@ -429,7 +429,7 @@ int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value) value_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX, &value_len, BM_VERT | BM_EDGE | BM_FACE, - TRUE, TRUE, "BMesh.select_history = value"); + true, true, "BMesh.select_history = value"); if (value_array == NULL) { return -1; diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c index a43c5c18126..7c0adcfc997 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.c +++ b/source/blender/python/bmesh/bmesh_py_utils.c @@ -90,7 +90,7 @@ static PyObject *bpy_bm_utils_vert_collapse_edge(PyObject *UNUSED(self), PyObjec bm = py_edge->bm; - e_new = BM_vert_collapse_edge(bm, py_edge->e, py_vert->v, TRUE); + e_new = BM_vert_collapse_edge(bm, py_edge->e, py_vert->v, true); if (e_new) { return BPy_BMEdge_CreatePyObject(bm, e_new); @@ -156,7 +156,7 @@ static PyObject *bpy_bm_utils_vert_collapse_faces(PyObject *UNUSED(self), PyObje bm = py_edge->bm; - e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, CLAMPIS(fac, 0.0f, 1.0f), do_join_faces, TRUE); + e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, CLAMPIS(fac, 0.0f, 1.0f), do_join_faces, true); if (e_new) { return BPy_BMEdge_CreatePyObject(bm, e_new); @@ -239,7 +239,7 @@ static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *ar edge_array = BPy_BMElem_PySeq_As_Array(&bm, edge_seq, 0, PY_SSIZE_T_MAX, &edge_array_len, BM_EDGE, - TRUE, TRUE, "vert_separate(...)"); + true, true, "vert_separate(...)"); if (edge_array == NULL) { return NULL; @@ -338,7 +338,7 @@ PyDoc_STRVAR(bpy_bm_utils_edge_rotate_doc, static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args) { BPy_BMEdge *py_edge; - int do_ccw = FALSE; + int do_ccw = false; BMesh *bm; BMEdge *e_new = NULL; @@ -396,7 +396,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args, /* optional */ PyObject *py_coords = NULL; - int edge_exists = TRUE; + int edge_exists = true; BPy_BMEdge *py_edge_example = NULL; float *coords; @@ -426,8 +426,8 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args, } /* this doubles for checking that the verts are in the same mesh */ - if (BM_vert_in_face(py_face->f, py_vert_a->v) == FALSE || - BM_vert_in_face(py_face->f, py_vert_b->v) == FALSE) + if (BM_vert_in_face(py_face->f, py_vert_a->v) == false || + BM_vert_in_face(py_face->f, py_vert_b->v) == false) { PyErr_SetString(PyExc_ValueError, "face_split(...): one of the verts passed is not found in the face"); @@ -496,7 +496,7 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *args) BMFace **face_array; Py_ssize_t face_seq_len = 0; BMFace *f_new; - int do_remove = TRUE; + int do_remove = true; if (!PyArg_ParseTuple(args, "O|i:face_join", &py_face_array, &do_remove)) { return NULL; @@ -504,7 +504,7 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *args) face_array = BPy_BMElem_PySeq_As_Array(&bm, py_face_array, 2, PY_SSIZE_T_MAX, &face_seq_len, BM_FACE, - TRUE, TRUE, "face_join(...)"); + true, true, "face_join(...)"); if (face_array == NULL) { return NULL; /* error will be set */ |