diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-29 22:12:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-29 23:14:28 +0300 |
commit | 25ec4b437fe927205a810470cdc23efd7282c85b (patch) | |
tree | 6d7ba2fe73703915b4b94d3f2dab03fb731e9544 /source/blender/python/intern/bpy_rna_array.c | |
parent | 18d06e8d21ed8c9a19df4205abcd7ed17eb9af00 (diff) |
Cleanup: style, use braces for the Python API
Diffstat (limited to 'source/blender/python/intern/bpy_rna_array.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna_array.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index a87da8782bc..4cc3c4c0fae 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -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; } |