style cleanup: python api

This commit is contained in:
2012-03-26 06:55:09 +00:00
parent 7c8c1a0718
commit 11d12d945e
12 changed files with 1092 additions and 1092 deletions

View File

@@ -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))
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 bi = *(int *)(&bf);
int test = SIGNMASK(ai ^ bi);

View File

@@ -490,12 +490,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
ColorObject *color1 = NULL, *color2 = NULL;
float scalar;
if ColorObject_Check(v1) {
if (ColorObject_Check(v1)) {
color1 = (ColorObject *)v1;
if (BaseMath_ReadCallback(color1) == -1)
return NULL;
}
if ColorObject_Check(v2) {
if (ColorObject_Check(v2)) {
color2 = (ColorObject *)v2;
if (BaseMath_ReadCallback(color2) == -1)
return NULL;
@@ -532,7 +532,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
ColorObject *color1 = NULL;
float scalar;
if ColorObject_Check(v1) {
if (ColorObject_Check(v1)) {
color1 = (ColorObject *)v1;
if (BaseMath_ReadCallback(color1) == -1)
return NULL;

View File

@@ -612,8 +612,9 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
mat[8] = factor;
}
}
else { //scaling in arbitrary direction
//normalize arbitrary axis
else {
/* scaling in arbitrary direction
* normalize arbitrary axis */
float norm = 0.0f;
int x;
for (x = 0; x < vec_size; x++) {

View File

@@ -831,13 +831,11 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
mirror[0] = tvec[0];
mirror[1] = tvec[1];
if (value_size > 2) mirror[2] = tvec[2];
else mirror[2] = 0.0;
mirror[2] = (value_size > 2) ? tvec[2] : 0.0f;
vec[0] = self->vec[0];
vec[1] = self->vec[1];
if (self->size > 2) vec[2] = self->vec[2];
else vec[2] = 0.0;
vec[2] = (value_size > 2) ? self->vec[2] : 0.0f;
normalize_v3(mirror);
reflect_v3_v3v3(reflect, vec, mirror);
@@ -1595,12 +1593,12 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
float scalar;
int vec_size;
if VectorObject_Check(v1) {
if (VectorObject_Check(v1)) {
vec1 = (VectorObject *)v1;
if (BaseMath_ReadCallback(vec1) == -1)
return NULL;
}
if VectorObject_Check(v2) {
if (VectorObject_Check(v2)) {
vec2 = (VectorObject *)v2;
if (BaseMath_ReadCallback(vec2) == -1)
return NULL;