Cleanup: style, use braces for the Python API
authorCampbell Barton <ideasman42@gmail.com>
Fri, 29 Mar 2019 19:12:48 +0000 (06:12 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 29 Mar 2019 20:14:28 +0000 (07:14 +1100)
39 files changed:
source/blender/python/bmesh/bmesh_py_ops.c
source/blender/python/bmesh/bmesh_py_types.c
source/blender/python/bmesh/bmesh_py_types_customdata.c
source/blender/python/bmesh/bmesh_py_types_meshdata.c
source/blender/python/bmesh/bmesh_py_types_select.c
source/blender/python/generic/bgl.c
source/blender/python/generic/blf_py_api.c
source/blender/python/generic/bpy_internal_import.c
source/blender/python/generic/idprop_py_api.c
source/blender/python/generic/py_capi_utils.c
source/blender/python/gpu/gpu_py_offscreen.c
source/blender/python/gpu/gpu_py_types.c
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_app.c
source/blender/python/intern/bpy_app_handlers.c
source/blender/python/intern/bpy_app_translations.c
source/blender/python/intern/bpy_capi_utils.c
source/blender/python/intern/bpy_driver.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_library_load.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_operator_wrap.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_anim.c
source/blender/python/intern/bpy_rna_array.c
source/blender/python/intern/bpy_rna_callback.c
source/blender/python/intern/bpy_traceback.c
source/blender/python/mathutils/mathutils.c
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Euler.c
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/python/mathutils/mathutils_Vector.c
source/blender/python/mathutils/mathutils_bvhtree.c
source/blender/python/mathutils/mathutils_geometry.c
source/blender/python/mathutils/mathutils_interpolate.c
source/blender/python/mathutils/mathutils_kdtree.c
source/blender/python/mathutils/mathutils_noise.c

index fbd79f2..f35bfb7 100644 (file)
@@ -351,11 +351,13 @@ PyObject *BPyInit_bmesh_ops(void)
 {
        PyObject *submodule;
 
-       if (PyType_Ready(&bmesh_ops_fakemod_Type) < 0)
+       if (PyType_Ready(&bmesh_ops_fakemod_Type) < 0) {
                return NULL;
+       }
 
-       if (PyType_Ready(&bmesh_op_Type) < 0)
+       if (PyType_Ready(&bmesh_op_Type) < 0) {
                return NULL;
+       }
 
        submodule = PyObject_New(PyObject, &bmesh_ops_fakemod_Type);
 
index 1addd9b..366f0b4 100644 (file)
@@ -1445,8 +1445,9 @@ static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self, PyObject *args)
 
        BPY_BM_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "|O:calc_edge_angle", &fallback))
+       if (!PyArg_ParseTuple(args, "|O:calc_edge_angle", &fallback)) {
                return NULL;
+       }
 
        angle = BM_vert_calc_edge_angle_ex(self->v, angle_invalid);
 
@@ -1530,8 +1531,9 @@ static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self, PyObject *args)
 
        BPY_BM_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "|O:calc_face_angle", &fallback))
+       if (!PyArg_ParseTuple(args, "|O:calc_face_angle", &fallback)) {
                return NULL;
+       }
 
        angle = BM_edge_calc_face_angle_ex(self->e, angle_invalid);
 
@@ -1569,8 +1571,9 @@ static PyObject *bpy_bmedge_calc_face_angle_signed(BPy_BMEdge *self, PyObject *a
 
        BPY_BM_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "|O:calc_face_angle_signed", &fallback))
+       if (!PyArg_ParseTuple(args, "|O:calc_face_angle_signed", &fallback)) {
                return NULL;
+       }
 
        angle = BM_edge_calc_face_angle_signed_ex(self->e, angle_invalid);
 
@@ -2161,7 +2164,9 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
                ret = BPy_BMEdge_CreatePyObject(bm, e);
 
 cleanup:
-               if (vert_array) PyMem_FREE(vert_array);
+               if (vert_array) {
+                       PyMem_FREE(vert_array);
+               }
                return ret;
        }
 }
@@ -2239,7 +2244,9 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
 
                /* pass through */
 cleanup:
-               if (vert_array) PyMem_FREE(vert_array);
+               if (vert_array) {
+                       PyMem_FREE(vert_array);
+               }
                return ret;
        }
 }
@@ -2535,9 +2542,15 @@ static int bpy_bmelemseq_sort_cmp_by_keys_ascending(const void *index1_v, const
        const int *index1 = (int *)index1_v;
        const int *index2 = (int *)index2_v;
 
-       if      (keys[*index1] < keys[*index2]) return -1;
-       else if (keys[*index1] > keys[*index2]) return 1;
-       else                                    return 0;
+       if (keys[*index1] < keys[*index2]) {
+               return -1;
+       }
+       else if (keys[*index1] > keys[*index2]) {
+               return 1;
+       }
+       else {
+               return 0;
+       }
 }
 
 static int bpy_bmelemseq_sort_cmp_by_keys_descending(const void *index1_v, const void *index2_v, void *keys_v)
@@ -2646,10 +2659,12 @@ 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 (do_reverse)
+       if (do_reverse) {
                elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_descending;
-       else
+       }
+       else {
                elem_idx_compare_by_keys = bpy_bmelemseq_sort_cmp_by_keys_ascending;
+       }
 
        BLI_qsort_r(elem_idx, n_elem, sizeof(*elem_idx), elem_idx_compare_by_keys, keys);
 
@@ -2920,7 +2935,10 @@ static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, int keynum)
 {
        BPY_BM_CHECK_OBJ(self);
 
-       if (keynum < 0) keynum += bpy_bmelemseq_length(self); /* only get length on negative value, may loop entire seq */
+       if (keynum < 0) {
+               /* only get length on negative value, may loop entire seq */
+               keynum += bpy_bmelemseq_length(self);
+       }
        if (keynum >= 0) {
                if (self->itype <= BM_FACES_OF_MESH) {
                        if ((self->bm->elem_table_dirty & bm_iter_itype_htype_map[self->itype]) == 0) {
@@ -3014,8 +3032,9 @@ static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
        /* don't need error check here */
        if (PyIndex_Check(key)) {
                Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
+               }
                return bpy_bmelemseq_subscript_int(self, i);
        }
        else if (PySlice_Check(key)) {
@@ -3037,14 +3056,22 @@ static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
                        Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
                        /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
-                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
-                       if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
+                               return NULL;
+                       }
+                       if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
+                               return NULL;
+                       }
 
                        if (start < 0 || stop < 0) {
                                /* only get the length for negative values */
                                Py_ssize_t len = bpy_bmelemseq_length(self);
-                               if (start < 0) start += len;
-                               if (stop  < 0) stop  += len;
+                               if (start < 0) {
+                                       start += len;
+                               }
+                               if (stop  < 0) {
+                                       stop  += len;
+                               }
                        }
 
                        if (stop - start <= 0) {
@@ -3162,10 +3189,18 @@ static void bpy_bmesh_dealloc(BPy_BMesh *self)
        if (bm) {
                bm_dealloc_editmode_warn(self);
 
-               if (CustomData_has_layer(&bm->vdata, CD_BM_ELEM_PYPTR)) BM_data_layer_free(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
-               if (CustomData_has_layer(&bm->edata, CD_BM_ELEM_PYPTR)) BM_data_layer_free(bm, &bm->edata, CD_BM_ELEM_PYPTR);
-               if (CustomData_has_layer(&bm->pdata, CD_BM_ELEM_PYPTR)) BM_data_layer_free(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
-               if (CustomData_has_layer(&bm->ldata, CD_BM_ELEM_PYPTR)) BM_data_layer_free(bm, &bm->ldata, CD_BM_ELEM_PYPTR);
+               if (CustomData_has_layer(&bm->vdata, CD_BM_ELEM_PYPTR)) {
+                       BM_data_layer_free(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
+               }
+               if (CustomData_has_layer(&bm->edata, CD_BM_ELEM_PYPTR)) {
+                       BM_data_layer_free(bm, &bm->edata, CD_BM_ELEM_PYPTR);
+               }
+               if (CustomData_has_layer(&bm->pdata, CD_BM_ELEM_PYPTR)) {
+                       BM_data_layer_free(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
+               }
+               if (CustomData_has_layer(&bm->ldata, CD_BM_ELEM_PYPTR)) {
+                       BM_data_layer_free(bm, &bm->ldata, CD_BM_ELEM_PYPTR);
+               }
 
                bm->py_handle = NULL;
 
@@ -3182,8 +3217,9 @@ static void bpy_bmvert_dealloc(BPy_BMElem *self)
        BMesh *bm = self->bm;
        if (bm) {
                void **ptr = CustomData_bmesh_get(&bm->vdata, self->ele->head.data, CD_BM_ELEM_PYPTR);
-               if (ptr)
+               if (ptr) {
                        *ptr = NULL;
+               }
        }
        PyObject_DEL(self);
 }
@@ -3193,8 +3229,9 @@ static void bpy_bmedge_dealloc(BPy_BMElem *self)
        BMesh *bm = self->bm;
        if (bm) {
                void **ptr = CustomData_bmesh_get(&bm->edata, self->ele->head.data, CD_BM_ELEM_PYPTR);
-               if (ptr)
+               if (ptr) {
                        *ptr = NULL;
+               }
        }
        PyObject_DEL(self);
 }
@@ -3204,8 +3241,9 @@ static void bpy_bmface_dealloc(BPy_BMElem *self)
        BMesh *bm = self->bm;
        if (bm) {
                void **ptr = CustomData_bmesh_get(&bm->pdata, self->ele->head.data, CD_BM_ELEM_PYPTR);
-               if (ptr)
+               if (ptr) {
                        *ptr = NULL;
+               }
        }
        PyObject_DEL(self);
 }
@@ -3215,8 +3253,9 @@ static void bpy_bmloop_dealloc(BPy_BMElem *self)
        BMesh *bm = self->bm;
        if (bm) {
                void **ptr = CustomData_bmesh_get(&bm->ldata, self->ele->head.data, CD_BM_ELEM_PYPTR);
-               if (ptr)
+               if (ptr) {
                        *ptr = NULL;
+               }
        }
        PyObject_DEL(self);
 }
@@ -3938,7 +3977,9 @@ void *BPy_BMElem_PySeq_As_Array_FAST(
        }
 
        *r_size = seq_len;
-       if (r_bm) *r_bm = bm;
+       if (r_bm) {
+               *r_bm = bm;
+       }
        return alloc;
 
 err_cleanup:
@@ -4042,10 +4083,10 @@ char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32])
 {
        /* zero to ensure string is always NULL terminated */
        char *ret_ptr = ret;
-       if (htype & BM_VERT) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMVert_Type.tp_name);
-       if (htype & BM_EDGE) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMEdge_Type.tp_name);
-       if (htype & BM_FACE) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMFace_Type.tp_name);
-       if (htype & BM_LOOP) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMLoop_Type.tp_name);
+       if (htype & BM_VERT) { ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMVert_Type.tp_name); }
+       if (htype & BM_EDGE) { ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMEdge_Type.tp_name); }
+       if (htype & BM_FACE) { ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMFace_Type.tp_name); }
+       if (htype & BM_LOOP) { ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMLoop_Type.tp_name); }
        ret[0]   = '(';
        *ret_ptr++ = ')';
        *ret_ptr   = '\0';
index c161b97..abe146f 100644 (file)
@@ -615,7 +615,9 @@ static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self
 
        len = bpy_bmlayercollection_length(self);
 
-       if (keynum < 0) keynum += len;
+       if (keynum < 0) {
+               keynum += len;
+       }
        if (keynum >= 0) {
                if (keynum < len) {
                        return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, keynum);
@@ -636,8 +638,12 @@ static PyObject *bpy_bmlayercollection_subscript_slice(BPy_BMLayerCollection *se
 
        BPY_BM_CHECK_OBJ(self);
 
-       if (start >= len) start = len - 1;
-       if (stop  >= len) stop  = len - 1;
+       if (start >= len) {
+               start = len - 1;
+       }
+       if (stop  >= len) {
+               stop  = len - 1;
+       }
 
        tuple = PyTuple_New(stop - start);
 
@@ -656,8 +662,9 @@ static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, Py
        }
        else if (PyIndex_Check(key)) {
                Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
+               }
                return bpy_bmlayercollection_subscript_int(self, i);
        }
        else if (PySlice_Check(key)) {
@@ -679,14 +686,22 @@ static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, Py
                        Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
                        /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
-                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
-                       if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
+                               return NULL;
+                       }
+                       if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
+                               return NULL;
+                       }
 
                        if (start < 0 || stop < 0) {
                                /* only get the length for negative values */
                                Py_ssize_t len = bpy_bmlayercollection_length(self);
-                               if (start < 0) start += len;
-                               if (stop  < 0) stop  += len;
+                               if (start < 0) {
+                                       start += len;
+                               }
+                               if (stop  < 0) {
+                                       stop  += len;
+                               }
                        }
 
                        if (stop - start <= 0) {
@@ -1085,8 +1100,9 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
                                ret = -1;
                        }
                        else {
-                               if (tmp_val_len > sizeof(mstring->s))
+                               if (tmp_val_len > sizeof(mstring->s)) {
                                        tmp_val_len = sizeof(mstring->s);
+                               }
                                memcpy(mstring->s, tmp_val, tmp_val_len);
                                mstring->s_len = tmp_val_len;
                        }
index aba54c6..604b55d 100644 (file)
@@ -306,8 +306,9 @@ static int mathutils_bmloopcol_set(BaseMathObject *bmo, int UNUSED(subtype))
 static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
 {
        /* lazy, avoid repeteing the case statement */
-       if (mathutils_bmloopcol_get(bmo, subtype) == -1)
+       if (mathutils_bmloopcol_get(bmo, subtype) == -1) {
                return -1;
+       }
        return 0;
 }
 
@@ -316,8 +317,9 @@ static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int i
        const float f = bmo->data[index];
 
        /* lazy, avoid repeteing the case statement */
-       if (mathutils_bmloopcol_get(bmo, subtype) == -1)
+       if (mathutils_bmloopcol_get(bmo, subtype) == -1) {
                return -1;
+       }
 
        bmo->data[index] = f;
        return mathutils_bmloopcol_set(bmo, subtype);
index ed631f7..e257c1b 100644 (file)
@@ -255,8 +255,9 @@ static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *ke
        /* don't need error check here */
        if (PyIndex_Check(key)) {
                Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
+               }
                return bpy_bmeditselseq_subscript_int(self, i);
        }
        else if (PySlice_Check(key)) {
@@ -278,14 +279,22 @@ static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *ke
                        Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
                        /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
-                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
-                       if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
+                               return NULL;
+                       }
+                       if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
+                               return NULL;
+                       }
 
                        if (start < 0 || stop < 0) {
                                /* only get the length for negative values */
                                Py_ssize_t len = bpy_bmeditselseq_length(self);
-                               if (start < 0) start += len;
-                               if (stop  < 0) stop  += len;
+                               if (start < 0) {
+                                       start += len;
+                               }
+                               if (stop  < 0) {
+                                       stop  += len;
+                               }
                        }
 
                        if (stop - start <= 0) {
index 13342b7..b52326e 100644 (file)
@@ -476,15 +476,25 @@ static int gl_buffer_type_from_py_buffer(Py_buffer *pybuffer)
        Py_ssize_t itemsize = pybuffer->itemsize;
 
        if (PyC_StructFmt_type_is_float_any(format)) {
-               if (itemsize == 4) return GL_FLOAT;
-               if (itemsize == 8) return GL_DOUBLE;
+               if (itemsize == 4) {
+                       return GL_FLOAT;
+               }
+               if (itemsize == 8) {
+                       return GL_DOUBLE;
+               }
        }
        if (PyC_StructFmt_type_is_byte(format) ||
            PyC_StructFmt_type_is_int_any(format))
        {
-               if (itemsize == 1) return GL_BYTE;
-               if (itemsize == 2) return GL_SHORT;
-               if (itemsize == 4) return GL_INT;
+               if (itemsize == 1) {
+                       return GL_BYTE;
+               }
+               if (itemsize == 2) {
+                       return GL_SHORT;
+               }
+               if (itemsize == 4) {
+                       return GL_INT;
+               }
        }
 
        return -1; /* UNKNOWN */
@@ -769,10 +779,12 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
                for (i = 0; i < ndimensions; i++) {
                        PyObject *ob = PySequence_GetItem(length_ob, i);
 
-                       if (!PyLong_Check(ob))
+                       if (!PyLong_Check(ob)) {
                                dimensions[i] = 1;
-                       else
+                       }
+                       else {
                                dimensions[i] = PyLong_AsLong(ob);
+                       }
                        Py_DECREF(ob);
 
                        if (dimensions[i] < 1) {
@@ -868,9 +880,15 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
        PyObject *list;
        int count;
 
-       if (begin < 0) begin = 0;
-       if (end > self->dimensions[0]) end = self->dimensions[0];
-       if (begin > end) begin = end;
+       if (begin < 0) {
+               begin = 0;
+       }
+       if (end > self->dimensions[0]) {
+               end = self->dimensions[0];
+       }
+       if (begin > end) {
+               begin = end;
+       }
 
        list = PyList_New(end - begin);
 
@@ -916,9 +934,15 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
        PyObject *item;
        int count, err = 0;
 
-       if (begin < 0) begin = 0;
-       if (end > self->dimensions[0]) end = self->dimensions[0];
-       if (begin > end) begin = end;
+       if (begin < 0) {
+               begin = 0;
+       }
+       if (end > self->dimensions[0]) {
+               end = self->dimensions[0];
+       }
+       if (begin > end) {
+               begin = end;
+       }
 
        if (!PySequence_Check(seq)) {
                PyErr_Format(PyExc_TypeError,
@@ -957,17 +981,20 @@ static PyObject *Buffer_subscript(Buffer *self, PyObject *item)
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += self->dimensions[0];
+               }
                return Buffer_item(self, i);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -993,20 +1020,24 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
 {
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += self->dimensions[0];
+               }
                return Buffer_ass_item(self, i, value);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0) {
                        return -1;
+               }
 
-               if (step == 1)
+               if (step == 1) {
                        return Buffer_ass_slice(self, start, stop, value);
+               }
                else {
                        PyErr_SetString(PyExc_IndexError,
                                        "slice steps not supported with vectors");
@@ -1390,8 +1421,9 @@ PyObject *BPyInit_bgl(void)
        submodule = PyModule_Create(&BGL_module_def);
        dict = PyModule_GetDict(submodule);
 
-       if (PyType_Ready(&BGL_bufferType) < 0)
+       if (PyType_Ready(&BGL_bufferType) < 0) {
                return NULL;  /* should never happen */
+       }
 
        PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
        Py_INCREF((PyObject *)&BGL_bufferType);
@@ -2554,8 +2586,9 @@ static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
        unsigned int shader;
        const char *source;
 
-       if (!PyArg_ParseTuple(args, "Is", &shader, &source))
+       if (!PyArg_ParseTuple(args, "Is", &shader, &source)) {
                return NULL;
+       }
 
        glShaderSource(shader, 1, (const char **)&source, NULL);
 
index 79ffb9a..9161e5d 100644 (file)
@@ -50,8 +50,9 @@ static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args)
        int fontid;
        float x, y, z;
 
-       if (!PyArg_ParseTuple(args, "ifff:blf.position", &fontid, &x, &y, &z))
+       if (!PyArg_ParseTuple(args, "ifff:blf.position", &fontid, &x, &y, &z)) {
                return NULL;
+       }
 
        BLF_position(fontid, x, y, z);
 
@@ -75,8 +76,9 @@ static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args)
 {
        int fontid, size, dpi;
 
-       if (!PyArg_ParseTuple(args, "iii:blf.size", &fontid, &size, &dpi))
+       if (!PyArg_ParseTuple(args, "iii:blf.size", &fontid, &size, &dpi)) {
                return NULL;
+       }
 
        BLF_size(fontid, size, dpi);
 
@@ -99,8 +101,9 @@ static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
        float aspect;
        int fontid;
 
-       if (!PyArg_ParseTuple(args, "if:blf.aspect", &fontid, &aspect))
+       if (!PyArg_ParseTuple(args, "if:blf.aspect", &fontid, &aspect)) {
                return NULL;
+       }
 
        BLF_aspect(fontid, aspect, aspect, 1.0);
 
@@ -157,8 +160,9 @@ static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
 {
        int blur, fontid;
 
-       if (!PyArg_ParseTuple(args, "ii:blf.blur", &fontid, &blur))
+       if (!PyArg_ParseTuple(args, "ii:blf.blur", &fontid, &blur)) {
                return NULL;
+       }
 
        BLF_blur(fontid, blur);
 
@@ -183,8 +187,9 @@ static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
        int text_length;
        int fontid;
 
-       if (!PyArg_ParseTuple(args, "is#:blf.draw", &fontid, &text, &text_length))
+       if (!PyArg_ParseTuple(args, "is#:blf.draw", &fontid, &text, &text_length)) {
                return NULL;
+       }
 
        BLF_draw(fontid, text, (unsigned int)text_length);
 
@@ -210,8 +215,9 @@ static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
        PyObject *ret;
        int fontid;
 
-       if (!PyArg_ParseTuple(args, "is:blf.dimensions", &fontid, &text))
+       if (!PyArg_ParseTuple(args, "is:blf.dimensions", &fontid, &text)) {
                return NULL;
+       }
 
        BLF_width_and_height(fontid, text, INT_MAX, &r_width, &r_height);
 
@@ -243,8 +249,9 @@ static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
        float xmin, ymin, xmax, ymax;
        int fontid;
 
-       if (!PyArg_ParseTuple(args, "iffff:blf.clipping", &fontid, &xmin, &ymin, &xmax, &ymax))
+       if (!PyArg_ParseTuple(args, "iffff:blf.clipping", &fontid, &xmin, &ymin, &xmax, &ymax)) {
                return NULL;
+       }
 
        BLF_clipping(fontid, xmin, ymin, xmax, ymax);
 
@@ -266,8 +273,9 @@ static PyObject *py_blf_word_wrap(PyObject *UNUSED(self), PyObject *args)
        int wrap_width;
        int fontid;
 
-       if (!PyArg_ParseTuple(args, "ii:blf.word_wrap", &fontid, &wrap_width))
+       if (!PyArg_ParseTuple(args, "ii:blf.word_wrap", &fontid, &wrap_width)) {
                return NULL;
+       }
 
        BLF_wordwrap(fontid, wrap_width);
 
@@ -288,8 +296,9 @@ static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args)
 {
        int option, fontid;
 
-       if (!PyArg_ParseTuple(args, "ii:blf.disable", &fontid, &option))
+       if (!PyArg_ParseTuple(args, "ii:blf.disable", &fontid, &option)) {
                return NULL;
+       }
 
        BLF_disable(fontid, option);
 
@@ -310,8 +319,9 @@ static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args)
 {
        int option, fontid;
 
-       if (!PyArg_ParseTuple(args, "ii:blf.enable", &fontid, &option))
+       if (!PyArg_ParseTuple(args, "ii:blf.enable", &fontid, &option)) {
                return NULL;
+       }
 
        BLF_enable(fontid, option);
 
@@ -333,8 +343,9 @@ static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
        float angle;
        int fontid;
 
-       if (!PyArg_ParseTuple(args, "if:blf.rotation", &fontid, &angle))
+       if (!PyArg_ParseTuple(args, "if:blf.rotation", &fontid, &angle)) {
                return NULL;
+       }
 
        BLF_rotation(fontid, angle);
 
@@ -397,8 +408,9 @@ static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
 {
        int x, y, fontid;
 
-       if (!PyArg_ParseTuple(args, "iii:blf.shadow_offset", &fontid, &x, &y))
+       if (!PyArg_ParseTuple(args, "iii:blf.shadow_offset", &fontid, &x, &y)) {
                return NULL;
+       }
 
        BLF_shadow_offset(fontid, x, y);
 
@@ -419,8 +431,9 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
 {
        const char *filename;
 
-       if (!PyArg_ParseTuple(args, "s:blf.load", &filename))
+       if (!PyArg_ParseTuple(args, "s:blf.load", &filename)) {
                return NULL;
+       }
 
        return PyLong_FromLong(BLF_load(filename));
 }
@@ -437,8 +450,9 @@ static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args)
 {
        const char *filename;
 
-       if (!PyArg_ParseTuple(args, "s:blf.unload", &filename))
+       if (!PyArg_ParseTuple(args, "s:blf.unload", &filename)) {
                return NULL;
+       }
 
        BLF_unload(filename);
 
index 96b5645..0baa400 100644 (file)
@@ -180,8 +180,9 @@ PyObject *bpy_text_import_name(const char *name, int *found)
        }
 
        /* we know this cant be importable, the name is too long for blender! */
-       if (namelen >= (MAX_ID_NAME - 2) - 3)
+       if (namelen >= (MAX_ID_NAME - 2) - 3) {
                return NULL;
+       }
 
        memcpy(txtname, name, namelen);
        memcpy(&txtname[namelen], ".py", 4);
@@ -200,10 +201,12 @@ PyObject *bpy_text_import_name(const char *name, int *found)
                maggie = maggie->next;
        }
 
-       if (!text)
+       if (!text) {
                return NULL;
-       else
+       }
+       else {
                *found = 1;
+       }
 
        return bpy_text_import(text);
 }
@@ -229,8 +232,9 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
        *found = 0;
 
        /* get name, filename from the module itself */
-       if ((name = PyModule_GetName(module)) == NULL)
+       if ((name = PyModule_GetName(module)) == NULL) {
                return NULL;
+       }
 
        {
                PyObject *module_file = PyModule_GetFilenameObject(module);
@@ -248,10 +252,12 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
        text = BLI_findstring(&maggie->texts, BLI_path_basename(filepath), offsetof(ID, name) + 2);
 
        /* uh-oh.... didn't find it */
-       if (!text)
+       if (!text) {
                return NULL;
-       else
+       }
+       else {
                *found = 1;
+       }
 
        if (bpy_text_compile(text) == false) {
                return NULL;
@@ -283,8 +289,9 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
        /* import existing builtin modules or modules that have been imported already */
        newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
 
-       if (newmodule)
+       if (newmodule) {
                return newmodule;
+       }
 
        PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
 
@@ -330,8 +337,9 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
 
        newmodule = PyObject_CallFunctionObjArgs(imp_reload_orig, module, NULL);
 
-       if (newmodule)
+       if (newmodule) {
                return newmodule;
+       }
 
        /* no file, try importing from memory */
        PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */
index 6c5177d..f18d02a 100644 (file)
@@ -419,11 +419,17 @@ static int idp_array_type_from_formatstr_and_size(const char *typestr, Py_ssize_
        char format = PyC_StructFmt_type_from_str(typestr);
 
        if (PyC_StructFmt_type_is_float_any(format)) {
-               if (itemsize == 4) return IDP_FLOAT;
-               if (itemsize == 8) return IDP_DOUBLE;
+               if (itemsize == 4) {
+                       return IDP_FLOAT;
+               }
+               if (itemsize == 8) {
+                       return IDP_DOUBLE;
+               }
        }
        if (PyC_StructFmt_type_is_int_any(format)) {
-               if (itemsize == 4) return IDP_INT;
+               if (itemsize == 4) {
+                       return IDP_INT;
+               }
        }
 
        return -1;
@@ -431,9 +437,15 @@ static int idp_array_type_from_formatstr_and_size(const char *typestr, Py_ssize_
 
 static const char *idp_format_from_array_type(int type)
 {
-       if (type == IDP_INT) return "i";
-       if (type == IDP_FLOAT) return "f";
-       if (type == IDP_DOUBLE) return "d";
+       if (type == IDP_INT) {
+               return "i";
+       }
+       if (type == IDP_FLOAT) {
+               return "f";
+       }
+       if (type == IDP_DOUBLE) {
+               return "d";
+       }
        return NULL;
 }
 
@@ -936,8 +948,9 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
        IDProperty *loop;
        int i;
 
-       for (i = 0, loop = prop->data.group.first; loop && (i < prop->len); loop = loop->next, i++)
+       for (i = 0, loop = prop->data.group.first; loop && (i < prop->len); loop = loop->next, i++) {
                PyList_SET_ITEM(list, i, PyUnicode_FromString(loop->name));
+       }
 
        /* if the id prop is corrupt, count the remaining */
        for ( ; loop; loop = loop->next, i++) {
@@ -1067,7 +1080,9 @@ static PyObject *BPy_IDGroup_update(BPy_IDProperty *self, PyObject *value)
        else if (PyDict_Check(value)) {
                while (PyDict_Next(value, &i, &pkey, &pval)) {
                        BPy_IDGroup_Map_SetItem(self, pkey, pval);
-                       if (PyErr_Occurred()) return NULL;
+                       if (PyErr_Occurred()) {
+                               return NULL;
+                       }
                }
        }
        else {
@@ -1113,14 +1128,16 @@ static PyObject *BPy_IDGroup_get(BPy_IDProperty *self, PyObject *args)
        const char *key;
        PyObject *def = Py_None;
 
-       if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
+       if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) {
                return NULL;
+       }
 
        idprop = IDP_GetPropertyFromGroup(self->prop, key);
        if (idprop) {
                PyObject *pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
-               if (pyobj)
+               if (pyobj) {
                        return pyobj;
+               }
        }
 
        Py_INCREF(def);
@@ -1376,7 +1393,9 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
        int count;
 
        CLAMP(begin, 0, prop->len);
-       if (end < 0) end = prop->len + end + 1;
+       if (end < 0) {
+               end = prop->len + end + 1;
+       }
        CLAMP(end, 0, prop->len);
        begin = MIN2(begin, end);
 
@@ -1446,17 +1465,20 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += self->prop->len;
+               }
                return BPy_IDArray_GetItem(self, i);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -1481,20 +1503,24 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject
 {
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += self->prop->len;
+               }
                return BPy_IDArray_SetItem(self, i, value);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0) {
                        return -1;
+               }
 
-               if (step == 1)
+               if (step == 1) {
                        return BPy_IDArray_ass_slice(self, start, stop, value);
+               }
                else {
                        PyErr_SetString(PyExc_TypeError, "slice steps not supported with vectors");
                        return -1;
@@ -1516,9 +1542,9 @@ static PyMappingMethods BPy_IDArray_AsMapping = {
 
 static int itemsize_by_idarray_type(int array_type)
 {
-       if (array_type == IDP_INT) return sizeof(int);
-       if (array_type == IDP_FLOAT) return sizeof(float);
-       if (array_type == IDP_DOUBLE) return sizeof(double);
+       if (array_type == IDP_INT) { return sizeof(int); }
+       if (array_type == IDP_FLOAT) { return sizeof(float); }
+       if (array_type == IDP_DOUBLE) { return sizeof(double); }
        return -1;  /* should never happen */
 }
 
index f18e794..0c10737 100644 (file)
@@ -319,8 +319,12 @@ void PyC_FileAndNum(const char **filename, int *lineno)
 {
        PyFrameObject *frame;
 
-       if (filename) *filename = NULL;
-       if (lineno)   *lineno = -1;
+       if (filename) {
+               *filename = NULL;
+       }
+       if (lineno) {
+               *lineno = -1;
+       }
 
        if (!(frame = PyThreadState_GET()->frame)) {
                return;
@@ -384,10 +388,13 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
                attr = va_arg(vargs, char *);
                item = PyObject_GetAttrString(item, attr);
 
-               if (item)
+               if (item) {
                        Py_DECREF(item);
-               else /* python will set the error value here */
+               }
+               else {
+                       /* python will set the error value here */
                        break;
+               }
 
        }
        va_end(vargs);
@@ -527,8 +534,9 @@ PyObject *PyC_ExceptionBuffer(void)
 
        PyObject *error_type, *error_value, *error_traceback;
 
-       if (!PyErr_Occurred())
+       if (!PyErr_Occurred()) {
                return NULL;
+       }
 
        PyErr_Fetch(&error_type, &error_value, &error_traceback);
 
@@ -593,8 +601,9 @@ PyObject *PyC_ExceptionBuffer_Simple(void)
 
        PyObject *error_type, *error_value, *error_traceback;
 
-       if (!PyErr_Occurred())
+       if (!PyErr_Occurred()) {
                return NULL;
+       }
 
        PyErr_Fetch(&error_type, &error_value, &error_traceback);
 
@@ -775,9 +784,10 @@ void PyC_SetHomePath(const char *py_path_bundle)
 #ifdef __APPLE__
        /* OSX allow file/directory names to contain : character (represented as / in the Finder)
         * but current Python lib (release 3.1.1) doesn't handle these correctly */
-       if (strchr(py_path_bundle, ':'))
+       if (strchr(py_path_bundle, ':')) {
                printf("Warning : Blender application is located in a path containing : or / chars\
                       \nThis may make python import function fail\n");
+       }
 #endif
 
 
index 5482677..cd9e162 100644 (file)
@@ -299,8 +299,9 @@ static PyObject *bpygpu_offscreen_bind_context_exit(BPyGPUOffScreen *self, PyObj
 
 static void BPyGPUOffScreen__tp_dealloc(BPyGPUOffScreen *self)
 {
-       if (self->ofs)
+       if (self->ofs) {
                GPU_offscreen_free(self->ofs);
+       }
        Py_TYPE(self)->tp_free((PyObject *)self);
 }
 
index 7ed1832..67bdc07 100644 (file)
@@ -45,18 +45,24 @@ PyObject *BPyInit_gpu_types(void)
 
        submodule = PyModule_Create(&BPyGPU_types_module_def);
 
-       if (PyType_Ready(&BPyGPUVertFormat_Type) < 0)
+       if (PyType_Ready(&BPyGPUVertFormat_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&BPyGPUVertBuf_Type) < 0)
+       }
+       if (PyType_Ready(&BPyGPUVertBuf_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&BPyGPUIndexBuf_Type) < 0)
+       }
+       if (PyType_Ready(&BPyGPUIndexBuf_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&BPyGPUBatch_Type) < 0)
+       }
+       if (PyType_Ready(&BPyGPUBatch_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&BPyGPUOffScreen_Type) < 0)
+       }
+       if (PyType_Ready(&BPyGPUOffScreen_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&BPyGPUShader_Type) < 0)
+       }
+       if (PyType_Ready(&BPyGPUShader_Type) < 0) {
                return NULL;
+       }
 
 #define MODULE_TYPE_ADD(s, t) \
        PyModule_AddObject(s, t.tp_name, (PyObject *)&t); Py_INCREF((PyObject *)&t)
index 55d226e..f67ed1a 100644 (file)
@@ -126,9 +126,15 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
                return NULL;
        }
 
-       if (absolute) flag |= BKE_BPATH_TRAVERSE_ABS;
-       if (!packed)  flag |= BKE_BPATH_TRAVERSE_SKIP_PACKED;
-       if (local)    flag |= BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
+       if (absolute) {
+               flag |= BKE_BPATH_TRAVERSE_ABS;
+       }
+       if (!packed) {
+               flag |= BKE_BPATH_TRAVERSE_SKIP_PACKED;
+       }
+       if (local) {
+               flag |= BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
+       }
 
        list = PyList_New(0);
 
@@ -157,10 +163,10 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
        }
 
        /* stupid string compare */
-       if      (STREQ(type, "DATAFILES")) folder_id = BLENDER_USER_DATAFILES;
-       else if (STREQ(type, "CONFIG"))    folder_id = BLENDER_USER_CONFIG;
-       else if (STREQ(type, "SCRIPTS"))   folder_id = BLENDER_USER_SCRIPTS;
-       else if (STREQ(type, "AUTOSAVE"))  folder_id = BLENDER_USER_AUTOSAVE;
+       if      (STREQ(type, "DATAFILES")) { folder_id = BLENDER_USER_DATAFILES; }
+       else if (STREQ(type, "CONFIG"))    { folder_id = BLENDER_USER_CONFIG; }
+       else if (STREQ(type, "SCRIPTS"))   { folder_id = BLENDER_USER_SCRIPTS; }
+       else if (STREQ(type, "AUTOSAVE"))  { folder_id = BLENDER_USER_AUTOSAVE; }
        else {
                PyErr_SetString(PyExc_ValueError, "invalid resource argument");
                return NULL;
@@ -203,9 +209,9 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
        }
 
        /* stupid string compare */
-       if      (STREQ(type, "USER"))    folder_id = BLENDER_RESOURCE_PATH_USER;
-       else if (STREQ(type, "LOCAL"))   folder_id = BLENDER_RESOURCE_PATH_LOCAL;
-       else if (STREQ(type, "SYSTEM"))  folder_id = BLENDER_RESOURCE_PATH_SYSTEM;
+       if      (STREQ(type, "USER"))    { folder_id = BLENDER_RESOURCE_PATH_USER; }
+       else if (STREQ(type, "LOCAL"))   { folder_id = BLENDER_RESOURCE_PATH_LOCAL; }
+       else if (STREQ(type, "SYSTEM"))  { folder_id = BLENDER_RESOURCE_PATH_SYSTEM; }
        else {
                PyErr_SetString(PyExc_ValueError, "invalid resource argument");
                return NULL;
index 252fd1b..2cd3086 100644 (file)
@@ -253,8 +253,12 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *clos
                return -1;
        }
 
-       if (param)  G.debug |=  flag;
-       else        G.debug &= ~flag;
+       if (param) {
+               G.debug |=  flag;
+       }
+       else {
+               G.debug &= ~flag;
+       }
 
        return 0;
 }
@@ -278,8 +282,12 @@ static int bpy_app_global_flag_set(PyObject *UNUSED(self), PyObject *value, void
                return -1;
        }
 
-       if (param)  G.f |=  flag;
-       else        G.f &= ~flag;
+       if (param) {
+               G.f |=  flag;
+       }
+       else {
+               G.f &= ~flag;
+       }
 
        return 0;
 }
index b6b9f29..c91c0d6 100644 (file)
@@ -90,8 +90,9 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
 {
        PyObject *value;
 
-       if (!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value))
+       if (!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value)) {
                return NULL;
+       }
 
        if (PyFunction_Check(value)) {
                PyObject **dict_ptr = _PyObject_GetDictPtr(value);
index 1ed6820..f571cae 100644 (file)
@@ -89,8 +89,9 @@ static bool _ghashutil_keycmp(const void *a, const void *b)
        const GHashKey *B = b;
 
        /* Note: comparing msgid first, most of the time it will be enough! */
-       if (BLI_ghashutil_strcmp(A->msgid, B->msgid) == false)
+       if (BLI_ghashutil_strcmp(A->msgid, B->msgid) == false) {
                return BLI_ghashutil_strcmp(A->msgctxt, B->msgctxt);
+       }
        return true;  /* true means they are not equal! */
 }
 
@@ -249,8 +250,9 @@ const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *ms
        const char *tmp;
 
        /* Just in case, should never happen! */
-       if (!_translations)
+       if (!_translations) {
                return msgid;
+       }
 
        tmp = BLT_lang_get();
        if (!STREQ(tmp, locale) || !_translations_cache) {
@@ -458,8 +460,9 @@ static PyObject *app_translations_locales_get(PyObject *UNUSED(self), void *UNUS
        if (items) {
                /* This is not elegant, but simple! */
                for (it = items; it->identifier; it++) {
-                       if (it->value)
+                       if (it->value) {
                                num_locales++;
+                       }
                }
        }
 
@@ -467,8 +470,9 @@ static PyObject *app_translations_locales_get(PyObject *UNUSED(self), void *UNUS
 
        if (items) {
                for (it = items; it->identifier; it++) {
-                       if (it->value)
+                       if (it->value) {
                                PyTuple_SET_ITEM(ret, pos++, PyUnicode_FromString(it->description));
+                       }
                }
        }
 
@@ -801,8 +805,9 @@ PyObject *BPY_app_translations_struct(void)
                PyStructSequence_InitType(&BlenderAppTranslationsContextsType, &app_translations_contexts_desc);
        }
 
-       if (PyType_Ready(&BlenderAppTranslationsType) < 0)
+       if (PyType_Ready(&BlenderAppTranslationsType) < 0) {
                return NULL;
+       }
 
        ret = PyObject_CallObject((PyObject *)&BlenderAppTranslationsType, NULL);
 
index 3a5b307..549a06f 100644 (file)
@@ -48,8 +48,9 @@ char *BPy_enum_as_string(const EnumPropertyItem *item)
        char *cstring;
 
        for (e = item; item->identifier; item++) {
-               if (item->identifier[0])
+               if (item->identifier[0]) {
                        BLI_dynstr_appendf(dynstr, (e == item) ? "'%s'" : ", '%s'", item->identifier);
+               }
        }
 
        cstring = BLI_dynstr_get_cstring(dynstr);
@@ -93,8 +94,9 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo
 {
        PyObject *pystring;
 
-       if (!PyErr_Occurred())
+       if (!PyErr_Occurred()) {
                return 1;
+       }
 
        /* less hassle if we allow NULL */
        if (reports == NULL) {
index 93d9225..cb23739 100644 (file)
@@ -69,13 +69,17 @@ int bpy_pydriver_create_dict(void)
        PyObject *d, *mod;
 
        /* validate namespace for driver evaluation */
-       if (bpy_pydriver_Dict) return -1;
+       if (bpy_pydriver_Dict) {
+               return -1;
+       }
 
        d = PyDict_New();
-       if (d == NULL)
+       if (d == NULL) {
                return -1;
-       else
+       }
+       else {
                bpy_pydriver_Dict = d;
+       }
 
        /* import some modules: builtins, bpy, math, (Blender.noise)*/
        PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins());
@@ -205,8 +209,9 @@ void BPY_driver_reset(void)
        PyGILState_STATE gilstate;
        bool use_gil = true; /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
                PyDict_Clear(bpy_pydriver_Dict);
@@ -227,8 +232,9 @@ void BPY_driver_reset(void)
        /* freed when clearing driver dict */
        g_pydriver_state_prev.self = NULL;
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        return;
 }
@@ -399,8 +405,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
 
        /* get the py expression to be evaluated */
        expr = driver_orig->expression;
-       if (expr[0] == '\0')
+       if (expr[0] == '\0') {
                return 0.0f;
+       }
 
 #ifndef USE_BYTECODE_WHITELIST
        if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
@@ -418,8 +425,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        /* needed since drivers are updated directly after undo where 'main' is
         * re-allocated [#28807] */
@@ -429,8 +437,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
        if (!bpy_pydriver_Dict) {
                if (bpy_pydriver_create_dict() != 0) {
                        fprintf(stderr, "PyDriver error: couldn't create Python dictionary\n");
-                       if (use_gil)
+                       if (use_gil) {
                                PyGILState_Release(gilstate);
+                       }
                        return 0.0f;
                }
        }
@@ -445,8 +454,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
                bpy_pydriver_namespace_clear_self();
        }
 
-       if (driver_orig->expr_comp == NULL)
+       if (driver_orig->expr_comp == NULL) {
                driver_orig->flag |= DRIVER_FLAG_RECOMPILE;
+       }
 
        /* compile the expression first if it hasn't been compiled or needs to be rebuilt */
        if (driver_orig->flag & DRIVER_FLAG_RECOMPILE) {
@@ -571,8 +581,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
        retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
 #else
        /* evaluate the compiled expression */
-       if (expr_code)
+       if (expr_code) {
                retval = PyEval_EvalCode((void *)expr_code, bpy_pydriver_Dict, driver_vars);
+       }
 #endif
 
        /* decref the driver vars first...  */
@@ -593,8 +604,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
                Py_DECREF(retval);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (isfinite(result)) {
                return (float)result;
index 189fb97..e07e396 100644 (file)
@@ -98,8 +98,9 @@ void BPY_context_update(bContext *C)
        /* don't do this from a non-main (e.g. render) thread, it can cause a race
         * condition on C->data.recursion. ideal solution would be to disable
         * context entirely from non-main threads, but that's more complicated */
-       if (!BLI_thread_is_main())
+       if (!BLI_thread_is_main()) {
                return;
+       }
 
        BPy_SetContext(C);
        bpy_import_main_set(CTX_data_main(C));
@@ -110,8 +111,9 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
 {
        py_call_level++;
 
-       if (gilstate)
+       if (gilstate) {
                *gilstate = PyGILState_Ensure();
+       }
 
        if (py_call_level == 1) {
                BPY_context_update(C);
@@ -135,8 +137,9 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
 {
        py_call_level--;
 
-       if (gilstate)
+       if (gilstate) {
                PyGILState_Release(*gilstate);
+       }
 
        if (py_call_level < 0) {
                fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n");
@@ -163,14 +166,16 @@ void BPY_text_free_code(Text *text)
                PyGILState_STATE gilstate;
                bool use_gil = !PyC_IsInterpreterActive();
 
-               if (use_gil)
+               if (use_gil) {
                        gilstate = PyGILState_Ensure();
+               }
 
                Py_DECREF((PyObject *)text->compiled);
                text->compiled = NULL;
 
-               if (use_gil)
+               if (use_gil) {
                        PyGILState_Release(gilstate);
+               }
        }
 }
 
@@ -184,8 +189,9 @@ void BPY_modules_update(bContext *C)
 
        /* refreshes the main struct */
        BPY_update_rna_module();
-       if (bpy_context_module)
+       if (bpy_context_module) {
                bpy_context_module->ptr.data = (void *)C;
+       }
 }
 
 void BPY_context_set(bContext *C)
@@ -371,11 +377,13 @@ void BPY_python_end(void)
        printf("*bpy stats* - ");
        printf("tot exec: %d,  ", bpy_timer_count);
        printf("tot run: %.4fsec,  ", bpy_timer_run_tot);
-       if (bpy_timer_count > 0)
+       if (bpy_timer_count > 0) {
                printf("average run: %.6fsec,  ", (bpy_timer_run_tot / bpy_timer_count));
+       }
 
-       if (bpy_timer > 0.0)
+       if (bpy_timer > 0.0) {
                printf("tot usage %.4f%%", (bpy_timer_run_tot / bpy_timer) * 100.0);
+       }
 
        printf("\n");
 
@@ -750,8 +758,9 @@ void BPY_modules_load_user(bContext *C)
        Text *text;
 
        /* can happen on file load */
-       if (bmain == NULL)
+       if (bmain == NULL) {
                return;
+       }
 
        /* update pointers since this can run from a nested script
         * on file load */
@@ -802,8 +811,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
        PointerRNA *ptr = NULL;
        bool done = false;
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        pyctx = (PyObject *)CTX_py_dict_get(C);
        item = PyDict_GetItemString(pyctx, member);
@@ -870,8 +880,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
                CLOG_INFO(BPY_LOG_CONTEXT, 2, "'%s' found", member);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        return done;
 }
@@ -971,8 +982,9 @@ PyInit_bpy(void)
        dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc;
        dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT;
 
-       if (PyType_Ready(&dealloc_obj_Type) < 0)
+       if (PyType_Ready(&dealloc_obj_Type) < 0) {
                return NULL;
+       }
 
        dob = (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0);
        dob->mod = bpy_proxy; /* borrow */
index bf12db0..77fb6bf 100644 (file)
@@ -476,8 +476,9 @@ int BPY_library_load_module(PyObject *mod_par)
        /* some compilers don't like accessing this directly, delay assignment */
        bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr;
 
-       if (PyType_Ready(&bpy_lib_Type) < 0)
+       if (PyType_Ready(&bpy_lib_Type) < 0) {
                return -1;
+       }
 
        return 0;
 }
index 98b2f87..ff6bd38 100644 (file)
@@ -93,8 +93,9 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
                return NULL;
        }
 
-       if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
+       if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str)) {
                return NULL;
+       }
 
        ot = WM_operatortype_find(opname, true);
 
@@ -362,8 +363,9 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
                error_val = pyrna_pydict_to_props(&ptr, kw, false, "Converting py args to operator properties: ");
        }
 
-       if (error_val == 0)
+       if (error_val == 0) {
                buf = WM_operator_pystring_ex(C, NULL, all_args, macro_args, ot, &ptr);
+       }
 
        WM_operator_properties_free(&ptr);
 
index 6f1450f..6a130a7 100644 (file)
@@ -162,8 +162,9 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
        const char *opname;
        const char *macroname;
 
-       if (!PyArg_ParseTuple(args, "Os:_bpy.ops.macro_define", &macro, &opname))
+       if (!PyArg_ParseTuple(args, "Os:_bpy.ops.macro_define", &macro, &opname)) {
                return NULL;
+       }
 
        if (WM_operatortype_find(opname, true) == NULL) {
                PyErr_Format(PyExc_ValueError,
index 385b02f..18a39f3 100644 (file)
@@ -201,10 +201,12 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
        PyTuple_SET_ITEM(ret, 0, func);
        Py_INCREF(func);
 
-       if (kw == NULL)
+       if (kw == NULL) {
                kw = PyDict_New();
-       else
+       }
+       else {
                Py_INCREF(kw);
+       }
 
        PyTuple_SET_ITEM(ret, 1, kw);
 
@@ -282,8 +284,9 @@ static bool bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -313,8 +316,9 @@ static bool bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -342,8 +346,9 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -369,8 +374,9 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -395,8 +401,9 @@ static bool bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, stru
        py_candidate = pyrna_struct_as_instance(&candidate);
        py_func = py_data[BPY_DATA_CB_SLOT_POLL];
 
-       if (!is_write_ok)
+       if (!is_write_ok) {
                pyrna_write_set(true);
+       }
 
        args = PyTuple_New(2);
        PyTuple_SET_ITEM(args, 0, py_self);
@@ -416,8 +423,9 @@ static bool bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, stru
        }
 
        PyGILState_Release(gilstate);
-       if (!is_write_ok)
+       if (!is_write_ok) {
                pyrna_write_set(false);
+       }
 
        return result;
 }
@@ -442,8 +450,9 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -458,15 +467,17 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert
        if (ret == NULL) {
                PyC_Err_PrintWithFunc(py_func);
 
-               for (i = 0; i < len; ++i)
+               for (i = 0; i < len; ++i) {
                        values[i] = false;
+               }
        }
        else {
                if (PyC_AsArray(values, ret, len, &PyBool_Type, false, "BoolVectorProperty get") == -1) {
                        PyC_Err_PrintWithFunc(py_func);
 
-                       for (i = 0; i < len; ++i)
+                       for (i = 0; i < len; ++i) {
                                values[i] = false;
+                       }
 
                        /* PyC_AsArray decrements refcount internally on error */
                }
@@ -475,8 +486,9 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert
                }
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -504,8 +516,9 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -532,8 +545,9 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -560,8 +574,9 @@ static int bpy_prop_int_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop)
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -588,8 +603,9 @@ static int bpy_prop_int_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop)
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -617,8 +633,9 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -644,8 +661,9 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -672,8 +690,9 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -688,15 +707,17 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA
        if (ret == NULL) {
                PyC_Err_PrintWithFunc(py_func);
 
-               for (i = 0; i < len; ++i)
+               for (i = 0; i < len; ++i) {
                        values[i] = 0;
+               }
        }
        else {
                if (PyC_AsArray(values, ret, len, &PyLong_Type, false, "IntVectorProperty get") == -1) {
                        PyC_Err_PrintWithFunc(py_func);
 
-                       for (i = 0; i < len; ++i)
+                       for (i = 0; i < len; ++i) {
                                values[i] = 0;
+                       }
 
                        /* PyC_AsArray decrements refcount internally on error */
                }
@@ -705,8 +726,9 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA
                }
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -734,8 +756,9 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -762,8 +785,9 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -790,8 +814,9 @@ static float bpy_prop_float_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -818,8 +843,9 @@ static float bpy_prop_float_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -847,8 +873,9 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -874,8 +901,9 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -902,8 +930,9 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -918,15 +947,17 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR
        if (ret == NULL) {
                PyC_Err_PrintWithFunc(py_func);
 
-               for (i = 0; i < len; ++i)
+               for (i = 0; i < len; ++i) {
                        values[i] = 0.0f;
+               }
        }
        else {
                if (PyC_AsArray(values, ret, len, &PyFloat_Type, false, "FloatVectorProperty get") == -1) {
                        PyC_Err_PrintWithFunc(py_func);
 
-                       for (i = 0; i < len; ++i)
+                       for (i = 0; i < len; ++i) {
                                values[i] = 0.0f;
+                       }
 
                        /* PyC_AsArray decrements refcount internally on error */
                }
@@ -935,8 +966,9 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR
                }
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -964,8 +996,9 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -992,8 +1025,9 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -1019,8 +1053,9 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -1051,8 +1086,9 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -1079,8 +1115,9 @@ static int bpy_prop_string_length_cb(struct PointerRNA *ptr, struct PropertyRNA
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -1111,8 +1148,9 @@ static int bpy_prop_string_length_cb(struct PointerRNA *ptr, struct PropertyRNA
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -1141,8 +1179,9 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -1155,8 +1194,9 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p
                PyErr_SetString(PyExc_ValueError, "the return value must be a string");
                PyC_Err_PrintWithFunc(py_func);
        }
-       else
+       else {
                PyTuple_SET_ITEM(args, 1, py_value);
+       }
 
        ret = PyObject_CallObject(py_func, args);
 
@@ -1174,8 +1214,9 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -1202,8 +1243,9 @@ static int bpy_prop_enum_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_GET];
 
@@ -1230,8 +1272,9 @@ static int bpy_prop_enum_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -1259,8 +1302,9 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro
 
        use_gil = true;  /* !PyC_IsInterpreterActive(); */
 
-       if (use_gil)
+       if (use_gil) {
                gilstate = PyGILState_Ensure();
+       }
 
        py_func = py_data[BPY_DATA_CB_SLOT_SET];
 
@@ -1286,8 +1330,9 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro
                Py_DECREF(ret);
        }
 
-       if (use_gil)
+       if (use_gil) {
                PyGILState_Release(gilstate);
+       }
 
        if (!is_write_ok) {
                pyrna_write_set(false);
@@ -1423,8 +1468,9 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *
                                }
                        }
 
-                       if (tmp_icon)
+                       if (tmp_icon) {
                                tmp.icon = icon_id_from_name(tmp_icon);
+                       }
 
                        items[i] = tmp;
 
@@ -2139,8 +2185,9 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
                        return NULL;
                }
 
-               if (pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, false, "BoolVectorProperty(default=sequence)") == -1)
+               if (pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, false, "BoolVectorProperty(default=sequence)") == -1) {
                        return NULL;
+               }
 
                if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
                        return NULL;
@@ -2155,7 +2202,9 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
                // prop = RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name ? name : id, description);
                prop = RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
                RNA_def_property_array(prop, size);
-               if (pydef) RNA_def_property_boolean_array_default(prop, def);
+               if (pydef) {
+                       RNA_def_property_boolean_array_default(prop, def);
+               }
                RNA_def_property_ui_text(prop, name ? name : id, description);
 
                if (py_tags) {
@@ -2366,8 +2415,9 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
                        return NULL;
                }
 
-               if (pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, false, "IntVectorProperty(default=sequence)") == -1)
+               if (pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, false, "IntVectorProperty(default=sequence)") == -1) {
                        return NULL;
+               }
 
                if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
                        return NULL;
@@ -2381,7 +2431,9 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
 
                prop = RNA_def_property(srna, id, PROP_INT, subtype);
                RNA_def_property_array(prop, size);
-               if (pydef) RNA_def_property_int_array_default(prop, def);
+               if (pydef) {
+                       RNA_def_property_int_array_default(prop, def);
+               }
                RNA_def_property_range(prop, min, max);
                RNA_def_property_ui_text(prop, name ? name : id, description);
                RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
@@ -2618,8 +2670,9 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
                        return NULL;
                }
 
-               if (pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, false, "FloatVectorProperty(default=sequence)") == -1)
+               if (pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, false, "FloatVectorProperty(default=sequence)") == -1) {
                        return NULL;
+               }
 
                if (bpy_prop_callback_check(update_cb, "update", 2) == -1) {
                        return NULL;
@@ -2633,7 +2686,9 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
 
                prop = RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
                RNA_def_property_array(prop, size);
-               if (pydef) RNA_def_property_float_array_default(prop, def);
+               if (pydef) {
+                       RNA_def_property_float_array_default(prop, def);
+               }
                RNA_def_property_range(prop, min, max);
                RNA_def_property_ui_text(prop, name ? name : id, description);
                RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
@@ -2728,8 +2783,12 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
                }
 
                prop = RNA_def_property(srna, id, PROP_STRING, subtype);
-               if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1);  /* +1 since it includes null terminator */
-               if (def && def[0]) RNA_def_property_string_default(prop, def);
+               if (maxlen != 0) {
+                       RNA_def_property_string_maxlength(prop, maxlen + 1);  /* +1 since it includes null terminator */
+               }
+               if (def && def[0]) {
+                       RNA_def_property_string_default(prop, def);
+               }
                RNA_def_property_ui_text(prop, name ? name : id, description);
 
                if (py_tags) {
@@ -2890,8 +2949,12 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
                        }
                }
 
-               if (opts & PROP_ENUM_FLAG)  prop = RNA_def_enum_flag(srna, id, eitems, defvalue, name ? name : id, description);
-               else                        prop = RNA_def_enum(srna, id, eitems, defvalue, name ? name : id, description);
+               if (opts & PROP_ENUM_FLAG) {
+                       prop = RNA_def_enum_flag(srna, id, eitems, defvalue, name ? name : id, description);
+               }
+               else {
+                       prop = RNA_def_enum(srna, id, eitems, defvalue, name ? name : id, description);
+               }
 
                if (py_tags) {
                        RNA_def_property_tags(prop, prop_tags);
@@ -2994,8 +3057,9 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
                BPY_PROPDEF_CHECK(PointerProperty, property_flag_items);
 
                ptype = pointer_type_from_py(type, "PointerProperty(...)");
-               if (!ptype)
+               if (!ptype) {
                        return NULL;
+               }
                if (!RNA_struct_is_a(ptype, &RNA_PropertyGroup) && !RNA_struct_is_ID(ptype)) {
                        PyErr_Format(PyExc_TypeError,
                                     "PointerProperty(...) expected an RNA type derived from %.200s or %.200s",
@@ -3077,8 +3141,9 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
                BPY_PROPDEF_CHECK(CollectionProperty, property_flag_items);
 
                ptype = pointer_type_from_py(type, "CollectionProperty(...):");
-               if (!ptype)
+               if (!ptype) {
                        return NULL;
+               }
 
                if (!RNA_struct_is_a(ptype, &RNA_PropertyGroup)) {
                        PyErr_Format(
index 4e96479..f695464 100644 (file)
@@ -314,8 +314,12 @@ static bool rna_id_write_error(PointerRNA *ptr, PyObject *key)
                if (!ELEM(idcode, ID_WM, ID_SCR, ID_WS)) { /* may need more added here */
                        const char *idtype = BKE_idcode_to_name(idcode);
                        const char *pyname;
-                       if (key && PyUnicode_Check(key)) pyname = _PyUnicode_AsString(key);
-                       else                             pyname = "<UNKNOWN>";
+                       if (key && PyUnicode_Check(key)) {
+                               pyname = _PyUnicode_AsString(key);
+                       }
+                       else {
+                               pyname = "<UNKNOWN>";
+                       }
 
                        /* make a nice string error */
                        BLI_assert(idtype != NULL);
@@ -392,8 +396,9 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop == NULL)
+       if (self->prop == NULL) {
                return -1;
+       }
 
        RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
 
@@ -414,8 +419,9 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop == NULL)
+       if (self->prop == NULL) {
                return -1;
+       }
 
 #ifdef USE_PEDANTIC_WRITE
        if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
@@ -465,8 +471,9 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtyp
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop == NULL)
+       if (self->prop == NULL) {
                return -1;
+       }
 
        bmo->data[index] = RNA_property_float_get_index(&self->ptr, self->prop, index);
        return 0;
@@ -478,8 +485,9 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop == NULL)
+       if (self->prop == NULL) {
                return -1;
+       }
 
 #ifdef USE_PEDANTIC_WRITE
        if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
@@ -522,8 +530,9 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop == NULL)
+       if (self->prop == NULL) {
                return -1;
+       }
 
        RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
        return 0;
@@ -535,8 +544,9 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop == NULL)
+       if (self->prop == NULL) {
                return -1;
+       }
 
 #ifdef USE_PEDANTIC_WRITE
        if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
@@ -639,8 +649,10 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
        totdim = RNA_property_array_dimension(ptr, prop, NULL);
 
        if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) {
-               if (!is_thick)
-                       ret = pyrna_prop_CreatePyObject(ptr, prop);  /* owned by the mathutils PyObject */
+               if (!is_thick) {
+                       /* owned by the mathutils PyObject */
+                       ret = pyrna_prop_CreatePyObject(ptr, prop);
+               }
 
                switch (subtype) {
                        case PROP_ALL_VECTOR_SUBTYPES:
@@ -801,8 +813,9 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
        PyObject *res;
        int ok = -1; /* zero is true */
 
-       if (BPy_StructRNA_Check(a) && BPy_StructRNA_Check(b))
+       if (BPy_StructRNA_Check(a) && BPy_StructRNA_Check(b)) {
                ok = pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
+       }
 
        switch (op) {
                case Py_NE:
@@ -831,8 +844,9 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
        PyObject *res;
        int ok = -1; /* zero is true */
 
-       if (BPy_PropertyRNA_Check(a) && BPy_PropertyRNA_Check(b))
+       if (BPy_PropertyRNA_Check(a) && BPy_PropertyRNA_Check(b)) {
                ok = pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
+       }
 
        switch (op) {
                case Py_NE:
@@ -888,8 +902,10 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
        PyObject *tmp_str;
        PyObject *ret;
 
-       if (id == NULL || !PYRNA_STRUCT_IS_VALID(self))
-               return pyrna_struct_str(self);  /* fallback */
+       if (id == NULL || !PYRNA_STRUCT_IS_VALID(self)) {
+               /* fallback */
+               return pyrna_struct_str(self);
+       }
 
        tmp_str = PyUnicode_FromString(id->name + 2);
 
@@ -959,8 +975,9 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
                        len = pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
                }
 
-               if (len != -1)
+               if (len != -1) {
                        sprintf(--c, "[%d]", len);
+               }
        }
 
        /* if a pointer, try to print name of pointer target too */
@@ -1004,8 +1021,10 @@ static PyObject *pyrna_prop_repr_ex(
 
        PYRNA_PROP_CHECK_OBJ(self);
 
-       if (id == NULL)
-               return pyrna_prop_str(self);  /* fallback */
+       if (id == NULL) {
+               /* fallback */
+               return pyrna_prop_str(self);
+       }
 
        tmp_str = PyUnicode_FromString(id->name + 2);
 
@@ -1066,19 +1085,23 @@ static Py_hash_t pyrna_struct_hash(BPy_StructRNA *self)
 static long pyrna_prop_hash(BPy_PropertyRNA *self)
 {
        long x, y;
-       if (self->ptr.data == NULL)
+       if (self->ptr.data == NULL) {
                x = 0;
+       }
        else {
                x = _Py_HashPointer(self->ptr.data);
-               if (x == -1)
+               if (x == -1) {
                        return -1;
+               }
        }
        y = _Py_HashPointer((void *)(self->prop));
-       if (y == -1)
+       if (y == -1) {
                return -1;
+       }
        x ^= y;
-       if (x == -1)
+       if (x == -1) {
                x = -2;
+       }
        return x;
 }
 
@@ -1425,8 +1448,9 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
                                PyErr_Warn(PyExc_RuntimeWarning, error_str);
 #endif
 
-                               if (ptr_name)
+                               if (ptr_name) {
                                        MEM_freeN((void *)ptr_name);
+                               }
                        }
 
                        ret = PyUnicode_FromString("");
@@ -1582,7 +1606,9 @@ int pyrna_pydict_to_props(
 
                while (PyDict_Next(kw, &pos, &key, &value)) {
                        arg_name = _PyUnicode_AsString(key);
-                       if (RNA_struct_find_property(ptr, arg_name) == NULL) break;
+                       if (RNA_struct_find_property(ptr, arg_name) == NULL) {
+                               break;
+                       }
                        arg_name = NULL;
                }
 
@@ -1649,8 +1675,12 @@ static int pyrna_py_to_prop(
                                        return -1;
                                }
                                else {
-                                       if (data) *((bool *)data) = param;
-                                       else RNA_property_boolean_set(ptr, prop, param);
+                                       if (data) {
+                                               *((bool *)data) = param;
+                                       }
+                                       else {
+                                               RNA_property_boolean_set(ptr, prop, param);
+                                       }
                                }
                                break;
                        }
@@ -1755,8 +1785,12 @@ static int pyrna_py_to_prop(
                                                return -1;
                                        }
                                        else {
-                                               if (data) *((char **)data) = (char *)param;
-                                               else RNA_property_string_set_bytes(ptr, prop, param, PyBytes_Size(value));
+                                               if (data) {
+                                                       *((char **)data) = (char *)param;
+                                               }
+                                               else {
+                                                       RNA_property_string_set_bytes(ptr, prop, param, PyBytes_Size(value));
+                                               }
                                        }
                                }
                                else {
@@ -1796,8 +1830,12 @@ static int pyrna_py_to_prop(
                                        else {
                                                /* same as bytes */
                                                /* XXX, this is suspect but needed for function calls, need to see if theres a better way */
-                                               if (data) *((char **)data) = (char *)param;
-                                               else RNA_property_string_set(ptr, prop, param);
+                                               if (data) {
+                                                       *((char **)data) = (char *)param;
+                                               }
+                                               else {
+                                                       RNA_property_string_set(ptr, prop, param);
+                                               }
                                        }
 #ifdef USE_STRING_COERCE
                                        Py_XDECREF(value_coerce);
@@ -1823,8 +1861,12 @@ static int pyrna_py_to_prop(
                                        }
                                }
 
-                               if (data) *((int *)data) = val;
-                               else RNA_property_enum_set(ptr, prop, val);
+                               if (data) {
+                                       *((int *)data) = val;
+                               }
+                               else {
+                                       RNA_property_enum_set(ptr, prop, val);
+                               }
 
                                break;
                        }
@@ -1922,23 +1964,29 @@ static int pyrna_py_to_prop(
 
                                                if (flag_parameter & PARM_RNAPTR) {
                                                        if (flag & PROP_THICK_WRAP) {
-                                                               if (value == Py_None)
+                                                               if (value == Py_None) {
                                                                        memset(data, 0, sizeof(PointerRNA));
-                                                               else if (RNA_struct_is_a(param->ptr.type, ptr_type))
+                                                               }
+                                                               else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
                                                                        *((PointerRNA *)data) = param->ptr;
-                                                               else
+                                                               }
+                                                               else {
                                                                        raise_error = true;
+                                                               }
                                                        }
                                                        else {
                                                                /* for function calls, we sometimes want to pass the 'ptr' directly,
                                                                 * watch out that it remains valid!, possibly we could support this later if needed */
                                                                BLI_assert(value_new == NULL);
-                                                               if (value == Py_None)
+                                                               if (value == Py_None) {
                                                                        *((void **)data) = NULL;
-                                                               else if (RNA_struct_is_a(param->ptr.type, ptr_type))
+                                                               }
+                                                               else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
                                                                        *((PointerRNA **)data) = &param->ptr;
-                                                               else
+                                                               }
+                                                               else {
                                                                        raise_error = true;
+                                                               }
                                                        }
                                                }
                                                else if (value == Py_None) {
@@ -1953,10 +2001,12 @@ static int pyrna_py_to_prop(
                                        }
                                        else {
                                                /* data == NULL, assign to RNA */
-                                               if (value == Py_None || RNA_struct_is_a(param->ptr.type, ptr_type))
+                                               if (value == Py_None || RNA_struct_is_a(param->ptr.type, ptr_type)) {
                                                        RNA_property_pointer_set(ptr, prop, value == Py_None ? PointerRNA_NULL : param->ptr);
-                                               else
+                                               }
+                                               else {
                                                        raise_error = true;
+                                               }
                                        }
 
                                        if (raise_error) {
@@ -2027,8 +2077,9 @@ static int pyrna_py_to_prop(
                                                link->ptr = itemptr;
                                                BLI_addtail(lb, link);
                                        }
-                                       else
+                                       else {
                                                RNA_property_collection_add(ptr, prop, &itemptr);
+                                       }
 
                                        if (pyrna_pydict_to_props(
                                                &itemptr, item, true,
@@ -2152,10 +2203,12 @@ static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
 {
        PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self);
 
-       if (RNA_property_array_dimension(&self->ptr, self->prop, NULL) > 1)
+       if (RNA_property_array_dimension(&self->ptr, self->prop, NULL) > 1) {
                return RNA_property_multi_array_length(&self->ptr, self->prop, self->arraydim);
-       else
+       }
+       else {
                return RNA_property_array_length(&self->ptr, self->prop);
+       }
 }
 
 static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self)
@@ -2271,10 +2324,13 @@ static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int
 
        len = pyrna_prop_array_length(self);
 
-       if (keynum < 0) keynum += len;
+       if (keynum < 0) {
+               keynum += len;
+       }
 
-       if (keynum >= 0 && keynum < len)
+       if (keynum >= 0 && keynum < len) {
                return pyrna_prop_array_to_py_index(self, keynum);
+       }
 
        PyErr_Format(PyExc_IndexError,
                     "bpy_prop_array[index]: index %d out of range", keynum);
@@ -2287,8 +2343,9 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons
 
        PYRNA_PROP_CHECK_OBJ(self);
 
-       if (RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr))
+       if (RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr)) {
                return pyrna_struct_CreatePyObject(&newptr);
+       }
 
        PyErr_Format(PyExc_KeyError, "bpy_prop_collection[key]: key \"%.200s\" not found", keyname);
        return NULL;
@@ -2463,8 +2520,9 @@ static PyObject *pyrna_prop_array_subscript_slice(
        totdim = RNA_property_array_dimension(ptr, prop, NULL);
 
        if (totdim > 1) {
-               for (count = start; count < stop; count++)
+               for (count = start; count < stop; count++) {
                        PyTuple_SET_ITEM(tuple, count - start, pyrna_prop_array_to_py_index(self, count));
+               }
        }
        else {
                switch (RNA_property_type(prop)) {
@@ -2476,8 +2534,9 @@ static PyObject *pyrna_prop_array_subscript_slice(
                                else                            { values = values_stack; }
                                RNA_property_float_get_array(ptr, prop, values);
 
-                               for (count = start; count < stop; count++)
+                               for (count = start; count < stop; count++) {
                                        PyTuple_SET_ITEM(tuple, count - start, PyFloat_FromDouble(values[count]));
+                               }
 
                                if (values != values_stack) {
                                        PyMem_FREE(values);
@@ -2492,8 +2551,9 @@ static PyObject *pyrna_prop_array_subscript_slice(
                                else                            { values = values_stack; }
 
                                RNA_property_boolean_get_array(ptr, prop, values);
-                               for (count = start; count < stop; count++)
+                               for (count = start; count < stop; count++) {
                                        PyTuple_SET_ITEM(tuple, count - start, PyBool_FromLong(values[count]));
+                               }
 
                                if (values != values_stack) {
                                        PyMem_FREE(values);
@@ -2508,8 +2568,9 @@ static PyObject *pyrna_prop_array_subscript_slice(
                                else                            { values = values_stack; }
 
                                RNA_property_int_get_array(ptr, prop, values);
-                               for (count = start; count < stop; count++)
+                               for (count = start; count < stop; count++) {
                                        PyTuple_SET_ITEM(tuple, count - start, PyLong_FromLong(values[count]));
+                               }
 
                                if (values != values_stack) {
                                        PyMem_FREE(values);
@@ -2537,8 +2598,9 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
        }
        else if (PyIndex_Check(key)) {
                Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
+               }
 
                return pyrna_prop_collection_subscript_int(self, i);
        }
@@ -2560,14 +2622,22 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
                        Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
                        /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
-                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
-                       if (key_slice->stop  != Py_None && !_PyEval_SliceIndex(key_slice->stop,  &stop))  return NULL;
+                       if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
+                               return NULL;
+                       }
+                       if (key_slice->stop  != Py_None && !_PyEval_SliceIndex(key_slice->stop,  &stop)) {
+                               return NULL;
+                       }
 
                        if (start < 0 || stop < 0) {
                                /* only get the length for negative values */
                                Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
-                               if (start < 0) start += len;
-                               if (stop  < 0) stop  += len;
+                               if (start < 0) {
+                                       start += len;
+                               }
+                               if (stop  < 0) {
+                                       stop  += len;
+                               }
                        }
 
                        if (stop - start <= 0) {
@@ -2662,8 +2732,9 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
 #endif
        if (PyIndex_Check(key)) {
                Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
+               }
 
                return pyrna_prop_collection_ass_subscript_int(self, i, value);
        }
@@ -2726,8 +2797,9 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
 #endif
        if (PyIndex_Check(key)) {
                Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
+               }
                return pyrna_prop_array_subscript_int(self, i);
        }
        else if (PySlice_Check(key)) {
@@ -2751,8 +2823,9 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
                        int len = pyrna_prop_array_length(self);
                        Py_ssize_t start, stop, slicelength;
 
-                       if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0)
+                       if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0) {
                                return NULL;
+                       }
 
                        if (slicelength <= 0) {
                                return PyTuple_New(0);
@@ -2963,8 +3036,12 @@ static int prop_subscript_ass_array_slice(
                                totdim - arraydim, &dimsize[arraydim],
                                range);
 
-                       if (PyErr_Occurred()) ret = -1;
-                       else                  RNA_property_float_set_array(ptr, prop, values);
+                       if (PyErr_Occurred()) {
+                               ret = -1;
+                       }
+                       else {
+                               RNA_property_float_set_array(ptr, prop, values);
+                       }
                        break;
                }
                case PROP_INT:
@@ -2986,8 +3063,12 @@ static int prop_subscript_ass_array_slice(
                                totdim - arraydim, &dimsize[arraydim],
                                range);
 
-                       if (PyErr_Occurred()) ret = -1;
-                       else                  RNA_property_int_set_array(ptr, prop, values);
+                       if (PyErr_Occurred()) {
+                               ret = -1;
+                       }
+                       else {
+                               RNA_property_int_set_array(ptr, prop, values);
+                       }
                        break;
                }
                case PROP_BOOLEAN:
@@ -3006,8 +3087,12 @@ static int prop_subscript_ass_array_slice(
                                value_items, &values[arrayoffset + (start * span)],
                                totdim - arraydim, &dimsize[arraydim]);
 
-                       if (PyErr_Occurred()) ret = -1;
-                       else                  RNA_property_boolean_set_array(ptr, prop, values);
+                       if (PyErr_Occurred()) {
+                               ret = -1;
+                       }
+                       else {
+                               RNA_property_boolean_set_array(ptr, prop, values);
+                       }
                        break;
                }
                default:
@@ -3034,10 +3119,13 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k
 
        len = pyrna_prop_array_length(self);
 
-       if (keynum < 0) keynum += len;
+       if (keynum < 0) {
+               keynum += len;
+       }
 
-       if (keynum >= 0 && keynum < len)
+       if (keynum >= 0 && keynum < len) {
                return pyrna_py_to_prop_array_index(self, keynum, value);
+       }
 
        PyErr_SetString(PyExc_IndexError,
                        "bpy_prop_array[index] = value: index out of range");
@@ -3165,8 +3253,9 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
                        return -1;
                }
 
-               if (RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr))
+               if (RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr)) {
                        return 1;
+               }
 
                return 0;
        }
@@ -3191,8 +3280,9 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
 
        group = RNA_struct_idprops(&self->ptr, 0);
 
-       if (!group)
+       if (!group) {
                return 0;
+       }
 
        return IDP_GetPropertyFromGroup(group, name) ? 1 : 0;
 }
@@ -3335,8 +3425,9 @@ static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
 
        group = RNA_struct_idprops(&self->ptr, 0);
 
-       if (group == NULL)
+       if (group == NULL) {
                return PyList_New(0);
+       }
 
        return BPy_Wrap_GetKeys(group);
 }
@@ -3363,8 +3454,9 @@ static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
 
        group = RNA_struct_idprops(&self->ptr, 0);
 
-       if (group == NULL)
+       if (group == NULL) {
                return PyList_New(0);
+       }
 
        return BPy_Wrap_GetItems(self->ptr.id.data, group);
 }
@@ -3391,8 +3483,9 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
 
        group = RNA_struct_idprops(&self->ptr, 0);
 
-       if (group == NULL)
+       if (group == NULL) {
                return PyList_New(0);
+       }
 
        return BPy_Wrap_GetValues(self->ptr.id.data, group);
 }
@@ -3413,8 +3506,9 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s:is_property_set", &name))
+       if (!PyArg_ParseTuple(args, "s:is_property_set", &name)) {
                return NULL;
+       }
 
        if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) {
                PyErr_Format(PyExc_TypeError,
@@ -3438,8 +3532,9 @@ static PyObject *pyrna_struct_property_unset(BPy_StructRNA *self, PyObject *args
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s:property_unset", &name))
+       if (!PyArg_ParseTuple(args, "s:property_unset", &name)) {
                return NULL;
+       }
 
        if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) {
                PyErr_Format(PyExc_TypeError,
@@ -3468,8 +3563,9 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name))
+       if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name)) {
                return NULL;
+       }
 
        if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) {
                PyErr_Format(PyExc_TypeError,
@@ -3496,8 +3592,9 @@ static PyObject *pyrna_struct_is_property_readonly(BPy_StructRNA *self, PyObject
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s:is_property_readonly", &name))
+       if (!PyArg_ParseTuple(args, "s:is_property_readonly", &name)) {
                return NULL;
+       }
 
        if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) {
                PyErr_Format(PyExc_TypeError,
@@ -3592,8 +3689,9 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s|O!:path_resolve", &path, &PyBool_Type, &coerce))
+       if (!PyArg_ParseTuple(args, "s|O!:path_resolve", &path, &PyBool_Type, &coerce)) {
                return NULL;
+       }
 
        if (RNA_path_resolve_full(&self->ptr, path, &r_ptr, &r_prop, &index)) {
                if (r_prop) {
@@ -3650,8 +3748,9 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "|s:path_from_id", &name))
+       if (!PyArg_ParseTuple(args, "|s:path_from_id", &name)) {
                return NULL;
+       }
 
        if (name) {
                prop = RNA_struct_find_property(&self->ptr, name);
@@ -3990,8 +4089,9 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
         * */
        ret = PyList_New(0);
 
-       if (!BPy_StructRNA_CheckExact(self))
+       if (!BPy_StructRNA_CheckExact(self)) {
                pyrna_dir_members_py(ret, (PyObject *)self);
+       }
 
        pyrna_dir_members_rna(ret, &self->ptr);
 
@@ -4636,8 +4736,9 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
                        nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
                        if (nameptr) {
                                PyTuple_SET_ITEM(item, 0, PyUnicode_FromStringAndSize(nameptr, namelen));
-                               if (name != nameptr)
+                               if (name != nameptr) {
                                        MEM_freeN(nameptr);
+                               }
                        }
                        else {
                                /* a bit strange but better then returning an empty list */
@@ -4693,8 +4794,9 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
+       if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) {
                return NULL;
+       }
 
        /* mostly copied from BPy_IDGroup_Map_GetItem */
        if (RNA_struct_idprops_check(self->ptr.type) == 0) {
@@ -4737,8 +4839,9 @@ static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
+       if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) {
                return NULL;
+       }
 
        /* mostly copied from BPy_IDGroup_Map_GetItem */
        if (RNA_struct_idprops_check(self->ptr.type) == 0) {
@@ -4801,14 +4904,16 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
 
        PYRNA_PROP_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "O|O:get", &key_ob, &def))
+       if (!PyArg_ParseTuple(args, "O|O:get", &key_ob, &def)) {
                return NULL;
+       }
 
        if (PyUnicode_Check(key_ob)) {
                const char *key = _PyUnicode_AsString(key_ob);
 
-               if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr))
+               if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) {
                        return pyrna_struct_CreatePyObject(&newptr);
+               }
        }
        else if (PyTuple_Check(key_ob)) {
                PyObject *ret = pyrna_prop_collection_subscript_str_lib_pair(self, key_ob,
@@ -4942,13 +5047,16 @@ static int foreach_parse_args(
                *size = RNA_raw_type_sizeof(*raw_type);
 
 #if 0   /* works fine but not strictly needed, we could allow RNA_property_collection_raw_* to do the checks */
-               if ((*attr_tot) < 1)
+               if ((*attr_tot) < 1) {
                        *attr_tot = 1;
+               }
 
-               if (RNA_property_type(self->prop) == PROP_COLLECTION)
+               if (RNA_property_type(self->prop) == PROP_COLLECTION) {
                        array_tot = RNA_property_collection_length(&self->ptr, self->prop);
-               else
+               }
+               else {
                        array_tot = RNA_property_array_length(&self->ptr, self->prop);
+               }
 
 
                target_tot = array_tot * (*attr_tot);
@@ -4978,14 +5086,26 @@ static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, con
 
        switch (raw_type) {
                case PROP_RAW_CHAR:
-                       if (attr_signed) return (f == 'b') ? 1 : 0;
-                       else             return (f == 'B') ? 1 : 0;
+                       if (attr_signed) {
+                               return (f == 'b') ? 1 : 0;
+                       }
+                       else {
+                               return (f == 'B') ? 1 : 0;
+                       }
                case PROP_RAW_SHORT:
-                       if (attr_signed) return (f == 'h') ? 1 : 0;
-                       else             return (f == 'H') ? 1 : 0;
+                       if (attr_signed) {
+                               return (f == 'h') ? 1 : 0;
+                       }
+                       else {
+                               return (f == 'H') ? 1 : 0;
+                       }
                case PROP_RAW_INT:
-                       if (attr_signed) return (f == 'i') ? 1 : 0;
-                       else             return (f == 'I') ? 1 : 0;
+                       if (attr_signed) {
+                               return (f == 'i') ? 1 : 0;
+                       }
+                       else {
+                               return (f == 'I') ? 1 : 0;
+                       }
                case PROP_RAW_BOOLEAN:
                        return (f == '?') ? 1 : 0;
                case PROP_RAW_FLOAT:
@@ -5013,11 +5133,13 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
        bool attr_signed;
        RawPropertyType raw_type;
 
-       if (foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) == -1)
+       if (foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) == -1) {
                return NULL;
+       }
 
-       if (tot == 0)
+       if (tot == 0) {
                Py_RETURN_NONE;
+       }
 
 
 
@@ -5098,7 +5220,10 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
 
                        ok = RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
 
-                       if (!ok) i = tot;  /* skip the loop */
+                       if (!ok) {
+                               /* skip the loop */
+                               i = tot;
+                       }
 
                        for ( ; i < tot; i++) {
 
@@ -5135,8 +5260,9 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
                }
        }
 
-       if (array)
+       if (array) {
                PyMem_Free(array);
+       }
 
        if (PyErr_Occurred()) {
                /* Maybe we could make our own error */
@@ -5348,8 +5474,9 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
 {
        BPy_PropertyRNA *base;
 
-       if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base))
+       if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base)) {
                return NULL;
+       }
 
        if (type == Py_TYPE(base)) {
                return Py_INCREF_RET((PyObject *)base);
@@ -5383,8 +5510,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
                        len = data_alloc->array_tot;
                        data = data_alloc->array;
                }
-               else
+               else {
                        len = RNA_property_array_length(ptr, prop);
+               }
 
                /* resolve the array from a new pytype */
 
@@ -5393,13 +5521,15 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
                switch (type) {
                        case PROP_BOOLEAN:
                                ret = PyTuple_New(len);
-                               for (a = 0; a < len; a++)
+                               for (a = 0; a < len; a++) {
                                        PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((bool *)data)[a]));
+                               }
                                break;
                        case PROP_INT:
                                ret = PyTuple_New(len);
-                               for (a = 0; a < len; a++)
+                               for (a = 0; a < len; a++) {
                                        PyTuple_SET_ITEM(ret, a, PyLong_FromLong(((int *)data)[a]));
+                               }
                                break;
                        case PROP_FLOAT:
                                switch (RNA_property_subtype(prop)) {
@@ -5420,8 +5550,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
 #endif
                                        default:
                                                ret = PyTuple_New(len);
-                                               for (a = 0; a < len; a++)
+                                               for (a = 0; a < len; a++) {
                                                        PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float *)data)[a]));
+                                               }
                                                break;
                                }
                                break;
@@ -5451,10 +5582,12 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
                                PyObject *value_coerce = NULL;
                                const int subtype = RNA_property_subtype(prop);
 
-                               if (flag & PROP_THICK_WRAP)
+                               if (flag & PROP_THICK_WRAP) {
                                        data_ch = (char *)data;
-                               else
+                               }
+                               else {
                                        data_ch = *(char **)data;
+                               }
 
 #ifdef USE_STRING_COERCE
                                if (subtype == PROP_BYTESTRING) {
@@ -5674,8 +5807,9 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 #else
                        item = small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */
 #endif
-                       if (item)
+                       if (item) {
                                kw_tot++;  /* make sure invalid keywords are not given */
+                       }
 
                        kw_arg = true;
                }
@@ -5712,19 +5846,21 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
                        char error_prefix[512];
                        PyErr_Clear(); /* re-raise */
 
-                       if (kw_arg == true)
+                       if (kw_arg == true) {
                                BLI_snprintf(error_prefix, sizeof(error_prefix),
                                             "%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
                                             RNA_struct_identifier(self_ptr->type),
                                             RNA_function_identifier(self_func),
                                             RNA_property_identifier(parm));
-                       else
+                       }
+                       else {
                                BLI_snprintf(error_prefix, sizeof(error_prefix),
                                             "%.200s.%.200s(): error with argument %d, \"%.200s\" - ",
                                             RNA_struct_identifier(self_ptr->type),
                                             RNA_function_identifier(self_func),
                                             i,
                                             RNA_property_identifier(parm));
+                       }
 
                        pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix);
 
@@ -5783,8 +5919,9 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
                RNA_parameter_list_begin(&parms, &iter);
                for (; iter.valid; RNA_parameter_list_next(&iter)) {
                        parm = iter.parm;
-                       if (RNA_parameter_flag(parm) & PARM_OUTPUT)
+                       if (RNA_parameter_flag(parm) & PARM_OUTPUT) {
                                continue;
+                       }
 
                        BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm));
                        first = false;
@@ -5831,18 +5968,21 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
                                        for (; iter.valid; RNA_parameter_list_next(&iter)) {
                                                parm = iter.parm;
 
-                                               if (RNA_parameter_flag(parm) & PARM_OUTPUT)
+                                               if (RNA_parameter_flag(parm) & PARM_OUTPUT) {
                                                        PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data));
+                                               }
                                        }
 
                                        RNA_parameter_list_end(&iter);
                                }
-                               else
+                               else {
                                        ret = pyrna_param_to_py(&funcptr, pret_single, retdata_single);
+                               }
 
                                /* possible there is an error in conversion */
-                               if (ret == NULL)
+                               if (ret == NULL) {
                                        err = -1;
+                               }
                        }
                }
        }
@@ -5865,11 +6005,13 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
        RNA_parameter_list_end(&iter);
        RNA_parameter_list_free(&parms);
 
-       if (ret)
+       if (ret) {
                return ret;
+       }
 
-       if (err == -1)
+       if (err == -1) {
                return NULL;
+       }
 
        Py_RETURN_NONE;
 }
@@ -6660,8 +6802,9 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
 
        Py_INCREF(newclass);
 
-       if (RNA_struct_py_type_get(srna))
+       if (RNA_struct_py_type_get(srna)) {
                PyC_ObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna));
+       }
 
        Py_XDECREF(((PyObject *)RNA_struct_py_type_get(srna)));
 
@@ -7074,30 +7217,38 @@ void BPY_rna_init(void)
 #endif
 
        /* metaclass */
-       if (PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0)
+       if (PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0) {
                return;
+       }
 
-       if (PyType_Ready(&pyrna_struct_Type) < 0)
+       if (PyType_Ready(&pyrna_struct_Type) < 0) {
                return;
+       }
 
-       if (PyType_Ready(&pyrna_prop_Type) < 0)
+       if (PyType_Ready(&pyrna_prop_Type) < 0) {
                return;
+       }
 
-       if (PyType_Ready(&pyrna_prop_array_Type) < 0)
+       if (PyType_Ready(&pyrna_prop_array_Type) < 0) {
                return;
+       }
 
-       if (PyType_Ready(&pyrna_prop_collection_Type) < 0)
+       if (PyType_Ready(&pyrna_prop_collection_Type) < 0) {
                return;
+       }
 
-       if (PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0)
+       if (PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0) {
                return;
+       }
 
-       if (PyType_Ready(&pyrna_func_Type) < 0)
+       if (PyType_Ready(&pyrna_func_Type) < 0) {
                return;
+       }
 
 #ifdef USE_PYRNA_ITER
-       if (PyType_Ready(&pyrna_prop_collection_iter_Type) < 0)
+       if (PyType_Ready(&pyrna_prop_collection_iter_Type) < 0) {
                return;
+       }
 #endif
 }
 
@@ -7239,8 +7390,9 @@ PyObject *BPY_rna_types(void)
                pyrna_basetype_Type.tp_flags = Py_TPFLAGS_DEFAULT;
                pyrna_basetype_Type.tp_methods = pyrna_basetype_methods;
 
-               if (PyType_Ready(&pyrna_basetype_Type) < 0)
+               if (PyType_Ready(&pyrna_basetype_Type) < 0) {
                        return NULL;
+               }
        }
 
        /* static members for the base class */
@@ -7288,8 +7440,9 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *e
        if (parent) {
                /* be very careful with this since it will return a parent classes srna.
                 * modifying this will do confusing stuff! */
-               if (py_srna == NULL)
+               if (py_srna == NULL) {
                        py_srna = (BPy_StructRNA *)PyObject_GetAttr(self, bpy_intern_str_bl_rna);
+               }
        }
 
        if (py_srna == NULL) {
@@ -7473,8 +7626,9 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
                        }
                        ret = deferred_register_prop(srna, key, item);
 
-                       if (ret != 0)
+                       if (ret != 0) {
                                break;
+                       }
                }
        }
 
@@ -7518,8 +7672,9 @@ int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class)
 {
        /* Panels and Menus don't need this
         * save some time and skip the checks here */
-       if (!RNA_struct_idprops_register_check(srna))
+       if (!RNA_struct_idprops_register_check(srna)) {
                return 0;
+       }
 
        return pyrna_deferred_register_class_recursive(srna, py_class);
 }
@@ -7541,16 +7696,18 @@ static int rna_function_arg_count(FunctionRNA *func, int *min_count)
                if (!(RNA_parameter_flag(parm) & PARM_OUTPUT)) {
                        if (!done_min_count && (RNA_parameter_flag(parm) & PARM_PYFUNC_OPTIONAL)) {
                                /* From now on, following parameters are optional in py func */
-                               if (min_count)
+                               if (min_count) {
                                        *min_count = count;
+                               }
                                done_min_count = true;
                        }
                        count++;
                }
        }
 
-       if (!done_min_count && min_count)
+       if (!done_min_count && min_count) {
                *min_count = count;
+       }
        return count;
 }
 
@@ -7567,8 +7724,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
        const char *py_class_name = ((PyTypeObject *)py_class)->tp_name;  /* __name__ */
 
        if (srna_base) {
-               if (bpy_class_validate_recursive(dummyptr, srna_base, py_data, have_function) != 0)
+               if (bpy_class_validate_recursive(dummyptr, srna_base, py_data, have_function) != 0) {
                        return -1;
+               }
        }
 
        if (base_class) {
@@ -7591,8 +7749,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
                 * Keep this as-is since its working but we should be using 'FUNC_USE_SELF_TYPE' for many functions. */
                const bool is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE);
 
-               if (!(flag & FUNC_REGISTER))
+               if (!(flag & FUNC_REGISTER)) {
                        continue;
+               }
 
                item = PyObject_GetAttrString(py_class, RNA_function_identifier(func));
 
@@ -7672,8 +7831,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
                PropertyRNA *prop = (PropertyRNA *)link;
                const int flag = RNA_property_flag(prop);
 
-               if (!(flag & PROP_REGISTER))
+               if (!(flag & PROP_REGISTER)) {
                        continue;
+               }
 
                /* TODO(campbell): Use Python3.7x _PyObject_LookupAttr(), also in the macro below. */
                identifier = RNA_property_identifier(prop);
@@ -7769,8 +7929,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 
        /* XXX, this is needed because render engine calls without a context
         * this should be supported at some point but at the moment its not! */
-       if (C == NULL)
+       if (C == NULL) {
                C = BPy_GetContext();
+       }
 
        /* annoying!, need to check if the screen gets set to NULL which is a
         * hint that the file was actually re-loaded. */
@@ -7792,8 +7953,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
                }
                /* end exception */
 
-               if (py_class_instance == NULL)
+               if (py_class_instance == NULL) {
                        py_srna = pyrna_struct_CreatePyObject(ptr);
+               }
 
                if (py_class_instance) {
                        /* special case, instance is cached */
@@ -8055,8 +8217,9 @@ static void bpy_class_free(void *pyob_ptr)
 
        /* remove the rna attribute instead. */
        PyDict_DelItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
-       if (PyErr_Occurred())
+       if (PyErr_Occurred()) {
                PyErr_Clear();
+       }
 
 #if 0 /* needs further investigation, too annoying so quiet for now */
        if (G.debug & G_DEBUG_PYTHON) {
@@ -8197,8 +8360,9 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
 
        /* warning: gets parent classes srna, only for the register function */
        srna = pyrna_struct_as_srna(py_class, true, "register_class(...):");
-       if (srna == NULL)
+       if (srna == NULL) {
                return NULL;
+       }
 
        /* fails in cases, cant use this check but would like to :| */
 #if 0
@@ -8245,8 +8409,9 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
 
        /* python errors validating are not converted into reports so the check above will fail.
         * the cause for returning NULL will be printed as an error */
-       if (srna_new == NULL)
+       if (srna_new == NULL) {
                return NULL;
+       }
 
        pyrna_subtype_set_rna(py_class, srna_new); /* takes a ref to py_class */
 
@@ -8260,8 +8425,9 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
         *
         * item = PyObject_GetAttrString(py_class, "__dict__");
         */
-       if (pyrna_deferred_register_class(srna_new, (PyTypeObject *)py_class) != 0)
+       if (pyrna_deferred_register_class(srna_new, (PyTypeObject *)py_class) != 0) {
                return NULL;
+       }
 
        /* call classed register method () */
        switch (_PyObject_LookupAttr(py_class, bpy_intern_str_register, &py_cls_meth)) {
@@ -8354,8 +8520,9 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
        }
 
        srna = pyrna_struct_as_srna(py_class, false, "unregister_class(...):");
-       if (srna == NULL)
+       if (srna == NULL) {
                return NULL;
+       }
 
        /* check that we have a unregister callback for this type */
        unreg = RNA_struct_unregister(srna);
@@ -8423,8 +8590,9 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
        unreg(CTX_data_main(C), srna); /* calls bpy_class_free, this decref's py_class */
 
        PyDict_DelItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna);
-       if (PyErr_Occurred())
+       if (PyErr_Occurred()) {
                PyErr_Clear();  //return NULL;
+       }
 
        Py_RETURN_NONE;
 }
index faead66..a25906a 100644 (file)
@@ -339,8 +339,9 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
                }
                MEM_freeN((void *)path_full);
 
-               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
+               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
                        return NULL;
+               }
 
                return PyBool_FromLong(result);
        }
@@ -356,8 +357,9 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
                result = insert_keyframe(G_MAIN, depsgraph, &reports, id, NULL, group_name, path_full, index, cfra, keytype, NULL, options);
                MEM_freeN((void *)path_full);
 
-               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
+               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
                        return NULL;
+               }
 
                return PyBool_FromLong(result);
        }
@@ -452,8 +454,9 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
                }
                MEM_freeN((void *)path_full);
 
-               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
+               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
                        return NULL;
+               }
 
                return PyBool_FromLong(result);
        }
@@ -466,8 +469,9 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
                result = delete_keyframe(G.main, &reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
                MEM_freeN((void *)path_full);
 
-               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
+               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
                        return NULL;
+               }
 
                return PyBool_FromLong(result);
        }
@@ -493,8 +497,9 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
 
        PYRNA_STRUCT_CHECK_OBJ(self);
 
-       if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index))
+       if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index)) {
                return NULL;
+       }
 
        if (pyrna_struct_anim_args_parse(
                    &self->ptr, "bpy_struct.driver_add():", path,
@@ -512,8 +517,9 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
                result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index,
                                         CREATEDRIVER_WITH_FMODIFIER, DRIVER_TYPE_PYTHON);
 
-               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
+               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
                        return NULL;
+               }
 
                if (result) {
                        ID *id = self->ptr.id.data;
@@ -592,8 +598,9 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
                        MEM_freeN((void *)path_full);
                }
 
-               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
+               if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
                        return NULL;
+               }
 
                WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
 
index a87da87..4cc3c4c 100644 (file)
@@ -276,8 +276,9 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
                         *
                         *    arr[2][3][4] = x
                         *    lvalue_dim = 2 */
-                       for (i = lvalue_dim; i < totdim; i++)
+                       for (i = lvalue_dim; i < totdim; i++) {
                                len *= dimsize[i];
+                       }
                }
 
                if (tot != len) {
@@ -308,8 +309,9 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop,
                if (MatrixObject_Check(rvalue)) {
                        MatrixObject *pymat = (MatrixObject *)rvalue;
 
-                       if (BaseMath_ReadCallback(pymat) == -1)
+                       if (BaseMath_ReadCallback(pymat) == -1) {
                                return -1;
+                       }
 
                        if (RNA_property_type(prop) != PROP_FLOAT) {
                                PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign to non float array",
@@ -512,8 +514,9 @@ static int py_to_array_index(
 
        lvalue_dim++;
 
-       for (i = lvalue_dim; i < totdim; i++)
+       for (i = lvalue_dim; i < totdim; i++) {
                index *= dimsize[i];
+       }
 
        index += arrayoffset;
 
@@ -751,8 +754,9 @@ static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop
        for (i = 0; i < len; i++) {
                PyObject *item;
 
-               if (dim + 1 < totdim)
+               if (dim + 1 < totdim) {
                        item = pyrna_py_from_array_internal(ptr, prop, dim + 1, index);
+               }
                else {
                        item = pyrna_array_index(ptr, prop, *index);
                        *index = *index + 1;
@@ -802,8 +806,9 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
                 *    x = arr[2][3]
                 *    index = offset + 3 * 5 */
 
-               for (i = arraydim + 1; i < totdim; i++)
+               for (i = arraydim + 1; i < totdim; i++) {
                        index *= dimsize[i];
+               }
 
                ret->arrayoffset = arrayoffset + index;
        }
@@ -822,7 +827,9 @@ PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop)
        ret = pyrna_math_object_from_array(ptr, prop);
 
        /* is this a maths object? */
-       if (ret) return ret;
+       if (ret) {
+               return ret;
+       }
 
        return pyrna_prop_CreatePyObject(ptr, prop);
 }
@@ -834,8 +841,10 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
        int type;
        int i;
 
-       if (len == 0) /* possible with dynamic arrays */
+       if (len == 0) {
+               /* possible with dynamic arrays */
                return 0;
+       }
 
        if (RNA_property_array_dimension(ptr, prop, NULL) > 1) {
                PyErr_SetString(PyExc_TypeError, "PropertyRNA - multi dimensional arrays not supported yet");
@@ -871,8 +880,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                                        }
                                }
 
-                               if (tmp_arr != tmp)
+                               if (tmp_arr != tmp) {
                                        PyMem_FREE(tmp_arr);
+                               }
 
                                return i < len ? 1 : 0;
                        }
@@ -904,8 +914,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                                        }
                                }
 
-                               if (tmp_arr != tmp)
+                               if (tmp_arr != tmp) {
                                        PyMem_FREE(tmp_arr);
+                               }
 
                                return i < len ? 1 : 0;
                        }
@@ -937,8 +948,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                                        }
                                }
 
-                               if (tmp_arr != tmp)
+                               if (tmp_arr != tmp) {
                                        PyMem_FREE(tmp_arr);
+                               }
 
                                return i < len ? 1 : 0;
                        }
index 025ea58..30ea657 100644 (file)
@@ -136,8 +136,9 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
        char *cb_event_str = NULL;
        int cb_event;
 
-       if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str))
+       if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str)) {
                return NULL;
+       }
 
        if (!PyCallable_Check(cb_func)) {
                PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable");
@@ -174,8 +175,9 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
        void *handle;
        void *customdata;
 
-       if (!PyArg_ParseTuple(args, "O!:callback_remove", &PyCapsule_Type, &py_handle))
+       if (!PyArg_ParseTuple(args, "O!:callback_remove", &PyCapsule_Type, &py_handle)) {
                return NULL;
+       }
 
        handle = PyCapsule_GetPointer(py_handle, rna_capsual_id);
 
@@ -205,21 +207,21 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
 /* reverse of rna_Space_refine() */
 static eSpace_Type rna_Space_refine_reverse(StructRNA *srna)
 {
-       if (srna == &RNA_SpaceView3D)           return SPACE_VIEW3D;
-       if (srna == &RNA_SpaceGraphEditor)      return SPACE_GRAPH;
-       if (srna == &RNA_SpaceOutliner)         return SPACE_OUTLINER;
-       if (srna == &RNA_SpaceProperties)       return SPACE_PROPERTIES;
-       if (srna == &RNA_SpaceFileBrowser)      return SPACE_FILE;
-       if (srna == &RNA_SpaceImageEditor)      return SPACE_IMAGE;
-       if (srna == &RNA_SpaceInfo)             return SPACE_INFO;
-       if (srna == &RNA_SpaceSequenceEditor)   return SPACE_SEQ;
-       if (srna == &RNA_SpaceTextEditor)       return SPACE_TEXT;
-       if (srna == &RNA_SpaceDopeSheetEditor)  return SPACE_ACTION;
-       if (srna == &RNA_SpaceNLA)              return SPACE_NLA;
-       if (srna == &RNA_SpaceNodeEditor)       return SPACE_NODE;
-       if (srna == &RNA_SpaceConsole)          return SPACE_CONSOLE;
-       if (srna == &RNA_SpacePreferences)      return SPACE_USERPREF;
-       if (srna == &RNA_SpaceClipEditor)       return SPACE_CLIP;
+       if (srna == &RNA_SpaceView3D)           { return SPACE_VIEW3D; }
+       if (srna == &RNA_SpaceGraphEditor)      { return SPACE_GRAPH; }
+       if (srna == &RNA_SpaceOutliner)         { return SPACE_OUTLINER; }
+       if (srna == &RNA_SpaceProperties)       { return SPACE_PROPERTIES; }
+       if (srna == &RNA_SpaceFileBrowser)      { return SPACE_FILE; }
+       if (srna == &RNA_SpaceImageEditor)      { return SPACE_IMAGE; }
+       if (srna == &RNA_SpaceInfo)             { return SPACE_INFO; }
+       if (srna == &RNA_SpaceSequenceEditor)   { return SPACE_SEQ; }
+       if (srna == &RNA_SpaceTextEditor)       { return SPACE_TEXT; }
+       if (srna == &RNA_SpaceDopeSheetEditor)  { return SPACE_ACTION; }
+       if (srna == &RNA_SpaceNLA)              { return SPACE_NLA; }
+       if (srna == &RNA_SpaceNodeEditor)       { return SPACE_NODE; }
+       if (srna == &RNA_SpaceConsole)          { return SPACE_CONSOLE; }
+       if (srna == &RNA_SpacePreferences)      { return SPACE_USERPREF; }
+       if (srna == &RNA_SpaceClipEditor)       { return SPACE_CLIP; }
        return SPACE_EMPTY;
 }
 
index dd4d96c..77cd8d8 100644 (file)
@@ -58,17 +58,20 @@ parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename,
 
        /* new style errors.  `err' is an instance */
        *message = _PyObject_GetAttrId(err, &PyId_msg);
-       if (!*message)
+       if (!*message) {
                goto finally;
+       }
 
        v = _PyObject_GetAttrId(err, &PyId_filename);
-       if (!v)
+       if (!v) {
                goto finally;
+       }
        if (v == Py_None) {
                Py_DECREF(v);
                *filename = _PyUnicode_FromId(&PyId_string);
-               if (*filename == NULL)
+               if (*filename == NULL) {
                        goto finally;
+               }
                Py_INCREF(*filename);
        }
        else {
@@ -76,31 +79,36 @@ parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename,
        }
 
        v = _PyObject_GetAttrId(err, &PyId_lineno);
-       if (!v)
+       if (!v) {
                goto finally;
+       }
        hold = PyLong_AsLong(v);
        Py_DECREF(v);
-       if (hold < 0 && PyErr_Occurred())
+       if (hold < 0 && PyErr_Occurred()) {
                goto finally;
+       }
        *lineno = (int)hold;
 
        v = _PyObject_GetAttrId(err, &PyId_offset);
-       if (!v)
+       if (!v) {
                goto finally;
+       }
        if (v == Py_None) {
                *offset = -1;
                Py_DECREF(v);
        } else {
                hold = PyLong_AsLong(v);
                Py_DECREF(v);
-               if (hold < 0 && PyErr_Occurred())
+               if (hold < 0 && PyErr_Occurred()) {
                        goto finally;
+               }
                *offset = (int)hold;
        }
 
        v = _PyObject_GetAttrId(err, &PyId_text);
-       if (!v)
+       if (!v) {
                goto finally;
+       }
        if (v == Py_None) {
                Py_DECREF(v);
                *text = NULL;
index f577ef3..41738ce 100644 (file)
@@ -105,15 +105,17 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len)
        i = 0;
        while (--len >= 0) {
                y = _Py_HashDouble((double)(array[i++]));
-               if (y == -1)
+               if (y == -1) {
                        return -1;
+               }
                x = (x ^ y) * mult;
                /* the cast might truncate len; that doesn't change hash stability */
                mult += (Py_hash_t)(82520UL + len + len);
        }
        x += 97531UL;
-       if (x == (Py_uhash_t)-1)
+       if (x == (Py_uhash_t)-1) {
                x = -2;
+       }
        return x;
 }
 
@@ -392,8 +394,9 @@ int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int flo
 {
        int x;
        for (x = 0; x < size; x++) {
-               if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0)
+               if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0) {
                        return 0;
+               }
        }
        return 1;
 }
@@ -425,8 +428,10 @@ unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb)
 
        /* find the first free slot */
        for (i = 0; mathutils_callbacks[i]; i++) {
-               if (mathutils_callbacks[i] == cb) /* already registered? */
+               if (mathutils_callbacks[i] == cb) {
+                       /* already registered? */
                        return i;
+               }
        }
 
        BLI_assert(i + 1 < MATHUTILS_TOT_CB);
@@ -611,18 +616,24 @@ PyMODINIT_FUNC PyInit_mathutils(void)
        PyObject *submodule;
        PyObject *sys_modules = PyImport_GetModuleDict();
 
-       if (PyType_Ready(&vector_Type) < 0)
+       if (PyType_Ready(&vector_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&matrix_Type) < 0)
+       }
+       if (PyType_Ready(&matrix_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&matrix_access_Type) < 0)
+       }
+       if (PyType_Ready(&matrix_access_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&euler_Type) < 0)
+       }
+       if (PyType_Ready(&euler_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&quaternion_Type) < 0)
+       }
+       if (PyType_Ready(&quaternion_Type) < 0) {
                return NULL;
-       if (PyType_Ready(&color_Type) < 0)
+       }
+       if (PyType_Ready(&color_Type) < 0) {
                return NULL;
+       }
 
        mod = PyModule_Create(&M_Mathutils_module_def);
 
index b05b8c8..c97d272 100644 (file)
@@ -52,8 +52,9 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
                case 0:
                        break;
                case 1:
-                       if ((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1)
+                       if ((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1) {
                                return NULL;
+                       }
                        break;
                default:
                        PyErr_SetString(PyExc_TypeError,
@@ -101,8 +102,9 @@ PyDoc_STRVAR(Color_copy_doc,
 );
 static PyObject *Color_copy(ColorObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        return Color_CreatePyObject(self->col, Py_TYPE(self));
 }
@@ -121,8 +123,9 @@ static PyObject *Color_repr(ColorObject *self)
 {
        PyObject *ret, *tuple;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        tuple = Color_ToTupleExt(self, -1);
 
@@ -137,8 +140,9 @@ static PyObject *Color_str(ColorObject *self)
 {
        DynStr *ds;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        ds = BLI_dynstr_new();
 
@@ -160,8 +164,9 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
                ColorObject *colA = (ColorObject *)a;
                ColorObject *colB = (ColorObject *)b;
 
-               if (BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1)
+               if (BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1) {
                        return NULL;
+               }
 
                ok = EXPP_VectorsAreEqual(colA->col, colB->col, COLOR_SIZE, 1) ? 0 : -1;
        }
@@ -190,11 +195,13 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
 
 static Py_hash_t Color_hash(ColorObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
+       }
 
-       if (BaseMathObject_Prepare_ForHash(self) == -1)
+       if (BaseMathObject_Prepare_ForHash(self) == -1) {
                return -1;
+       }
 
        return mathutils_array_hash(self->col, COLOR_SIZE);
 }
@@ -210,7 +217,9 @@ static int Color_len(ColorObject *UNUSED(self))
 /* sequence accessor (get) */
 static PyObject *Color_item(ColorObject *self, int i)
 {
-       if (i < 0) i = COLOR_SIZE - i;
+       if (i < 0) {
+               i = COLOR_SIZE - i;
+       }
 
        if (i < 0 || i >= COLOR_SIZE) {
                PyErr_SetString(PyExc_IndexError,
@@ -219,8 +228,9 @@ static PyObject *Color_item(ColorObject *self, int i)
                return NULL;
        }
 
-       if (BaseMath_ReadIndexCallback(self, i) == -1)
+       if (BaseMath_ReadIndexCallback(self, i) == -1) {
                return NULL;
+       }
 
        return PyFloat_FromDouble(self->col[i]);
 
@@ -231,8 +241,9 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value)
 {
        float f;
 
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return -1;
+       }
 
        f = PyFloat_AsDouble(value);
        if (f == -1 && PyErr_Occurred()) {  /* parsed item not a number */
@@ -242,7 +253,9 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value)
                return -1;
        }
 
-       if (i < 0) i = COLOR_SIZE - i;
+       if (i < 0) {
+               i = COLOR_SIZE - i;
+       }
 
        if (i < 0 || i >= COLOR_SIZE) {
                PyErr_SetString(PyExc_IndexError, "color[item] = x: "
@@ -252,8 +265,9 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value)
 
        self->col[i] = f;
 
-       if (BaseMath_WriteIndexCallback(self, i) == -1)
+       if (BaseMath_WriteIndexCallback(self, i) == -1) {
                return -1;
+       }
 
        return 0;
 }
@@ -264,11 +278,14 @@ static PyObject *Color_slice(ColorObject *self, int begin, int end)
        PyObject *tuple;
        int count;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        CLAMP(begin, 0, COLOR_SIZE);
-       if (end < 0) end = (COLOR_SIZE + 1) + end;
+       if (end < 0) {
+               end = (COLOR_SIZE + 1) + end;
+       }
        CLAMP(end, 0, COLOR_SIZE);
        begin = MIN2(begin, end);
 
@@ -286,16 +303,20 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
        int i, size;
        float col[COLOR_SIZE];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        CLAMP(begin, 0, COLOR_SIZE);
-       if (end < 0) end = (COLOR_SIZE + 1) + end;
+       if (end < 0) {
+               end = (COLOR_SIZE + 1) + end;
+       }
        CLAMP(end, 0, COLOR_SIZE);
        begin = MIN2(begin, end);
 
-       if ((size = mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1)
+       if ((size = mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1) {
                return -1;
+       }
 
        if (size != (end - begin)) {
                PyErr_SetString(PyExc_ValueError,
@@ -304,8 +325,9 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
                return -1;
        }
 
-       for (i = 0; i < COLOR_SIZE; i++)
+       for (i = 0; i < COLOR_SIZE; i++) {
                self->col[begin + i] = col[i];
+       }
 
        (void)BaseMath_WriteCallback(self);
        return 0;
@@ -316,17 +338,20 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item)
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += COLOR_SIZE;
+               }
                return Color_item(self, i);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -352,20 +377,24 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
 {
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += COLOR_SIZE;
+               }
                return Color_ass_item(self, i, value);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0) {
                        return -1;
+               }
 
-               if (step == 1)
+               if (step == 1) {
                        return Color_ass_slice(self, start, stop, value);
+               }
                else {
                        PyErr_SetString(PyExc_IndexError,
                                        "slice steps not supported with color");
@@ -419,8 +448,9 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2)
        color1 = (ColorObject *)v1;
        color2 = (ColorObject *)v2;
 
-       if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+       if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) {
                return NULL;
+       }
 
        add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
 
@@ -442,8 +472,9 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2)
        color1 = (ColorObject *)v1;
        color2 = (ColorObject *)v2;
 
-       if (BaseMath_ReadCallback_ForWrite(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+       if (BaseMath_ReadCallback_ForWrite(color1) == -1 || BaseMath_ReadCallback(color2) == -1) {
                return NULL;
+       }
 
        add_vn_vn(color1->col, color2->col, COLOR_SIZE);
 
@@ -468,8 +499,9 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2)
        color1 = (ColorObject *)v1;
        color2 = (ColorObject *)v2;
 
-       if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+       if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) {
                return NULL;
+       }
 
        sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
 
@@ -491,8 +523,9 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2)
        color1 = (ColorObject *)v1;
        color2 = (ColorObject *)v2;
 
-       if (BaseMath_ReadCallback_ForWrite(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+       if (BaseMath_ReadCallback_ForWrite(color1) == -1 || BaseMath_ReadCallback(color2) == -1) {
                return NULL;
+       }
 
        sub_vn_vn(color1->col, color2->col, COLOR_SIZE);
 
@@ -516,13 +549,15 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
 
        if (ColorObject_Check(v1)) {
                color1 = (ColorObject *)v1;
-               if (BaseMath_ReadCallback(color1) == -1)
+               if (BaseMath_ReadCallback(color1) == -1) {
                        return NULL;
+               }
        }
        if (ColorObject_Check(v2)) {
                color2 = (ColorObject *)v2;
-               if (BaseMath_ReadCallback(color2) == -1)
+               if (BaseMath_ReadCallback(color2) == -1) {
                        return NULL;
+               }
        }
 
 
@@ -558,8 +593,9 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
 
        if (ColorObject_Check(v1)) {
                color1 = (ColorObject *)v1;
-               if (BaseMath_ReadCallback(color1) == -1)
+               if (BaseMath_ReadCallback(color1) == -1) {
                        return NULL;
+               }
        }
        else {
                PyErr_SetString(PyExc_TypeError,
@@ -590,8 +626,9 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2)
        ColorObject *color = (ColorObject *)v1;
        float scalar;
 
-       if (BaseMath_ReadCallback_ForWrite(color) == -1)
+       if (BaseMath_ReadCallback_ForWrite(color) == -1) {
                return NULL;
+       }
 
        /* only support color *= float */
        if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR *= FLOAT */
@@ -616,8 +653,9 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
        ColorObject *color = (ColorObject *)v1;
        float scalar;
 
-       if (BaseMath_ReadCallback_ForWrite(color) == -1)
+       if (BaseMath_ReadCallback_ForWrite(color) == -1) {
                return NULL;
+       }
 
        /* only support color /= float */
        if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR /= FLOAT */
@@ -648,8 +686,9 @@ static PyObject *Color_neg(ColorObject *self)
 {
        float tcol[COLOR_SIZE];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        negate_vn_vn(tcol, self->col, COLOR_SIZE);
        return Color_CreatePyObject(tcol, Py_TYPE(self));
@@ -718,8 +757,9 @@ static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
        float hsv[3];
        int i = POINTER_AS_INT(type);
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2]));
 
@@ -739,16 +779,18 @@ static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void *type)
                return -1;
        }
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        rgb_to_hsv_v(self->col, hsv);
        CLAMP(f, 0.0f, 1.0f);
        hsv[i] = f;
        hsv_to_rgb_v(hsv, self->col);
 
-       if (BaseMath_WriteCallback(self) == -1)
+       if (BaseMath_WriteCallback(self) == -1) {
                return -1;
+       }
 
        return 0;
 }
@@ -760,8 +802,9 @@ static PyObject *Color_hsv_get(ColorObject *self, void *UNUSED(closure))
        float hsv[3];
        PyObject *ret;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2]));
 
@@ -777,11 +820,13 @@ static int Color_hsv_set(ColorObject *self, PyObject *value, void *UNUSED(closur
 {
        float hsv[3];
 
-       if (mathutils_array_parse(hsv, 3, 3, value, "mathutils.Color.hsv = value") == -1)
+       if (mathutils_array_parse(hsv, 3, 3, value, "mathutils.Color.hsv = value") == -1) {
                return -1;
+       }
 
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return -1;
+       }
 
        CLAMP(hsv[0], 0.0f, 1.0f);
        CLAMP(hsv[1], 0.0f, 1.0f);
@@ -789,8 +834,9 @@ static int Color_hsv_set(ColorObject *self, PyObject *value, void *UNUSED(closur
 
        hsv_to_rgb_v(hsv, self->col);
 
-       if (BaseMath_WriteCallback(self) == -1)
+       if (BaseMath_WriteCallback(self) == -1) {
                return -1;
+       }
 
        return 0;
 }
@@ -913,10 +959,12 @@ PyObject *Color_CreatePyObject(
                self->cb_type = self->cb_subtype = 0;
 
                /* NEW */
-               if (col)
+               if (col) {
                        copy_v3_v3(self->col, col);
-               else
+               }
+               else {
                        zero_v3(self->col);
+               }
 
                self->flag = BASE_MATH_FLAG_DEFAULT;
        }
index a333630..e928049 100644 (file)
@@ -51,19 +51,22 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
                return NULL;
        }
 
-       if (!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str))
+       if (!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) {
                return NULL;
+       }
 
        switch (PyTuple_GET_SIZE(args)) {
                case 0:
                        break;
                case 2:
-                       if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
+                       if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1) {
                                return NULL;
+                       }
                        ATTR_FALLTHROUGH;
                case 1:
-                       if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1)
+                       if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1) {
                                return NULL;
+                       }
                        break;
        }
        return Euler_CreatePyObject(eul, order, type);
@@ -141,8 +144,9 @@ static PyObject *Euler_to_quaternion(EulerObject *self)
 {
        float quat[4];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        eulO_to_quat(quat, self->eul, self->order);
 
@@ -162,8 +166,9 @@ static PyObject *Euler_to_matrix(EulerObject *self)
 {
        float mat[9];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        eulO_to_mat3((float (*)[3])mat, self->eul, self->order);
 
@@ -177,13 +182,15 @@ PyDoc_STRVAR(Euler_zero_doc,
 );
 static PyObject *Euler_zero(EulerObject *self)
 {
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return NULL;
+       }
 
        zero_v3(self->eul);
 
-       if (BaseMath_WriteCallback(self) == -1)
+       if (BaseMath_WriteCallback(self) == -1) {
                return NULL;
+       }
 
        Py_RETURN_NONE;
 }
@@ -218,8 +225,9 @@ static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args)
                return NULL;
        }
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
 
        rotate_eulO(self->eul, self->order, (char)axis, angle);
@@ -241,11 +249,13 @@ static PyObject *Euler_rotate(EulerObject *self, PyObject *value)
 {
        float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
-       if (mathutils_any_to_rotmat(other_rmat, value, "euler.rotate(value)") == -1)
+       if (mathutils_any_to_rotmat(other_rmat, value, "euler.rotate(value)") == -1) {
                return NULL;
+       }
 
        eulO_to_mat3(self_rmat, self->eul, self->order);
        mul_m3_m3m3(rmat, other_rmat, self_rmat);
@@ -268,8 +278,9 @@ static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value)
 {
        float teul[EULER_SIZE];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value,
                                  "euler.make_compatible(other), invalid 'other' arg") == -1)
@@ -300,8 +311,9 @@ PyDoc_STRVAR(Euler_copy_doc,
 );
 static PyObject *Euler_copy(EulerObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        return Euler_CreatePyObject(self->eul, self->order, Py_TYPE(self));
 }
@@ -320,8 +332,9 @@ static PyObject *Euler_repr(EulerObject *self)
 {
        PyObject *ret, *tuple;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        tuple = Euler_ToTupleExt(self, -1);
 
@@ -336,8 +349,9 @@ static PyObject *Euler_str(EulerObject *self)
 {
        DynStr *ds;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        ds = BLI_dynstr_new();
 
@@ -357,8 +371,9 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
                EulerObject *eulA = (EulerObject *)a;
                EulerObject *eulB = (EulerObject *)b;
 
-               if (BaseMath_ReadCallback(eulA) == -1 || BaseMath_ReadCallback(eulB) == -1)
+               if (BaseMath_ReadCallback(eulA) == -1 || BaseMath_ReadCallback(eulB) == -1) {
                        return NULL;
+               }
 
                ok = ((eulA->order == eulB->order) && EXPP_VectorsAreEqual(eulA->eul, eulB->eul, EULER_SIZE, 1)) ? 0 : -1;
        }
@@ -387,11 +402,13 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
 
 static Py_hash_t Euler_hash(EulerObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
+       }
 
-       if (BaseMathObject_Prepare_ForHash(self) == -1)
+       if (BaseMathObject_Prepare_ForHash(self) == -1) {
                return -1;
+       }
 
        return mathutils_array_hash(self->eul, EULER_SIZE);
 }
@@ -407,7 +424,9 @@ static int Euler_len(EulerObject *UNUSED(self))
 /* sequence accessor (get) */
 static PyObject *Euler_item(EulerObject *self, int i)
 {
-       if (i < 0) i = EULER_SIZE - i;
+       if (i < 0) {
+               i = EULER_SIZE - i;
+       }
 
        if (i < 0 || i >= EULER_SIZE) {
                PyErr_SetString(PyExc_IndexError,
@@ -416,8 +435,9 @@ static PyObject *Euler_item(EulerObject *self, int i)
                return NULL;
        }
 
-       if (BaseMath_ReadIndexCallback(self, i) == -1)
+       if (BaseMath_ReadIndexCallback(self, i) == -1) {
                return NULL;
+       }
 
        return PyFloat_FromDouble(self->eul[i]);
 
@@ -428,8 +448,9 @@ static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
 {
        float f;
 
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return -1;
+       }
 
        f = PyFloat_AsDouble(value);
        if (f == -1 && PyErr_Occurred()) {  /* parsed item not a number */
@@ -439,7 +460,9 @@ static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
                return -1;
        }
 
-       if (i < 0) i = EULER_SIZE - i;
+       if (i < 0) {
+               i = EULER_SIZE - i;
+       }
 
        if (i < 0 || i >= EULER_SIZE) {
                PyErr_SetString(PyExc_IndexError,
@@ -450,8 +473,9 @@ static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
 
        self->eul[i] = f;
 
-       if (BaseMath_WriteIndexCallback(self, i) == -1)
+       if (BaseMath_WriteIndexCallback(self, i) == -1) {
                return -1;
+       }
 
        return 0;
 }
@@ -462,11 +486,14 @@ static PyObject *Euler_slice(EulerObject *self, int begin, int end)
        PyObject *tuple;
        int count;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        CLAMP(begin, 0, EULER_SIZE);
-       if (end < 0) end = (EULER_SIZE + 1) + end;
+       if (end < 0) {
+               end = (EULER_SIZE + 1) + end;
+       }
        CLAMP(end, 0, EULER_SIZE);
        begin = MIN2(begin, end);
 
@@ -484,16 +511,20 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
        int i, size;
        float eul[EULER_SIZE];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        CLAMP(begin, 0, EULER_SIZE);
-       if (end < 0) end = (EULER_SIZE + 1) + end;
+       if (end < 0) {
+               end = (EULER_SIZE + 1) + end;
+       }
        CLAMP(end, 0, EULER_SIZE);
        begin = MIN2(begin, end);
 
-       if ((size = mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1)
+       if ((size = mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1) {
                return -1;
+       }
 
        if (size != (end - begin)) {
                PyErr_SetString(PyExc_ValueError,
@@ -502,8 +533,9 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
                return -1;
        }
 
-       for (i = 0; i < EULER_SIZE; i++)
+       for (i = 0; i < EULER_SIZE; i++) {
                self->eul[begin + i] = eul[i];
+       }
 
        (void)BaseMath_WriteCallback(self);
        return 0;
@@ -514,17 +546,20 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item)
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += EULER_SIZE;
+               }
                return Euler_item(self, i);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -551,20 +586,24 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
 {
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += EULER_SIZE;
+               }
                return Euler_ass_item(self, i, value);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0) {
                        return -1;
+               }
 
-               if (step == 1)
+               if (step == 1) {
                        return Euler_ass_slice(self, start, stop, value);
+               }
                else {
                        PyErr_SetString(PyExc_IndexError,
                                        "slice steps not supported with euler");
@@ -621,8 +660,10 @@ PyDoc_STRVAR(Euler_order_doc,
 );
 static PyObject *Euler_order_get(EulerObject *self, void *UNUSED(closure))
 {
-       if (BaseMath_ReadCallback(self) == -1) /* can read order too */
+       if (BaseMath_ReadCallback(self) == -1) {
+               /* can read order too */
                return NULL;
+       }
 
        return PyUnicode_FromString(euler_order_str(self));
 }
@@ -632,8 +673,9 @@ static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(clos
        const char *order_str;
        short order;
 
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return -1;
+       }
 
        if (((order_str = _PyUnicode_AsString(value)) == NULL) ||
            ((order = euler_order_from_string(order_str, "euler.order")) == -1))
index 1f2d955..6477493 100644 (file)
@@ -89,10 +89,12 @@ static int mathutils_matrix_row_get(BaseMathObject *bmo, int row)
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
        int col;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
-       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+       }
+       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row)) {
                return -1;
+       }
 
        for (col = 0; col < self->num_col; col++) {
                bmo->data[col] = MATRIX_ITEM(self, row, col);
@@ -106,10 +108,12 @@ static int mathutils_matrix_row_set(BaseMathObject *bmo, int row)
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
        int col;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
-       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+       }
+       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row)) {
                return -1;
+       }
 
        for (col = 0; col < self->num_col; col++) {
                MATRIX_ITEM(self, row, col) = bmo->data[col];
@@ -123,10 +127,12 @@ static int mathutils_matrix_row_get_index(BaseMathObject *bmo, int row, int col)
 {
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
-       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+       }
+       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row)) {
                return -1;
+       }
 
        bmo->data[col] = MATRIX_ITEM(self, row, col);
        return 0;
@@ -136,10 +142,12 @@ static int mathutils_matrix_row_set_index(BaseMathObject *bmo, int row, int col)
 {
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
-       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+       }
+       if (!matrix_row_vector_check(self, (VectorObject *)bmo, row)) {
                return -1;
+       }
 
        MATRIX_ITEM(self, row, col) = bmo->data[col];
 
@@ -174,10 +182,12 @@ static int mathutils_matrix_col_get(BaseMathObject *bmo, int col)
        int num_row;
        int row;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
-       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+       }
+       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col)) {
                return -1;
+       }
 
        /* for 'translation' size will always be '3' even on 4x4 vec */
        num_row = min_ii(self->num_row, ((VectorObject *)bmo)->size);
@@ -195,10 +205,12 @@ static int mathutils_matrix_col_set(BaseMathObject *bmo, int col)
        int num_row;
        int row;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
-       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+       }
+       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col)) {
                return -1;
+       }
 
        /* for 'translation' size will always be '3' even on 4x4 vec */
        num_row = min_ii(self->num_row, ((VectorObject *)bmo)->size);
@@ -215,10 +227,12 @@ static int mathutils_matrix_col_get_index(BaseMathObject *bmo, int col, int row)
 {
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
-       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+       }
+       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col)) {
                return -1;
+       }
 
        bmo->data[row] = MATRIX_ITEM(self, row, col);
        return 0;
@@ -228,10 +242,12 @@ static int mathutils_matrix_col_set_index(BaseMathObject *bmo, int col, int row)
 {
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
-       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+       }
+       if (!matrix_col_vector_check(self, (VectorObject *)bmo, col)) {
                return -1;
+       }
 
        MATRIX_ITEM(self, row, col) = bmo->data[row];
 
@@ -266,8 +282,9 @@ static int mathutils_matrix_translation_get(BaseMathObject *bmo, int col)
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
        int row;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
+       }
 
        for (row = 0; row < 3; row++) {
                bmo->data[row] = MATRIX_ITEM(self, row, col);
@@ -281,8 +298,9 @@ static int mathutils_matrix_translation_set(BaseMathObject *bmo, int col)
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
        int row;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        for (row = 0; row < 3; row++) {
                MATRIX_ITEM(self, row, col) = bmo->data[row];
@@ -296,8 +314,9 @@ static int mathutils_matrix_translation_get_index(BaseMathObject *bmo, int col,
 {
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
+       }
 
        bmo->data[row] = MATRIX_ITEM(self, row, col);
        return 0;
@@ -307,8 +326,9 @@ static int mathutils_matrix_translation_set_index(BaseMathObject *bmo, int col,
 {
        MatrixObject *self = (MatrixObject *)bmo->cb_user;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        MATRIX_ITEM(self, row, col) = bmo->data[row];
 
@@ -516,8 +536,9 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
        if (vec) {
                float tvec[3];
 
-               if (mathutils_array_parse(tvec, 3, 3, vec, "Matrix.Rotation(angle, size, axis), invalid 'axis' arg") == -1)
+               if (mathutils_array_parse(tvec, 3, 3, vec, "Matrix.Rotation(angle, size, axis), invalid 'axis' arg") == -1) {
                        return NULL;
+               }
 
                axis_angle_to_mat3((float (*)[3])mat, tvec, angle);
        }
@@ -554,8 +575,9 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
 
        unit_m4(mat);
 
-       if (mathutils_array_parse(mat[3], 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1)
+       if (mathutils_array_parse(mat[3], 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1) {
                return NULL;
+       }
 
        return Matrix_CreatePyObject(&mat[0][0], 4, 4, (PyTypeObject *)cls);
 }
@@ -1079,8 +1101,9 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
 {
        float quat[4];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /* must be 3-4 cols, 3-4 rows, square matrix */
        if ((self->num_row < 3) || (self->num_col < 3) || (self->num_row != self->num_col)) {
@@ -1125,15 +1148,18 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
 
        float mat[3][3];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
-       if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
+       if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) {
                return NULL;
+       }
 
        if (eul_compat) {
-               if (BaseMath_ReadCallback(eul_compat) == -1)
+               if (BaseMath_ReadCallback(eul_compat) == -1) {
                        return NULL;
+               }
 
                copy_v3_v3(eul_compatf, eul_compat->eul);
        }
@@ -1155,19 +1181,28 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
        if (order_str) {
                order = euler_order_from_string(order_str, "Matrix.to_euler()");
 
-               if (order == -1)
+               if (order == -1) {
                        return NULL;
+               }
        }
 
        normalize_m3(mat);
 
        if (eul_compat) {
-               if (order == 1) mat3_normalized_to_compatible_eul(eul, eul_compatf, mat);
-               else            mat3_normalized_to_compatible_eulO(eul, eul_compatf, order, mat);
+               if (order == 1) {
+                       mat3_normalized_to_compatible_eul(eul, eul_compatf, mat);
+               }
+               else {
+                       mat3_normalized_to_compatible_eulO(eul, eul_compatf, order, mat);
+               }
        }
        else {
-               if (order == 1) mat3_normalized_to_eul(eul, mat);
-               else            mat3_normalized_to_eulO(eul, order, mat);
+               if (order == 1) {
+                       mat3_normalized_to_eul(eul, mat);
+               }
+               else {
+                       mat3_normalized_to_eulO(eul, order, mat);
+               }
        }
 
        return Euler_CreatePyObject(eul, order, NULL);
@@ -1228,8 +1263,9 @@ PyDoc_STRVAR(Matrix_to_4x4_doc,
 );
 static PyObject *Matrix_to_4x4(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (self->num_row == 4 && self->num_col == 4) {
                return Matrix_CreatePyObject(self->matrix, 4, 4, Py_TYPE(self));
@@ -1259,8 +1295,9 @@ static PyObject *Matrix_to_3x3(MatrixObject *self)
 {
        float mat[3][3];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if ((self->num_row < 3) || (self->num_col < 3)) {
                PyErr_SetString(PyExc_ValueError,
@@ -1283,8 +1320,9 @@ PyDoc_STRVAR(Matrix_to_translation_doc,
 );
 static PyObject *Matrix_to_translation(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if ((self->num_row < 3) || self->num_col < 4) {
                PyErr_SetString(PyExc_ValueError,
@@ -1312,8 +1350,9 @@ static PyObject *Matrix_to_scale(MatrixObject *self)
        float mat[3][3];
        float size[3];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /*must be 3-4 cols, 3-4 rows, square matrix */
        if ((self->num_row < 3) || (self->num_col < 3)) {
@@ -1401,8 +1440,9 @@ PyDoc_STRVAR(Matrix_invert_doc,
 );
 static PyObject *Matrix_invert(MatrixObject *self, PyObject *args)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (matrix_invert_is_compat(self) == false) {
                return NULL;
@@ -1419,8 +1459,9 @@ static PyObject *Matrix_invert(MatrixObject *self, PyObject *args)
                if (PyTuple_GET_SIZE(args) == 1) {
                        MatrixObject *fallback = (MatrixObject *)PyTuple_GET_ITEM(args, 0);
 
-                       if (BaseMath_ReadCallback(fallback) == -1)
+                       if (BaseMath_ReadCallback(fallback) == -1) {
                                return NULL;
+                       }
 
                        if (self != fallback) {
                                matrix_copy(self, fallback);
@@ -1451,8 +1492,9 @@ static PyObject *Matrix_inverted(MatrixObject *self, PyObject *args)
 {
        float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (matrix_invert_args_check(self, args, false) == false) {
                return NULL;
@@ -1482,8 +1524,9 @@ static PyObject *Matrix_inverted(MatrixObject *self, PyObject *args)
 
 static PyObject *Matrix_inverted_noargs(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (matrix_invert_is_compat(self) == false) {
                return NULL;
@@ -1512,8 +1555,9 @@ PyDoc_STRVAR(Matrix_invert_safe_doc,
 );
 static PyObject *Matrix_invert_safe(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (matrix_invert_is_compat(self) == false) {
                return NULL;
@@ -1539,8 +1583,9 @@ static PyObject *Matrix_inverted_safe(MatrixObject *self)
 {
        float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (matrix_invert_is_compat(self) == false) {
                return NULL;
@@ -1563,8 +1608,9 @@ PyDoc_STRVAR(Matrix_adjugate_doc,
 );
 static PyObject *Matrix_adjugate(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (self->num_col != self->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -1618,11 +1664,13 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
 {
        float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
-       if (mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1)
+       if (mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1) {
                return NULL;
+       }
 
        if (self->num_row != 3 || self->num_col != 3) {
                PyErr_SetString(PyExc_ValueError,
@@ -1664,8 +1712,9 @@ static PyObject *Matrix_decompose(MatrixObject *self)
                return NULL;
        }
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        mat4_to_loc_rot_size(loc, rot, size, (float (*)[4])self->matrix);
        mat3_to_quat(quat, rot);
@@ -1698,8 +1747,9 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
        MatrixObject *mat2 = NULL;
        float fac, mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
 
-       if (!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac))
+       if (!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac)) {
                return NULL;
+       }
 
        if (self->num_col != mat2->num_col || self->num_row != mat2->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -1708,8 +1758,9 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
                return NULL;
        }
 
-       if (BaseMath_ReadCallback(self) == -1 || BaseMath_ReadCallback(mat2) == -1)
+       if (BaseMath_ReadCallback(self) == -1 || BaseMath_ReadCallback(mat2) == -1) {
                return NULL;
+       }
 
        /* TODO, different sized matrix */
        if (self->num_col == 4 && self->num_row == 4) {
@@ -1749,8 +1800,9 @@ PyDoc_STRVAR(Matrix_determinant_doc,
 );
 static PyObject *Matrix_determinant(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (self->num_col != self->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -1771,8 +1823,9 @@ PyDoc_STRVAR(Matrix_transpose_doc,
 );
 static PyObject *Matrix_transpose(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (self->num_col != self->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -1818,8 +1871,9 @@ PyDoc_STRVAR(Matrix_normalize_doc,
 );
 static PyObject *Matrix_normalize(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (self->num_col != self->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -1867,13 +1921,15 @@ PyDoc_STRVAR(Matrix_zero_doc,
 );
 static PyObject *Matrix_zero(MatrixObject *self)
 {
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return NULL;
+       }
 
        copy_vn_fl(self->matrix, self->num_col * self->num_row, 0.0f);
 
-       if (BaseMath_WriteCallback(self) == -1)
+       if (BaseMath_WriteCallback(self) == -1) {
                return NULL;
+       }
 
        Py_RETURN_NONE;
 
@@ -1906,8 +1962,9 @@ PyDoc_STRVAR(Matrix_identity_doc,
 );
 static PyObject *Matrix_identity(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (self->num_col != self->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -1918,8 +1975,9 @@ static PyObject *Matrix_identity(MatrixObject *self)
 
        matrix_identity_internal(self);
 
-       if (BaseMath_WriteCallback(self) == -1)
+       if (BaseMath_WriteCallback(self) == -1) {
                return NULL;
+       }
 
        Py_RETURN_NONE;
 }
@@ -1941,8 +1999,9 @@ PyDoc_STRVAR(Matrix_copy_doc,
 );
 static PyObject *Matrix_copy(MatrixObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        return Matrix_copy_notest(self, self->matrix);
 }
@@ -1961,8 +2020,9 @@ static PyObject *Matrix_repr(MatrixObject *self)
        int col, row;
        PyObject *rows[MATRIX_MAX_DIM] = {NULL};
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        for (row = 0; row < self->num_row; row++) {
                rows[row] = PyTuple_New(self->num_col);
@@ -1998,8 +2058,9 @@ static PyObject *Matrix_str(MatrixObject *self)
 
        char dummy_buf[64];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        ds = BLI_dynstr_new();
 
@@ -2035,8 +2096,9 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
                MatrixObject *matA = (MatrixObject *)a;
                MatrixObject *matB = (MatrixObject *)b;
 
-               if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1)
+               if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1) {
                        return NULL;
+               }
 
                ok = ((matA->num_row == matB->num_row) &&
                      (matA->num_col == matB->num_col) &&
@@ -2070,11 +2132,13 @@ static Py_hash_t Matrix_hash(MatrixObject *self)
 {
        float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
+       }
 
-       if (BaseMathObject_Prepare_ForHash(self) == -1)
+       if (BaseMathObject_Prepare_ForHash(self) == -1) {
                return -1;
+       }
 
        matrix_transpose_internal(mat, self);
 
@@ -2093,8 +2157,9 @@ static int Matrix_len(MatrixObject *self)
  * the wrapped vector gives direct access to the matrix data */
 static PyObject *Matrix_item_row(MatrixObject *self, int row)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (row < 0 || row >= self->num_row) {
                PyErr_SetString(PyExc_IndexError,
@@ -2107,8 +2172,9 @@ static PyObject *Matrix_item_row(MatrixObject *self, int row)
 /* same but column access */
 static PyObject *Matrix_item_col(MatrixObject *self, int col)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        if (col < 0 || col >= self->num_col) {
                PyErr_SetString(PyExc_IndexError,
@@ -2126,8 +2192,9 @@ static int Matrix_ass_item_row(MatrixObject *self, int row, PyObject *value)
 {
        int col;
        float vec[MATRIX_MAX_DIM];
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        if (row >= self->num_row || row < 0) {
                PyErr_SetString(PyExc_IndexError,
@@ -2151,8 +2218,9 @@ static int Matrix_ass_item_col(MatrixObject *self, int col, PyObject *value)
 {
        int row;
        float vec[MATRIX_MAX_DIM];
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        if (col >= self->num_col || col < 0) {
                PyErr_SetString(PyExc_IndexError,
@@ -2182,8 +2250,9 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
        PyObject *tuple;
        int count;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        CLAMP(begin, 0, self->num_row);
        CLAMP(end, 0, self->num_row);
@@ -2203,8 +2272,9 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
 {
        PyObject *value_fast;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        CLAMP(begin, 0, self->num_row);
        CLAMP(end, 0, self->num_row);
@@ -2276,8 +2346,9 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
                return NULL;
        }
 
-       if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1)
+       if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1) {
                return NULL;
+       }
 
        if (mat1->num_col != mat2->num_col || mat1->num_row != mat2->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -2308,8 +2379,9 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
                return NULL;
        }
 
-       if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1)
+       if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1) {
                return NULL;
+       }
 
        if (mat1->num_col != mat2->num_col || mat1->num_row != mat2->num_row) {
                PyErr_SetString(PyExc_ValueError,
@@ -2339,13 +2411,15 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
 
        if (MatrixObject_Check(m1)) {
                mat1 = (MatrixObject *)m1;
-               if (BaseMath_ReadCallback(mat1) == -1)
+               if (BaseMath_ReadCallback(mat1) == -1) {
                        return NULL;
+               }
        }
        if (MatrixObject_Check(m2)) {
                mat2 = (MatrixObject *)m2;
-               if (BaseMath_ReadCallback(mat2) == -1)
+               if (BaseMath_ReadCallback(mat2) == -1) {
                        return NULL;
+               }
        }
 
        if (mat1 && mat2) {
@@ -2394,13 +2468,15 @@ static PyObject *Matrix_imul(PyObject *m1, PyObject *m2)
 
        if (MatrixObject_Check(m1)) {
                mat1 = (MatrixObject *)m1;
-               if (BaseMath_ReadCallback(mat1) == -1)
+               if (BaseMath_ReadCallback(mat1) == -1) {
                        return NULL;
+               }
        }
        if (MatrixObject_Check(m2)) {
                mat2 = (MatrixObject *)m2;
-               if (BaseMath_ReadCallback(mat2) == -1)
+               if (BaseMath_ReadCallback(mat2) == -1) {
                        return NULL;
+               }
        }
 
        if (mat1 && mat2) {
@@ -2448,13 +2524,15 @@ static PyObject *Matrix_matmul(PyObject *m1, PyObject *m2)
 
        if (MatrixObject_Check(m1)) {
                mat1 = (MatrixObject *)m1;
-               if (BaseMath_ReadCallback(mat1) == -1)
+               if (BaseMath_ReadCallback(mat1) == -1) {
                        return NULL;
+               }
        }
        if (MatrixObject_Check(m2)) {
                mat2 = (MatrixObject *)m2;
-               if (BaseMath_ReadCallback(mat2) == -1)
+               if (BaseMath_ReadCallback(mat2) == -1) {
                        return NULL;
+               }
        }
 
        if (mat1 && mat2) {
@@ -2487,8 +2565,9 @@ static PyObject *Matrix_matmul(PyObject *m1, PyObject *m2)
                if (VectorObject_Check(m2)) {
                        VectorObject *vec2 = (VectorObject *)m2;
                        float tvec[MATRIX_MAX_DIM];
-                       if (BaseMath_ReadCallback(vec2) == -1)
+                       if (BaseMath_ReadCallback(vec2) == -1) {
                                return NULL;
+                       }
                        if (column_vector_multiplication(tvec, vec2, mat1) == -1) {
                                return NULL;
                        }
@@ -2518,13 +2597,15 @@ static PyObject *Matrix_imatmul(PyObject *m1, PyObject *m2)
 
        if (MatrixObject_Check(m1)) {
                mat1 = (MatrixObject *)m1;
-               if (BaseMath_ReadCallback(mat1) == -1)
+               if (BaseMath_ReadCallback(mat1) == -1) {
                        return NULL;
+               }
        }
        if (MatrixObject_Check(m2)) {
                mat2 = (MatrixObject *)m2;
-               if (BaseMath_ReadCallback(mat2) == -1)
+               if (BaseMath_ReadCallback(mat2) == -1) {
                        return NULL;
+               }
        }
 
        if (mat1 && mat2) {
@@ -2587,17 +2668,20 @@ static PyObject *Matrix_subscript(MatrixObject *self, PyObject *item)
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += self->num_row;
+               }
                return Matrix_item_row(self, i);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -2623,20 +2707,24 @@ static int Matrix_ass_subscript(MatrixObject *self, PyObject *item, PyObject *va
 {
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += self->num_row;
+               }
                return Matrix_ass_item_row(self, i, value);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0) {
                        return -1;
+               }
 
-               if (step == 1)
+               if (step == 1) {
                        return Matrix_ass_slice(self, start, stop, value);
+               }
                else {
                        PyErr_SetString(PyExc_IndexError,
                                        "slice steps not supported with matrices");
@@ -2704,8 +2792,9 @@ static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure
 {
        PyObject *ret;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /*must be 4x4 square matrix*/
        if (self->num_row != 4 || self->num_col != 4) {
@@ -2724,8 +2813,9 @@ static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNU
 {
        float tvec[3];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        /*must be 4x4 square matrix*/
        if (self->num_row != 4 || self->num_col != 4) {
@@ -2769,8 +2859,9 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
 {
        float mat[3][3];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /*must be 3-4 cols, 3-4 rows, square matrix*/
        if ((self->num_row < 3) || (self->num_col < 3)) {
@@ -2790,14 +2881,17 @@ PyDoc_STRVAR(Matrix_is_negative_doc,
 );
 static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure))
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /*must be 3-4 cols, 3-4 rows, square matrix*/
-       if (self->num_row == 4 && self->num_col == 4)
+       if (self->num_row == 4 && self->num_col == 4) {
                return PyBool_FromLong(is_negative_m4((float (*)[4])self->matrix));
-       else if (self->num_row == 3 && self->num_col == 3)
+       }
+       else if (self->num_row == 3 && self->num_col == 3) {
                return PyBool_FromLong(is_negative_m3((float (*)[3])self->matrix));
+       }
        else {
                PyErr_SetString(PyExc_AttributeError,
                                "Matrix.is_negative: "
@@ -2811,14 +2905,17 @@ PyDoc_STRVAR(Matrix_is_orthogonal_doc,
 );
 static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure))
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /*must be 3-4 cols, 3-4 rows, square matrix*/
-       if (self->num_row == 4 && self->num_col == 4)
+       if (self->num_row == 4 && self->num_col == 4) {
                return PyBool_FromLong(is_orthonormal_m4((float (*)[4])self->matrix));
-       else if (self->num_row == 3 && self->num_col == 3)
+       }
+       else if (self->num_row == 3 && self->num_col == 3) {
                return PyBool_FromLong(is_orthonormal_m3((float (*)[3])self->matrix));
+       }
        else {
                PyErr_SetString(PyExc_AttributeError,
                                "Matrix.is_orthogonal: "
@@ -2832,14 +2929,17 @@ PyDoc_STRVAR(Matrix_is_orthogonal_axis_vectors_doc,
 );
 static PyObject *Matrix_is_orthogonal_axis_vectors_get(MatrixObject *self, void *UNUSED(closure))
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        /*must be 3-4 cols, 3-4 rows, square matrix*/
-       if (self->num_row == 4 && self->num_col == 4)
+       if (self->num_row == 4 && self->num_col == 4) {
                return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->matrix));
-       else if (self->num_row == 3 && self->num_col == 3)
+       }
+       else if (self->num_row == 3 && self->num_col == 3) {
                return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->matrix));
+       }
        else {
                PyErr_SetString(PyExc_AttributeError,
                                "Matrix.is_orthogonal_axis_vectors: "
@@ -3208,7 +3308,9 @@ static PyObject *MatrixAccess_slice(MatrixAccessObject *self, int begin, int end
        }
 
        CLAMP(begin, 0, matrix_access_len);
-       if (end < 0) end = (matrix_access_len + 1) + end;
+       if (end < 0) {
+               end = (matrix_access_len + 1) + end;
+       }
        CLAMP(end, 0, matrix_access_len);
        begin = MIN2(begin, end);
 
@@ -3227,24 +3329,28 @@ static PyObject *MatrixAccess_subscript(MatrixAccessObject *self, PyObject *item
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
+               }
                if (self->type == MAT_ACCESS_ROW) {
-                       if (i < 0)
+                       if (i < 0) {
                                i += matrix_user->num_row;
+                       }
                        return Matrix_item_row(matrix_user, i);
                }
                else { /* MAT_ACCESS_ROW */
-                       if (i < 0)
+                       if (i < 0) {
                                i += matrix_user->num_col;
+                       }
                        return Matrix_item_col(matrix_user, i);
                }
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -3272,17 +3378,20 @@ static int MatrixAccess_ass_subscript(MatrixAccessObject *self, PyObject *item,
 
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
+               }
 
                if (self->type == MAT_ACCESS_ROW) {
-                       if (i < 0)
+                       if (i < 0) {
                                i += matrix_user->num_row;
+                       }
                        return Matrix_ass_item_row(matrix_user, i, value);
                }
                else { /* MAT_ACCESS_ROW */
-                       if (i < 0)
+                       if (i < 0) {
                                i += matrix_user->num_col;
+                       }
                        return Matrix_ass_item_col(matrix_user, i, value);
                }
 
index 5f7ab5f..422a1ff 100644 (file)
@@ -87,31 +87,43 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
        short order = EULER_ORDER_XYZ;
        EulerObject *eul_compat = NULL;
 
-       if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
+       if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) {
                return NULL;
+       }
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (order_str) {
                order = euler_order_from_string(order_str, "Matrix.to_euler()");
 
-               if (order == -1)
+               if (order == -1) {
                        return NULL;
+               }
        }
 
        normalize_qt_qt(tquat, self->quat);
 
        if (eul_compat) {
-               if (BaseMath_ReadCallback(eul_compat) == -1)
+               if (BaseMath_ReadCallback(eul_compat) == -1) {
                        return NULL;
+               }
 
-               if (order == EULER_ORDER_XYZ)  quat_to_compatible_eul(eul, eul_compat->eul, tquat);
-               else                           quat_to_compatible_eulO(eul, eul_compat->eul, order, tquat);
+               if (order == EULER_ORDER_XYZ) {
+                       quat_to_compatible_eul(eul, eul_compat->eul, tquat);
+               }
+               else {
+                       quat_to_compatible_eulO(eul, eul_compat->eul, order, tquat);
+               }
        }
        else {
-               if (order == EULER_ORDER_XYZ)  quat_to_eul(eul, tquat);
-               else                           quat_to_eulO(eul, order, tquat);
+               if (order == EULER_ORDER_XYZ) {
+                       quat_to_eul(eul, tquat);
+               }
+               else {
+                       quat_to_eulO(eul, order, tquat);
+               }
        }
 
        return Euler_CreatePyObject(eul, order, NULL);
@@ -129,8 +141,9 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
 {
        float mat[9]; /* all values are set */
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        quat_to_mat3((float (*)[3])mat, self->quat);
        return Matrix_CreatePyObject(mat, 3, 3, NULL);
@@ -153,8 +166,9 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
        float axis[3];
        float angle;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        normalize_qt_qt(tquat, self->quat);
        quat_to_axis_angle(axis, &angle, tquat);
@@ -185,8 +199,9 @@ static PyObject *Quaternion_to_exponential_map(QuaternionObject *self)
 {
        float expmap[3];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        quat_to_expmap(expmap, self->quat);
        return Vector_CreatePyObject(expmap, 3, NULL);
@@ -206,8 +221,9 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
 {
        float quat[QUAT_SIZE], tquat[QUAT_SIZE];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
                                  "Quaternion.cross(other), invalid 'other' arg") == -1)
@@ -233,8 +249,9 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
 {
        float tquat[QUAT_SIZE];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
                                  "Quaternion.dot(other), invalid 'other' arg") == -1)
@@ -259,8 +276,9 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
 {
        float tquat[QUAT_SIZE], quat[QUAT_SIZE];
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
                                  "Quaternion.difference(other), invalid 'other' arg") == -1)
@@ -297,8 +315,9 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
                return NULL;
        }
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
                                  "Quaternion.slerp(other), invalid 'other' arg") == -1)
@@ -331,11 +350,13 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
        float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
        float tquat[4], length;
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
-       if (mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1)
+       if (mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1) {
                return NULL;
+       }
 
        length = normalize_qt_qt(tquat, self->quat);
        quat_to_mat3(self_rmat, tquat);
@@ -358,8 +379,9 @@ PyDoc_STRVAR(Quaternion_normalize_doc,
 );
 static PyObject *Quaternion_normalize(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        normalize_qt(self->quat);
 
@@ -386,8 +408,9 @@ PyDoc_STRVAR(Quaternion_invert_doc,
 );
 static PyObject *Quaternion_invert(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        invert_qt(self->quat);
 
@@ -416,8 +439,9 @@ PyDoc_STRVAR(Quaternion_identity_doc,
 );
 static PyObject *Quaternion_identity(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        unit_qt(self->quat);
 
@@ -434,8 +458,9 @@ PyDoc_STRVAR(Quaternion_negate_doc,
 );
 static PyObject *Quaternion_negate(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        mul_qt_fl(self->quat, -1.0f);
 
@@ -450,8 +475,9 @@ PyDoc_STRVAR(Quaternion_conjugate_doc,
 );
 static PyObject *Quaternion_conjugate(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return NULL;
+       }
 
        conjugate_qt(self->quat);
 
@@ -484,8 +510,9 @@ PyDoc_STRVAR(Quaternion_copy_doc,
 );
 static PyObject *Quaternion_copy(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        return Quaternion_CreatePyObject(self->quat, Py_TYPE(self));
 }
@@ -502,8 +529,9 @@ static PyObject *Quaternion_repr(QuaternionObject *self)
 {
        PyObject *ret, *tuple;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        tuple = Quaternion_to_tuple_ext(self, -1);
 
@@ -518,8 +546,9 @@ static PyObject *Quaternion_str(QuaternionObject *self)
 {
        DynStr *ds;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        ds = BLI_dynstr_new();
 
@@ -539,8 +568,9 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
                QuaternionObject *quatA = (QuaternionObject *)a;
                QuaternionObject *quatB = (QuaternionObject *)b;
 
-               if (BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1)
+               if (BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1) {
                        return NULL;
+               }
 
                ok = (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1;
        }
@@ -569,11 +599,13 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
 
 static Py_hash_t Quaternion_hash(QuaternionObject *self)
 {
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return -1;
+       }
 
-       if (BaseMathObject_Prepare_ForHash(self) == -1)
+       if (BaseMathObject_Prepare_ForHash(self) == -1) {
                return -1;
+       }
 
        return mathutils_array_hash(self->quat, QUAT_SIZE);
 }
@@ -589,7 +621,9 @@ static int Quaternion_len(QuaternionObject *UNUSED(self))
 /* sequence accessor (get) */
 static PyObject *Quaternion_item(QuaternionObject *self, int i)
 {
-       if (i < 0) i = QUAT_SIZE - i;
+       if (i < 0) {
+               i = QUAT_SIZE - i;
+       }
 
        if (i < 0 || i >= QUAT_SIZE) {
                PyErr_SetString(PyExc_IndexError,
@@ -598,8 +632,9 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i)
                return NULL;
        }
 
-       if (BaseMath_ReadIndexCallback(self, i) == -1)
+       if (BaseMath_ReadIndexCallback(self, i) == -1) {
                return NULL;
+       }
 
        return PyFloat_FromDouble(self->quat[i]);
 
@@ -610,8 +645,9 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
 {
        float f;
 
-       if (BaseMath_Prepare_ForWrite(self) == -1)
+       if (BaseMath_Prepare_ForWrite(self) == -1) {
                return -1;
+       }
 
        f = (float)PyFloat_AsDouble(ob);
 
@@ -622,7 +658,9 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
                return -1;
        }
 
-       if (i < 0) i = QUAT_SIZE - i;
+       if (i < 0) {
+               i = QUAT_SIZE - i;
+       }
 
        if (i < 0 || i >= QUAT_SIZE) {
                PyErr_SetString(PyExc_IndexError,
@@ -632,8 +670,9 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
        }
        self->quat[i] = f;
 
-       if (BaseMath_WriteIndexCallback(self, i) == -1)
+       if (BaseMath_WriteIndexCallback(self, i) == -1) {
                return -1;
+       }
 
        return 0;
 }
@@ -644,11 +683,14 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
        PyObject *tuple;
        int count;
 
-       if (BaseMath_ReadCallback(self) == -1)
+       if (BaseMath_ReadCallback(self) == -1) {
                return NULL;
+       }
 
        CLAMP(begin, 0, QUAT_SIZE);
-       if (end < 0) end = (QUAT_SIZE + 1) + end;
+       if (end < 0) {
+               end = (QUAT_SIZE + 1) + end;
+       }
        CLAMP(end, 0, QUAT_SIZE);
        begin = MIN2(begin, end);
 
@@ -666,16 +708,20 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
        int i, size;
        float quat[QUAT_SIZE];
 
-       if (BaseMath_ReadCallback_ForWrite(self) == -1)
+       if (BaseMath_ReadCallback_ForWrite(self) == -1) {
                return -1;
+       }
 
        CLAMP(begin, 0, QUAT_SIZE);
-       if (end < 0) end = (QUAT_SIZE + 1) + end;
+       if (end < 0) {
+               end = (QUAT_SIZE + 1) + end;
+       }
        CLAMP(end, 0, QUAT_SIZE);
        begin = MIN2(begin, end);
 
-       if ((size = mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1)
+       if ((size = mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1) {
                return -1;
+       }
 
        if (size != (end - begin)) {
                PyErr_SetString(PyExc_ValueError,
@@ -685,8 +731,9 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
        }
 
        /* parsed well - now set in vector */
-       for (i = 0; i < size; i++)
+       for (i = 0; i < size; i++) {
                self->quat[begin + i] = quat[i];
+       }
 
        (void)BaseMath_WriteCallback(self);
        return 0;
@@ -698,17 +745,20 @@ static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item)
        if (PyIndex_Check(item)) {
                Py_ssize_t i;
                i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return NULL;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += QUAT_SIZE;
+               }
                return Quaternion_item(self, i);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0) {
                        return NULL;
+               }
 
                if (slicelength <= 0) {
                        return PyTuple_New(0);
@@ -735,20 +785,24 @@ static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyOb
 {
        if (PyIndex_Check(item)) {
                Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
-               if (i == -1 && PyErr_Occurred())
+               if (i == -1 && PyErr_Occurred()) {
                        return -1;
-               if (i < 0)
+               }
+               if (i < 0) {
                        i += QUAT_SIZE;
+               }
                return Quaternion_ass_item(self, i, value);
        }
        else if (PySlice_Check(item)) {
                Py_ssize_t start, stop, step, slicelength;
 
-               if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
+               if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0) {
                        return -1;
+               }
 
-               if (step == 1)
+               if (step == 1) {
                        return Quaternion_ass_slice(self, start, stop, value);
+               }
                else {
                        PyErr_SetString(PyExc_IndexError,
                                        "slice steps not supported with quaternion");
@@ -781,8