formatting edits in py api, no functional changes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user