[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41903] trunk/blender/source/blender/ python/mathutils: formatting edits & doc correction, no functional changes.
Campbell Barton
ideasman42 at gmail.com
Wed Nov 16 04:56:38 CET 2011
Revision: 41903
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41903
Author: campbellbarton
Date: 2011-11-16 03:56:34 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
formatting edits & doc correction, no functional changes.
Modified Paths:
--------------
trunk/blender/source/blender/python/mathutils/mathutils_Color.c
trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
trunk/blender/source/blender/python/mathutils/mathutils_geometry.c
Modified: trunk/blender/source/blender/python/mathutils/mathutils_Color.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Color.c 2011-11-16 03:44:08 UTC (rev 41902)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Color.c 2011-11-16 03:56:34 UTC (rev 41903)
@@ -834,18 +834,18 @@
self= base_type ? (ColorObject *)base_type->tp_alloc(base_type, 0) :
(ColorObject *)PyObject_GC_New(ColorObject, &color_Type);
- if(self) {
+ if (self) {
/* init callbacks as NULL */
self->cb_user= NULL;
self->cb_type= self->cb_subtype= 0;
- if(type == Py_WRAP) {
+ if (type == Py_WRAP) {
self->col = col;
self->wrapped = Py_WRAP;
}
else if (type == Py_NEW) {
self->col = PyMem_Malloc(COLOR_SIZE * sizeof(float));
- if(col)
+ if (col)
copy_v3_v3(self->col, col);
else
zero_v3(self->col);
@@ -863,7 +863,7 @@
PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
{
ColorObject *self= (ColorObject *)newColorObject(NULL, Py_NEW, NULL);
- if(self) {
+ if (self) {
Py_INCREF(cb_user);
self->cb_user= cb_user;
self->cb_type= (unsigned char)cb_type;
Modified: trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c 2011-11-16 03:44:08 UTC (rev 41902)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c 2011-11-16 03:56:34 UTC (rev 41903)
@@ -941,8 +941,10 @@
int x, y, z = 0;
float det = 0.0f;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f};
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -964,9 +966,11 @@
mat[1] = -self->matrix[0][1];
mat[2] = -self->matrix[1][0];
mat[3] = self->matrix[0][0];
- } else if (self->row_size == 3) {
+ }
+ else if (self->row_size == 3) {
adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->contigPtr);
- } else if (self->row_size == 4) {
+ }
+ else if (self->row_size == 4) {
adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->contigPtr);
}
/*divide by determinate*/
@@ -1183,7 +1187,8 @@
t = self->matrix[1][0];
self->matrix[1][0] = self->matrix[0][1];
self->matrix[0][1] = t;
- } else if (self->row_size == 3) {
+ }
+ else if (self->row_size == 3) {
transpose_m3((float (*)[3])self->contigPtr);
}
else {
@@ -1253,7 +1258,8 @@
self->matrix[0][1] = 0.0f;
self->matrix[1][0] = 0.0f;
self->matrix[1][1] = 1.0f;
- } else if (self->row_size == 3) {
+ }
+ else if (self->row_size == 3) {
unit_m3((float (*)[3])self->contigPtr);
}
else {
@@ -1657,7 +1663,8 @@
if (i < 0)
i += self->row_size;
return Matrix_item(self, i);
- } else if (PySlice_Check(item)) {
+ }
+ else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx((void *)item, self->row_size, &start, &stop, &step, &slicelength) < 0)
Modified: trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c 2011-11-16 03:44:08 UTC (rev 41902)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c 2011-11-16 03:56:34 UTC (rev 41903)
@@ -639,7 +639,8 @@
if (i < 0)
i += QUAT_SIZE;
return Quaternion_item(self, i);
- } else if (PySlice_Check(item)) {
+ }
+ else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c 2011-11-16 03:44:08 UTC (rev 41902)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c 2011-11-16 03:56:34 UTC (rev 41903)
@@ -61,7 +61,7 @@
case 0:
break;
case 1:
- if((size=mathutils_array_parse(vec, 2, 4, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1)
+ if ((size=mathutils_array_parse(vec, 2, 4, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1)
return NULL;
break;
default:
@@ -77,7 +77,7 @@
{
PyObject *ret= Vector_copy(self);
PyObject *ret_dummy= vec_func(ret);
- if(ret_dummy) {
+ if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
}
@@ -97,7 +97,7 @@
{
fill_vn(self->vec, self->size, 0.0f);
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return NULL;
Py_RETURN_NONE;
@@ -119,7 +119,7 @@
int i;
float norm = 0.0f;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
for (i = 0; i < self->size; i++) {
@@ -156,13 +156,13 @@
);
static PyObject *Vector_resize_2d(VectorObject *self)
{
- if(self->wrapped==Py_WRAP) {
+ if (self->wrapped==Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_2d(): "
"cannot resize wrapped data - only python vectors");
return NULL;
}
- if(self->cb_user) {
+ if (self->cb_user) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_2d(): "
"cannot resize a vector that has an owner");
@@ -170,7 +170,7 @@
}
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2));
- if(self->vec == NULL) {
+ if (self->vec == NULL) {
PyErr_SetString(PyExc_MemoryError,
"Vector.resize_2d(): "
"problem allocating pointer space");
@@ -197,7 +197,7 @@
"cannot resize wrapped data - only python vectors");
return NULL;
}
- if(self->cb_user) {
+ if (self->cb_user) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_3d(): "
"cannot resize a vector that has an owner");
@@ -205,14 +205,14 @@
}
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3));
- if(self->vec == NULL) {
+ if (self->vec == NULL) {
PyErr_SetString(PyExc_MemoryError,
"Vector.resize_3d(): "
"problem allocating pointer space");
return NULL;
}
- if(self->size == 2)
+ if (self->size == 2)
self->vec[2] = 0.0f;
self->size = 3;
@@ -229,13 +229,13 @@
);
static PyObject *Vector_resize_4d(VectorObject *self)
{
- if(self->wrapped==Py_WRAP) {
+ if (self->wrapped==Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_4d(): "
"cannot resize wrapped data - only python vectors");
return NULL;
}
- if(self->cb_user) {
+ if (self->cb_user) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_4d(): "
"cannot resize a vector that has an owner");
@@ -243,18 +243,18 @@
}
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4));
- if(self->vec == NULL) {
+ if (self->vec == NULL) {
PyErr_SetString(PyExc_MemoryError,
"Vector.resize_4d(): "
"problem allocating pointer space");
return NULL;
}
- if(self->size == 2) {
+ if (self->size == 2) {
self->vec[2] = 0.0f;
self->vec[3] = 1.0f;
}
- else if(self->size == 3) {
+ else if (self->size == 3) {
self->vec[3] = 1.0f;
}
self->size = 4;
@@ -270,7 +270,7 @@
);
static PyObject *Vector_to_2d(VectorObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return newVectorObject(self->vec, 2, Py_NEW, Py_TYPE(self));
@@ -287,7 +287,7 @@
{
float tvec[3]= {0.0f};
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3));
@@ -305,7 +305,7 @@
{
float tvec[4]= {0.0f, 0.0f, 0.0f, 1.0f};
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 4));
@@ -330,7 +330,7 @@
ret= PyTuple_New(self->size);
- if(ndigits >= 0) {
+ if (ndigits >= 0) {
for (i = 0; i < self->size; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits)));
}
@@ -348,20 +348,20 @@
{
int ndigits= 0;
- if(!PyArg_ParseTuple(args, "|i:to_tuple", &ndigits))
+ if (!PyArg_ParseTuple(args, "|i:to_tuple", &ndigits))
return NULL;
- if(ndigits > 22 || ndigits < 0) {
+ if (ndigits > 22 || ndigits < 0) {
PyErr_SetString(PyExc_ValueError,
"Vector.to_tuple(ndigits): "
"ndigits must be between 0 and 21");
return NULL;
}
- if(PyTuple_GET_SIZE(args)==0)
+ if (PyTuple_GET_SIZE(args)==0)
ndigits= -1;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return Vector_to_tuple_ext(self, ndigits);
@@ -385,7 +385,7 @@
const char *strack, *sup;
short track = 2, up = 1;
- if(!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup))
+ if (!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup))
return NULL;
if (self->size != 3) {
@@ -395,7 +395,7 @@
return NULL;
}
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
if (strack) {
@@ -508,10 +508,10 @@
float reflect[3] = {0.0f};
float tvec[MAX_DIMENSIONS];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if((value_size= mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1)
+ if ((value_size= mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1)
return NULL;
mirror[0] = tvec[0];
@@ -547,10 +547,10 @@
VectorObject *ret;
float tvec[MAX_DIMENSIONS];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1)
return NULL;
ret= (VectorObject *)newVectorObject(NULL, 3, Py_NEW, Py_TYPE(self));
@@ -574,10 +574,10 @@
double dot = 0.0;
int x;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list