diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-18 12:50:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-18 12:50:06 +0400 |
commit | 9c9099a805a1f143ae9916b2b6f03cbfe640bfff (patch) | |
tree | fad0cb1bbe1492b3157913486c264454c16ce9f9 /source/blender | |
parent | 414370b8d42324878485e569fc332b814131887f (diff) |
formatting edits in py api, no functional changes
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/generic/bgl.c | 4 | ||||
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 6 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_handlers.c | 12 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 16 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 20 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_callback.c | 15 | ||||
-rw-r--r-- | source/blender/python/intern/gpu.c | 9 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils.c | 16 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Color.c | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.c | 4 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 4 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 16 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 12 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 116 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_noise.c | 2 |
17 files changed, 132 insertions, 128 deletions
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 03d66e918d5..c2fd6036414 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -453,7 +453,7 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v) } } - switch(self->type) { + switch (self->type) { case GL_BYTE: return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1; case GL_SHORT: @@ -595,7 +595,7 @@ static PyObject *Buffer_repr(Buffer *self) PyObject *repr; const char *typestr= "UNKNOWN"; - switch(self->type) { + switch (self->type) { case GL_BYTE: typestr= "GL_BYTE"; break; case GL_SHORT: typestr= "GL_SHORT"; break; case GL_INT: typestr= "GL_BYTE"; break; diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index c31dadff3e1..c058ee1d4f0 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -405,7 +405,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty val.array.len = PySequence_Size(ob); - switch(val.array.type) { + switch (val.array.type) { case IDP_DOUBLE: prop = IDP_New(IDP_ARRAY, &val, name); for (i=0; i<val.array.len; i++) { @@ -565,7 +565,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) return NULL; } - switch(prop->subtype) { + switch (prop->subtype) { case IDP_FLOAT: { float *array= (float*)IDP_Array(prop); @@ -976,7 +976,7 @@ static PyObject *BPy_IDArray_repr(BPy_IDArray *self) static PyObject *BPy_IDArray_GetType(BPy_IDArray *self) { - switch(self->prop->subtype) { + switch (self->prop->subtype) { case IDP_FLOAT: return PyUnicode_FromString("f"); case IDP_DOUBLE: diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 8d68a407e62..43b8dc21300 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -191,7 +191,7 @@ void PyC_FileAndNum(const char **filename, int *lineno) void PyC_FileAndNum_Safe(const char **filename, int *lineno) { - if(!PYC_INTERPRETER_ACTIVE) { + if (!PYC_INTERPRETER_ACTIVE) { return; } diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index dd512791e85..dc9ef9ee8e8 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -82,7 +82,7 @@ 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)) { @@ -252,12 +252,12 @@ void BPY_app_handlers_reset(const short do_all) PyObject *item; PyObject **dict_ptr; - for(i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) { + for (i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) { - if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) && - (dict_ptr= _PyObject_GetDictPtr(item)) && - (*dict_ptr) && - (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL)) + if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) && + (dict_ptr= _PyObject_GetDictPtr(item)) && + (*dict_ptr) && + (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL)) { /* keep */ } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index c0d796669d6..d1408015089 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -971,14 +971,14 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i item= PySequence_Fast_GET_ITEM(seq_fast, i); - if ( (PyTuple_CheckExact(item)) && - (item_size= PyTuple_GET_SIZE(item)) && - (item_size == 3 || item_size == 4) && - (tmp.identifier= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) && - (tmp.name= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) && - (tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) && - (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1) /* TODO, number isnt ensured to be unique from the script author */ - ) { + if ( (PyTuple_CheckExact(item)) && + (item_size= PyTuple_GET_SIZE(item)) && + (item_size == 3 || item_size == 4) && + (tmp.identifier= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) && + (tmp.name= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) && + (tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) && + (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1)) /* TODO, number isnt ensured to be unique from the script author */ + { if (is_enum_flag) { if (item_size < 4) { tmp.value= 1<<i; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index f099994fc57..69a5fb39b67 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -624,7 +624,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) if (!is_thick) ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */ - switch(subtype) { + switch (subtype) { case PROP_ALL_VECTOR_SUBTYPES: if (len>=2 && len <= 4) { if (is_thick) { @@ -3441,7 +3441,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) int done= CTX_data_get(C, name, &newptr, &newlb, &newtype); if (done==1) { /* found */ - switch(newtype) { + switch (newtype) { case CTX_DATA_TYPE_POINTER: if (newptr.data == NULL) { ret= Py_None; @@ -4201,7 +4201,7 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons { char f= format ? *format:'B'; /* B is assumed when not set */ - switch(raw_type) { + switch (raw_type) { case PROP_RAW_CHAR: if (attr_signed) return (f=='b') ? 1:0; else return (f=='B') ? 1:0; @@ -4265,7 +4265,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) for ( ; i<tot; i++) { item= PySequence_GetItem(seq, i); - switch(raw_type) { + switch (raw_type) { case PROP_RAW_CHAR: ((char *)array)[i]= (char)PyLong_AsLong(item); break; @@ -4320,7 +4320,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) for ( ; i<tot; i++) { - switch(raw_type) { + switch (raw_type) { case PROP_RAW_CHAR: item= PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]); break; @@ -4616,7 +4616,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int*)data)[a])); break; case PROP_FLOAT: - switch(RNA_property_subtype(prop)) { + switch (RNA_property_subtype(prop)) { #ifdef USE_MATHUTILS case PROP_ALL_VECTOR_SUBTYPES: ret= Vector_CreatePyObject(data, len, Py_NEW, NULL); @@ -6969,10 +6969,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if (err != 0) { ReportList *reports; /* alert the user, else they wont know unless they see the console. */ - if ( (!is_static) && - (ptr->data) && - (RNA_struct_is_a(ptr->type, &RNA_Operator)) && - (is_valid_wm == (CTX_wm_manager(C) != NULL))) + if ( (!is_static) && + (ptr->data) && + (RNA_struct_is_a(ptr->type, &RNA_Operator)) && + (is_valid_wm == (CTX_wm_manager(C) != NULL))) { wmOperator *op= ptr->data; reports= op->reports; diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 8f88814b3e4..3006e2a6b90 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -148,8 +148,8 @@ static int pyrna_struct_anim_args_parse( /* internal use for insert and delete */ static int pyrna_struct_keyframe_parse( - PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix, - const char **path_full, int *index, float *cfra, const char **group_name) /* return values */ + PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix, + const char **path_full, int *index, float *cfra, const char **group_name) /* return values */ { static const char *kwlist[]= {"data_path", "index", "frame", "group", NULL}; const char *path; diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index 85f950947a7..134cbfda71f 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -60,7 +60,7 @@ static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customd cb_args= PyTuple_GET_ITEM((PyObject *)customdata, 1); result= PyObject_CallObject(cb_func, cb_args); - if(result) { + if (result) { Py_DECREF(result); } else { @@ -82,21 +82,22 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args) 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)) { + if (!PyCallable_Check(cb_func)) { PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable"); return NULL; } - if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) { - if(cb_event_str) { + if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) { + if (cb_event_str) { static EnumPropertyItem region_draw_mode_items[]= { {REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""}, {REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""}, {REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""}, {0, NULL, 0, NULL, NULL}}; - if(pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0) + if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0) { return NULL; + } } else { cb_event= REGION_DRAW_POST_PIXEL; @@ -124,12 +125,12 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args) handle= PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID); - if(handle==NULL) { + if (handle==NULL) { PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed"); return NULL; } - if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) { + if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) { customdata= ED_region_draw_cb_customdata(handle); Py_DECREF((PyObject *)customdata); diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index 0da63297077..a155a7ec3d9 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -184,7 +184,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed"); return NULL; } - } else { + } + else { PyErr_SetString(PyExc_TypeError, "gpu.export_shader() first argument should be of Scene type"); return NULL; } @@ -204,7 +205,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed"); return NULL; } - } else { + } + else { PyErr_SetString(PyExc_TypeError, "gpu.export_shader() second argument should be of Material type"); return NULL; } @@ -260,7 +262,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj if (attribute->name) { if (attribute->name[0] != 0) { PY_DICT_ADD_STRING(dict,attribute,name); - } else { + } + else { val = PyLong_FromLong(0); PyDict_SetItemString(dict, "name", val); Py_DECREF(val); diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 6a7f54d6f81..5587028d812 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -74,10 +74,10 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject * #if 1 /* approx 6x speedup for mathutils types */ - if ( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || - (size= EulerObject_Check(value) ? 3 : 0) || - (size= QuaternionObject_Check(value) ? 4 : 0) || - (size= ColorObject_Check(value) ? 3 : 0)) + if ( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || + (size= EulerObject_Check(value) ? 3 : 0) || + (size= QuaternionObject_Check(value) ? 4 : 0) || + (size= ColorObject_Check(value) ? 3 : 0)) { if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; @@ -138,10 +138,10 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c #if 1 /* approx 6x speedup for mathutils types */ - if ( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || - (size= EulerObject_Check(value) ? 3 : 0) || - (size= QuaternionObject_Check(value) ? 4 : 0) || - (size= ColorObject_Check(value) ? 3 : 0)) + if ( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || + (size= EulerObject_Check(value) ? 3 : 0) || + (size= QuaternionObject_Check(value) ? 4 : 0) || + (size= ColorObject_Check(value) ? 3 : 0)) { if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 8409344a9fe..e46dda7560f 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -48,7 +48,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } - switch(PyTuple_GET_SIZE(args)) { + switch (PyTuple_GET_SIZE(args)) { case 0: break; case 1: diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 7e769da14cb..f44c0b82a2d 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -59,7 +59,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) return NULL; - switch(PyTuple_GET_SIZE(args)) { + switch (PyTuple_GET_SIZE(args)) { case 0: break; case 2: @@ -84,7 +84,7 @@ static const char *euler_order_str(EulerObject *self) short euler_order_from_string(const char *str, const char *error_prefix) { if ((str[0] && str[1] && str[2] && str[3]=='\0')) { - switch(*((PY_INT32_T *)str)) { + switch (*((PY_INT32_T *)str)) { case 'X'|'Y'<<8|'Z'<<16: return EULER_ORDER_XYZ; case 'X'|'Z'<<8|'Y'<<16: return EULER_ORDER_XZY; case 'Y'|'X'<<8|'Z'<<16: return EULER_ORDER_YXZ; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index ea636ef52fb..bc68d469fc1 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -123,7 +123,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } - switch(PyTuple_GET_SIZE(args)) { + switch (PyTuple_GET_SIZE(args)) { case 0: return Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type); case 1: @@ -1307,7 +1307,7 @@ static PyObject *Matrix_repr(MatrixObject *self) PyTuple_SET_ITEM(rows[x], y, PyFloat_FromDouble(self->matrix[x][y])); } } - switch(self->row_size) { + switch (self->row_size) { case 2: return PyUnicode_FromFormat("Matrix((%R,\n" " %R))", rows[0], rows[1]); diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index cf817003a98..7ab9b7b0713 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -1039,7 +1039,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw if (!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle)) return NULL; - switch(PyTuple_GET_SIZE(args)) { + switch (PyTuple_GET_SIZE(args)) { case 0: break; case 1: @@ -1075,18 +1075,18 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec static void quat__axis_angle_sanitize(float axis[3], float *angle) { if (axis) { - if ( !finite(axis[0]) || - !finite(axis[1]) || - !finite(axis[2])) + if ( !finite(axis[0]) || + !finite(axis[1]) || + !finite(axis[2])) { axis[0]= 1.0f; axis[1]= 0.0f; axis[2]= 0.0f; } - else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && - EXPP_FloatsAreEqual(axis[1], 0.0f, 10) && - EXPP_FloatsAreEqual(axis[2], 0.0f, 10) - ) { + else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && + EXPP_FloatsAreEqual(axis[1], 0.0f, 10) && + EXPP_FloatsAreEqual(axis[2], 0.0f, 10)) + { axis[0] = 1.0f; } } diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index a812311dad4..b9bfde58248 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -57,7 +57,7 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED float *vec= NULL; int size= 3; /* default to a 3D vector */ - switch(PyTuple_GET_SIZE(args)) { + switch (PyTuple_GET_SIZE(args)) { case 0: vec= PyMem_Malloc(size * sizeof(float)); @@ -165,7 +165,7 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args) return NULL; } - switch(PyTuple_GET_SIZE(args)){ + switch (PyTuple_GET_SIZE(args)) { case 1: size = start; start= 0; @@ -430,7 +430,7 @@ static PyObject *Vector_resized(VectorObject *self, PyObject *value) /*if (!PyArg_ParseTuple(args, "i:resize", &size)) return NULL;*/ - if ((size = PyLong_AsLong(value)) == -1){ + if ((size = PyLong_AsLong(value)) == -1) { return NULL; } @@ -712,7 +712,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) if (strlen(strack) == 2) { if (strack[0] == '-') { - switch(strack[1]) { + switch (strack[1]) { case 'X': track = 3; break; @@ -733,7 +733,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) } } else if (strlen(strack) == 1) { - switch(strack[0]) { + switch (strack[0]) { case '-': case 'X': track = 0; @@ -758,7 +758,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) if (sup) { const char *axis_err_msg= "only X, Y or Z for up axis"; if (strlen(sup) == 1) { - switch(*sup) { + switch (*sup) { case 'X': up = 0; break; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index d3b6e2e8b29..f3a843baf66 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -99,11 +99,11 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* return NULL; } - if ( BaseMath_ReadCallback(vec1) == -1 || - BaseMath_ReadCallback(vec2) == -1 || - BaseMath_ReadCallback(vec3) == -1 || - BaseMath_ReadCallback(ray) == -1 || - BaseMath_ReadCallback(ray_off) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(ray) == -1 || + BaseMath_ReadCallback(ray_off) == -1) { return NULL; } @@ -199,10 +199,10 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject return NULL; } - if ( BaseMath_ReadCallback(vec1) == -1 || - BaseMath_ReadCallback(vec2) == -1 || - BaseMath_ReadCallback(vec3) == -1 || - BaseMath_ReadCallback(vec4) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(vec4) == -1) { return NULL; } @@ -298,9 +298,9 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) return NULL; } - if ( BaseMath_ReadCallback(vec1) == -1 || - BaseMath_ReadCallback(vec2) == -1 || - BaseMath_ReadCallback(vec3) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1) { return NULL; } @@ -327,10 +327,10 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) return NULL; } - if ( BaseMath_ReadCallback(vec1) == -1 || - BaseMath_ReadCallback(vec2) == -1 || - BaseMath_ReadCallback(vec3) == -1 || - BaseMath_ReadCallback(vec4) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(vec4) == -1) { return NULL; } @@ -374,9 +374,9 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) return NULL; } - if ( BaseMath_ReadCallback(vec1) == -1 || - BaseMath_ReadCallback(vec2) == -1 || - BaseMath_ReadCallback(vec3) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1) { return NULL; } @@ -424,10 +424,10 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj return NULL; } - if ( BaseMath_ReadCallback(line_a1) == -1 || - BaseMath_ReadCallback(line_a2) == -1 || - BaseMath_ReadCallback(line_b1) == -1 || - BaseMath_ReadCallback(line_b2) == -1) + if ( BaseMath_ReadCallback(line_a1) == -1 || + BaseMath_ReadCallback(line_a2) == -1 || + BaseMath_ReadCallback(line_b1) == -1 || + BaseMath_ReadCallback(line_b2) == -1) { return NULL; } @@ -474,10 +474,10 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || - BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(plane_co) == -1 || - BaseMath_ReadCallback(plane_no) == -1) + if ( BaseMath_ReadCallback(line_a) == -1 || + BaseMath_ReadCallback(line_b) == -1 || + BaseMath_ReadCallback(plane_co) == -1 || + BaseMath_ReadCallback(plane_no) == -1) { return NULL; } @@ -530,10 +530,10 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje return NULL; } - if ( BaseMath_ReadCallback(plane_a_co) == -1 || - BaseMath_ReadCallback(plane_a_no) == -1 || - BaseMath_ReadCallback(plane_b_co) == -1 || - BaseMath_ReadCallback(plane_b_no) == -1) + if ( BaseMath_ReadCallback(plane_a_co) == -1 || + BaseMath_ReadCallback(plane_a_no) == -1 || + BaseMath_ReadCallback(plane_b_co) == -1 || + BaseMath_ReadCallback(plane_b_no) == -1) { return NULL; } @@ -592,9 +592,9 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || - BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(sphere_co) == -1) + if ( BaseMath_ReadCallback(line_a) == -1 || + BaseMath_ReadCallback(line_b) == -1 || + BaseMath_ReadCallback(sphere_co) == -1) { return NULL; } @@ -612,7 +612,7 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje PyObject *ret= PyTuple_New(2); - switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { + switch (isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: if (!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; use_b= FALSE; @@ -672,9 +672,9 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || - BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(sphere_co) == -1) + if ( BaseMath_ReadCallback(line_a) == -1 || + BaseMath_ReadCallback(line_b) == -1 || + BaseMath_ReadCallback(sphere_co) == -1) { return NULL; } @@ -685,7 +685,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO PyObject *ret= PyTuple_New(2); - switch(isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { + switch (isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: if (!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; use_b= FALSE; @@ -737,9 +737,9 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec return NULL; } - if ( BaseMath_ReadCallback(pt) == -1 || - BaseMath_ReadCallback(line_1) == -1 || - BaseMath_ReadCallback(line_2) == -1) + if ( BaseMath_ReadCallback(pt) == -1 || + BaseMath_ReadCallback(line_1) == -1 || + BaseMath_ReadCallback(line_2) == -1) { return NULL; } @@ -791,10 +791,10 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj return NULL; } - if ( BaseMath_ReadCallback(pt_vec) == -1 || - BaseMath_ReadCallback(tri_p1) == -1 || - BaseMath_ReadCallback(tri_p2) == -1 || - BaseMath_ReadCallback(tri_p3) == -1) + if ( BaseMath_ReadCallback(pt_vec) == -1 || + BaseMath_ReadCallback(tri_p1) == -1 || + BaseMath_ReadCallback(tri_p2) == -1 || + BaseMath_ReadCallback(tri_p3) == -1) { return NULL; } @@ -834,11 +834,11 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb return NULL; } - if ( BaseMath_ReadCallback(pt_vec) == -1 || - BaseMath_ReadCallback(quad_p1) == -1 || - BaseMath_ReadCallback(quad_p2) == -1 || - BaseMath_ReadCallback(quad_p3) == -1 || - BaseMath_ReadCallback(quad_p4) == -1) + if ( BaseMath_ReadCallback(pt_vec) == -1 || + BaseMath_ReadCallback(quad_p1) == -1 || + BaseMath_ReadCallback(quad_p2) == -1 || + BaseMath_ReadCallback(quad_p3) == -1 || + BaseMath_ReadCallback(quad_p4) == -1) { return NULL; } @@ -872,9 +872,9 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb return NULL; } - if ( BaseMath_ReadCallback(pt) == -1 || - BaseMath_ReadCallback(plene_co) == -1 || - BaseMath_ReadCallback(plane_no) == -1) + if ( BaseMath_ReadCallback(pt) == -1 || + BaseMath_ReadCallback(plene_co) == -1 || + BaseMath_ReadCallback(plane_no) == -1) { return NULL; } @@ -993,10 +993,10 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* return NULL; } - if ( BaseMath_ReadCallback(vec_k1) == -1 || - BaseMath_ReadCallback(vec_h1) == -1 || - BaseMath_ReadCallback(vec_k2) == -1 || - BaseMath_ReadCallback(vec_h2) == -1) + if ( BaseMath_ReadCallback(vec_k1) == -1 || + BaseMath_ReadCallback(vec_h1) == -1 || + BaseMath_ReadCallback(vec_k2) == -1 || + BaseMath_ReadCallback(vec_h2) == -1) { return NULL; } diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index 09337d9a23b..c0e8ac24baa 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -201,7 +201,7 @@ static void rand_vn(float *array_tar, const int size) { float *array_pt= array_tar + (size-1); int i= size; - while(i--) { *(array_pt--) = 2.0f * frand() - 1.0f; } + while (i--) { *(array_pt--) = 2.0f * frand() - 1.0f; } } /* Fills an array of length 3 with noise values */ |