diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-17 01:39:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-17 01:39:56 +0400 |
commit | 70d3d1aca6612d8168d80ca72938dad06086003b (patch) | |
tree | 94c48e2f9beadc22df7b74a283ce37c6a33e9458 /source/blender/python/mathutils | |
parent | 56da174b14de74ebc141b0242e1eb7ccf8058353 (diff) |
style cleanup: py/capi
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r-- | source/blender/python/mathutils/mathutils.c | 20 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils.h | 4 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Color.c | 32 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Color.h | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.c | 30 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.h | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 41 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 52 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.h | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 70 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 170 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_noise.c | 6 |
12 files changed, 215 insertions, 216 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 8e4d3955c80..2aabcaee04c 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -52,8 +52,8 @@ static int mathutils_array_parse_fast(float *array, i = size; do { i--; - if ( ((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && - PyErr_Occurred()) + if (((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && + PyErr_Occurred()) { PyErr_Format(PyExc_TypeError, "%.200s: sequence index %d expected a number, " @@ -75,10 +75,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; @@ -139,10 +139,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.h b/source/blender/python/mathutils/mathutils.h index 854cb2e962a..6fe5a0cca0e 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -67,8 +67,8 @@ typedef struct { #include "mathutils_geometry.h" #include "mathutils_noise.h" -PyObject *BaseMathObject_owner_get( BaseMathObject * self, void * ); -PyObject *BaseMathObject_is_wrapped_get( BaseMathObject *self, void * ); +PyObject *BaseMathObject_owner_get(BaseMathObject * self, void *); +PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *); int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg); int BaseMathObject_clear(BaseMathObject *self); diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index e925b115178..8cba75abd2f 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -159,21 +159,21 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op) } switch (op) { - case Py_NE: - ok = !ok; /* pass through */ - case Py_EQ: - res = ok ? Py_False : Py_True; - break; - - case Py_LT: - case Py_LE: - case Py_GT: - case Py_GE: - res = Py_NotImplemented; - break; - default: - PyErr_BadArgument(); - return NULL; + case Py_NE: + ok = !ok; /* pass through */ + case Py_EQ: + res = ok ? Py_False : Py_True; + break; + + case Py_LT: + case Py_LE: + case Py_GT: + case Py_GE: + res = Py_NotImplemented; + break; + default: + PyErr_BadArgument(); + return NULL; } return Py_INCREF(res), res; @@ -218,7 +218,7 @@ 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[attribute] = x: " diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h index cfa83a9630e..ebbcce5c663 100644 --- a/source/blender/python/mathutils/mathutils_Color.h +++ b/source/blender/python/mathutils/mathutils_Color.h @@ -48,7 +48,7 @@ typedef struct { * blender (stored in blend_data). This is an either/or struct not both*/ //prototypes -PyObject *Color_CreatePyObject( float *col, int type, PyTypeObject *base_type); +PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type); PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); #endif /* __MATHUTILS_COLOR_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 17e4115233b..4a8b97e1d2e 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -349,21 +349,21 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op) } switch (op) { - case Py_NE: - ok = !ok; /* pass through */ - case Py_EQ: - res = ok ? Py_False : Py_True; - break; - - case Py_LT: - case Py_LE: - case Py_GT: - case Py_GE: - res = Py_NotImplemented; - break; - default: - PyErr_BadArgument(); - return NULL; + case Py_NE: + ok = !ok; /* pass through */ + case Py_EQ: + res = ok ? Py_False : Py_True; + break; + + case Py_LT: + case Py_LE: + case Py_GT: + case Py_GE: + res = Py_NotImplemented; + break; + default: + PyErr_BadArgument(); + return NULL; } return Py_INCREF(res), res; diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h index d9ed86401dc..fc49c0a212a 100644 --- a/source/blender/python/mathutils/mathutils_Euler.h +++ b/source/blender/python/mathutils/mathutils_Euler.h @@ -50,7 +50,7 @@ typedef struct { * blender (stored in blend_data). This is an either/or struct not both */ //prototypes -PyObject *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type); +PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type); PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype); short euler_order_from_string(const char *str, const char *error_prefix); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 1d9bda02311..78e6138efff 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1601,28 +1601,28 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op) if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1) return NULL; - ok = ( (matA->num_row == matB->num_row) && - (matA->num_col == matB->num_col) && - EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1) - ) ? 0 : -1; + ok = ((matA->num_row == matB->num_row) && + (matA->num_col == matB->num_col) && + EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1) + ) ? 0 : -1; } switch (op) { - case Py_NE: - ok = !ok; /* pass through */ - case Py_EQ: - res = ok ? Py_False : Py_True; - break; - - case Py_LT: - case Py_LE: - case Py_GT: - case Py_GE: - res = Py_NotImplemented; - break; - default: - PyErr_BadArgument(); - return NULL; + case Py_NE: + ok = !ok; /* pass through */ + case Py_EQ: + res = ok ? Py_False : Py_True; + break; + + case Py_LT: + case Py_LE: + case Py_GT: + case Py_GE: + res = Py_NotImplemented; + break; + default: + PyErr_BadArgument(); + return NULL; } return Py_INCREF(res), res; @@ -1850,8 +1850,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) PyErr_Format(PyExc_TypeError, "Matrix subtraction: (%s - %s) " "invalid type for this operation", - Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name - ); + Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 96beccea5d3..3a8411ef223 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -527,21 +527,21 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op) } switch (op) { - case Py_NE: - ok = !ok; /* pass through */ - case Py_EQ: - res = ok ? Py_False : Py_True; - break; - - case Py_LT: - case Py_LE: - case Py_GT: - case Py_GE: - res = Py_NotImplemented; - break; - default: - PyErr_BadArgument(); - return NULL; + case Py_NE: + ok = !ok; /* pass through */ + case Py_EQ: + res = ok ? Py_False : Py_True; + break; + + case Py_LT: + case Py_LE: + case Py_GT: + case Py_GE: + res = Py_NotImplemented; + break; + default: + PyErr_BadArgument(); + return NULL; } return Py_INCREF(res), res; @@ -558,7 +558,7 @@ 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, @@ -585,7 +585,7 @@ 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, @@ -805,12 +805,12 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) return NULL; } - if (quat1 && quat2) { /* QUAT*QUAT (cross product) */ + if (quat1 && quat2) { /* QUAT * QUAT (cross product) */ mul_qt_qtqt(quat, quat1->quat, quat2->quat); return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1)); } - /* the only case this can happen (for a supported type is "FLOAT*QUAT") */ - else if (quat2) { /* FLOAT*QUAT */ + /* the only case this can happen (for a supported type is "FLOAT * QUAT") */ + else if (quat2) { /* FLOAT * QUAT */ if (((scalar = PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred()) == 0) { return quat_mul_float(quat2, scalar); } @@ -1105,17 +1105,17 @@ 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_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h index 556e6d80948..83bf053c16b 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.h +++ b/source/blender/python/mathutils/mathutils_Quaternion.h @@ -48,7 +48,7 @@ typedef struct { * blender (stored in blend_data). This is an either/or struct not both */ //prototypes -PyObject *Quaternion_CreatePyObject( float *quat, int type, PyTypeObject *base_type); +PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type); PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); #endif /* __MATHUTILS_QUATERNION_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 6d638a3b11a..73cd8d6516b 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -247,7 +247,7 @@ static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args) return NULL; } - step = (end - start)/(float)(size-1); + step = (end - start) / (float)(size - 1); vec = PyMem_Malloc(size * sizeof(float)); @@ -734,19 +734,19 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) } else if (strlen(strack) == 1) { switch (strack[0]) { - case '-': - case 'X': - track = 0; - break; - case 'Y': - track = 1; - break; - case 'Z': - track = 2; - break; - default: - PyErr_SetString(PyExc_ValueError, axis_err_msg); - return NULL; + case '-': + case 'X': + track = 0; + break; + case 'Y': + track = 1; + break; + case 'Z': + track = 2; + break; + default: + PyErr_SetString(PyExc_ValueError, axis_err_msg); + return NULL; } } else { @@ -759,18 +759,18 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) const char *axis_err_msg = "only X, Y or Z for up axis"; if (strlen(sup) == 1) { switch (*sup) { - case 'X': - up = 0; - break; - case 'Y': - up = 1; - break; - case 'Z': - up = 2; - break; - default: - PyErr_SetString(PyExc_ValueError, axis_err_msg); - return NULL; + case 'X': + up = 0; + break; + case 'Y': + up = 1; + break; + case 'Z': + up = 2; + break; + default: + PyErr_SetString(PyExc_ValueError, axis_err_msg); + return NULL; } } else { @@ -1259,10 +1259,10 @@ static int Vector_len(VectorObject *self) /* sequence accessor (get): vector[index] */ static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr) { - if (i < 0) i = self->size-i; + if (i < 0) i = self->size - i; if (i < 0 || i >= self->size) { - if (is_attr) { + if (is_attr) { PyErr_Format(PyExc_AttributeError, "Vector.%c: unavailable on %dd vector", *(((char *)"xyzw") + i), self->size); @@ -1295,7 +1295,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, return -1; } - if (i < 0) i = self->size-i; + if (i < 0) i = self->size - i; if (i < 0 || i >= self->size) { if (is_attr) { @@ -2246,9 +2246,9 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure size_from = axis_from; } - else if ( (PyErr_Clear()), /* run but ignore the result */ - (size_from = mathutils_array_parse(vec_assign, 2, 4, value, - "mathutils.Vector.**** = swizzle assignment")) == -1) + else if ((PyErr_Clear()), /* run but ignore the result */ + (size_from = mathutils_array_parse(vec_assign, 2, 4, value, + "mathutils.Vector.**** = swizzle assignment")) == -1) { return -1; } @@ -2651,11 +2651,11 @@ while len(axises) >= 2: if len(axises)>2: for axis_2 in axises: axis_2_pos = axis_pos[axis_2] - axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos) + axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS * 2)))' % (axis_0_pos, axis_1_pos, axis_2_pos) if len(axises)>3: for axis_3 in axises: axis_3_pos = axis_pos[axis_3] - axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos) + axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS * 3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos) axises = axises[:-1] @@ -2667,7 +2667,7 @@ unique = set() for key, val in items: num = eval(val) set_str = 'Vector_setSwizzle' if (len(set(key)) == len(key)) else 'NULL' - print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4-len(key))), set_str, axis_dict[key], num) + print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4 - len(key))), set_str, axis_dict[key], num) unique.add(num) if len(unique) != len(items): diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index bddd8027f93..d8e6744f92b 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; } @@ -613,17 +613,17 @@ 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)) { - 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; - break; - case 2: - if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; - if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE; - break; - default: - use_a = FALSE; - use_b = FALSE; + 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; + break; + case 2: + if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; + if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE; + break; + default: + use_a = FALSE; + use_b = FALSE; } if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); } @@ -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; } @@ -686,17 +686,17 @@ 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)) { - 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; - break; - case 2: - if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; - if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE; - break; - default: - use_a = FALSE; - use_b = FALSE; + 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; + break; + case 2: + if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; + if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE; + break; + default: + use_a = FALSE; + use_b = FALSE; } if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); } @@ -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; } @@ -923,13 +923,13 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje return NULL; } - if ( vec_pt->size != 3 || - vec_t1_src->size != 3 || - vec_t2_src->size != 3 || - vec_t3_src->size != 3 || - vec_t1_tar->size != 3 || - vec_t2_tar->size != 3 || - vec_t3_tar->size != 3) + if (vec_pt->size != 3 || + vec_t1_src->size != 3 || + vec_t2_src->size != 3 || + vec_t3_src->size != 3 || + vec_t1_tar->size != 3 || + vec_t2_tar->size != 3 || + vec_t3_tar->size != 3) { PyErr_SetString(PyExc_ValueError, "One of more of the vector arguments wasn't a 3D vector"); @@ -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 8114e32a5fb..03295ac2752 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -199,7 +199,7 @@ static float frand(void) /* Fills an array of length size with random numbers in the range (-1, 1)*/ static void rand_vn(float *array_tar, const int size) { - float *array_pt = array_tar + (size-1); + float *array_pt = array_tar + (size - 1); int i = size; while (i--) { *(array_pt--) = 2.0f * frand() - 1.0f; } } @@ -335,7 +335,7 @@ PyDoc_STRVAR(M_Noise_random_vector_doc, static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args) { float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f}; - int size= 3; + int size = 3; if (!PyArg_ParseTuple(args, "|i:random_vector", &size)) return NULL; @@ -484,7 +484,7 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg PyObject *value; float vec[3], r_vec[3]; int oct, hd, nb = 1; - float as =0.5f, fs = 2.0f; + float as = 0.5f, fs = 2.0f; if (!PyArg_ParseTuple(args, "Oii|iff:turbulence_vector", &value, &oct, &hd, &nb, &as, &fs)) return NULL; |