style cleanup: python api
This commit is contained in:
@@ -242,8 +242,9 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
|
|||||||
#define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31))
|
#define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31))
|
||||||
|
|
||||||
int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
|
int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
|
||||||
{ // solid, fast routine across all platforms
|
{
|
||||||
// with constant time behavior
|
/* solid, fast routine across all platforms
|
||||||
|
* with constant time behavior */
|
||||||
int ai = *(int *)(&af);
|
int ai = *(int *)(&af);
|
||||||
int bi = *(int *)(&bf);
|
int bi = *(int *)(&bf);
|
||||||
int test = SIGNMASK(ai ^ bi);
|
int test = SIGNMASK(ai ^ bi);
|
||||||
|
|||||||
@@ -490,12 +490,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
|
|||||||
ColorObject *color1 = NULL, *color2 = NULL;
|
ColorObject *color1 = NULL, *color2 = NULL;
|
||||||
float scalar;
|
float scalar;
|
||||||
|
|
||||||
if ColorObject_Check(v1) {
|
if (ColorObject_Check(v1)) {
|
||||||
color1 = (ColorObject *)v1;
|
color1 = (ColorObject *)v1;
|
||||||
if (BaseMath_ReadCallback(color1) == -1)
|
if (BaseMath_ReadCallback(color1) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ColorObject_Check(v2) {
|
if (ColorObject_Check(v2)) {
|
||||||
color2 = (ColorObject *)v2;
|
color2 = (ColorObject *)v2;
|
||||||
if (BaseMath_ReadCallback(color2) == -1)
|
if (BaseMath_ReadCallback(color2) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -532,7 +532,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
|
|||||||
ColorObject *color1 = NULL;
|
ColorObject *color1 = NULL;
|
||||||
float scalar;
|
float scalar;
|
||||||
|
|
||||||
if ColorObject_Check(v1) {
|
if (ColorObject_Check(v1)) {
|
||||||
color1 = (ColorObject *)v1;
|
color1 = (ColorObject *)v1;
|
||||||
if (BaseMath_ReadCallback(color1) == -1)
|
if (BaseMath_ReadCallback(color1) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -612,8 +612,9 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
|
|||||||
mat[8] = factor;
|
mat[8] = factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { //scaling in arbitrary direction
|
else {
|
||||||
//normalize arbitrary axis
|
/* scaling in arbitrary direction
|
||||||
|
* normalize arbitrary axis */
|
||||||
float norm = 0.0f;
|
float norm = 0.0f;
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < vec_size; x++) {
|
for (x = 0; x < vec_size; x++) {
|
||||||
|
|||||||
@@ -831,13 +831,11 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
|
|||||||
|
|
||||||
mirror[0] = tvec[0];
|
mirror[0] = tvec[0];
|
||||||
mirror[1] = tvec[1];
|
mirror[1] = tvec[1];
|
||||||
if (value_size > 2) mirror[2] = tvec[2];
|
mirror[2] = (value_size > 2) ? tvec[2] : 0.0f;
|
||||||
else mirror[2] = 0.0;
|
|
||||||
|
|
||||||
vec[0] = self->vec[0];
|
vec[0] = self->vec[0];
|
||||||
vec[1] = self->vec[1];
|
vec[1] = self->vec[1];
|
||||||
if (self->size > 2) vec[2] = self->vec[2];
|
vec[2] = (value_size > 2) ? self->vec[2] : 0.0f;
|
||||||
else vec[2] = 0.0;
|
|
||||||
|
|
||||||
normalize_v3(mirror);
|
normalize_v3(mirror);
|
||||||
reflect_v3_v3v3(reflect, vec, mirror);
|
reflect_v3_v3v3(reflect, vec, mirror);
|
||||||
@@ -1595,12 +1593,12 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
|
|||||||
float scalar;
|
float scalar;
|
||||||
int vec_size;
|
int vec_size;
|
||||||
|
|
||||||
if VectorObject_Check(v1) {
|
if (VectorObject_Check(v1)) {
|
||||||
vec1 = (VectorObject *)v1;
|
vec1 = (VectorObject *)v1;
|
||||||
if (BaseMath_ReadCallback(vec1) == -1)
|
if (BaseMath_ReadCallback(vec1) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if VectorObject_Check(v2) {
|
if (VectorObject_Check(v2)) {
|
||||||
vec2 = (VectorObject *)v2;
|
vec2 = (VectorObject *)v2;
|
||||||
if (BaseMath_ReadCallback(vec2) == -1)
|
if (BaseMath_ReadCallback(vec2) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user