Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-17 01:39:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-17 01:39:56 +0400
commit70d3d1aca6612d8168d80ca72938dad06086003b (patch)
tree94c48e2f9beadc22df7b74a283ce37c6a33e9458 /source/blender/python
parent56da174b14de74ebc141b0242e1eb7ccf8058353 (diff)
style cleanup: py/capi
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c10
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c2
-rw-r--r--source/blender/python/generic/bgl.c234
-rw-r--r--source/blender/python/generic/bgl.h14
-rw-r--r--source/blender/python/generic/blf_py_api.c6
-rw-r--r--source/blender/python/generic/bpy_internal_import.c2
-rw-r--r--source/blender/python/generic/idprop_py_api.c425
-rw-r--r--source/blender/python/generic/py_capi_utils.c124
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c14
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/python/intern/bpy_library.c8
-rw-r--r--source/blender/python/intern/bpy_props.c24
-rw-r--r--source/blender/python/intern/bpy_rna.c235
-rw-r--r--source/blender/python/intern/bpy_rna_array.c84
-rw-r--r--source/blender/python/intern/bpy_traceback.c8
-rw-r--r--source/blender/python/intern/gpu.c26
-rw-r--r--source/blender/python/intern/gpu.h2
-rw-r--r--source/blender/python/mathutils/mathutils.c20
-rw-r--r--source/blender/python/mathutils/mathutils.h4
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c32
-rw-r--r--source/blender/python/mathutils/mathutils_Color.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c30
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c41
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c52
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c70
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c170
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c6
-rw-r--r--source/blender/python/simple_enum_gen.py4
31 files changed, 825 insertions, 834 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index d9ca997bbd5..9ef6929a8d5 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -137,11 +137,11 @@ PyObject *BPyInit_bmesh(void)
mod = PyModule_Create(&BPy_BM_module_def);
/* bmesh.types */
- PyModule_AddObject(mod, "types", (submodule=BPyInit_bmesh_types()));
+ PyModule_AddObject(mod, "types", (submodule = BPyInit_bmesh_types()));
PyDict_SetItemString(sys_modules, "bmesh.types", submodule);
Py_INCREF(submodule);
- PyModule_AddObject(mod, "utils", (submodule=BPyInit_bmesh_utils()));
+ PyModule_AddObject(mod, "utils", (submodule = BPyInit_bmesh_utils()));
PyDict_SetItemString(sys_modules, "bmesh.utils", submodule);
Py_INCREF(submodule);
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 8b3a32ea923..2628625ea7e 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -721,8 +721,8 @@ PyDoc_STRVAR(bpy_bmesh_to_mesh_doc,
);
static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
{
- PyObject *py_mesh;
- Mesh *me;
+ PyObject *py_mesh;
+ Mesh *me;
BMesh *bm;
BPY_BM_CHECK_OBJ(self);
@@ -764,8 +764,8 @@ PyDoc_STRVAR(bpy_bmesh_from_object_doc,
);
static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
{
- PyObject *py_object;
- Object *ob;
+ PyObject *py_object;
+ Object *ob;
BMesh *bm;
int apply_modifiers = TRUE;
DerivedMesh *dm;
@@ -1659,7 +1659,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
edge_array = (BMEdge **)PyMem_MALLOC(vert_seq_len * sizeof(BMEdge **));
/* ensure edges */
- for (i = vert_seq_len - 1, i_next = 0; i_next < vert_seq_len; (i=i_next++)) {
+ for (i = vert_seq_len - 1, i_next = 0; i_next < vert_seq_len; (i = i_next++)) {
edge_array[i] = BM_edge_create(bm, vert_array[i], vert_array[i_next], NULL, TRUE);
}
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index a44cc78088d..01a91d1cafc 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -244,7 +244,7 @@ PyDoc_STRVAR(bpy_bmlayercollection_get_doc,
static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject *args)
{
const char *key;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
BPY_BM_CHECK_OBJ(self);
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index e32444976dd..48052febfb7 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -80,10 +80,10 @@ static PyObject *Buffer_repr(Buffer *self);
static PyObject *Buffer_to_list(Buffer *self)
{
- int i, len= self->dimensions[0];
- PyObject *list= PyList_New(len);
+ int i, len = self->dimensions[0];
+ PyObject *list = PyList_New(len);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
PyList_SET_ITEM(list, i, Buffer_item(self, i));
}
@@ -95,17 +95,17 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
PyObject *list;
if (self->ndimensions > 1) {
- int i, len= self->dimensions[0];
- list= PyList_New(len);
+ int i, len = self->dimensions[0];
+ list = PyList_New(len);
- for (i=0; i<len; i++) {
- Buffer *sub= (Buffer *)Buffer_item(self, i);
+ for (i = 0; i < len; i++) {
+ Buffer *sub = (Buffer *)Buffer_item(self, i);
PyList_SET_ITEM(list, i, Buffer_to_list_recursive(sub));
Py_DECREF(sub);
}
}
else {
- list= Buffer_to_list(self);
+ list = Buffer_to_list(self);
}
return list;
@@ -113,10 +113,10 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
{
- PyObject *list= PyList_New(self->ndimensions);
+ PyObject *list = PyList_New(self->ndimensions);
int i;
- for (i= 0; i<self->ndimensions; i++) {
+ for (i = 0; i < self->ndimensions; i++) {
PyList_SET_ITEM(list, i, PyLong_FromLong(self->dimensions[i]));
}
@@ -239,16 +239,16 @@ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) \
int BGL_typeSize(int type)
{
switch (type) {
- case GL_BYTE:
- return sizeof(char);
- case GL_SHORT:
- return sizeof(short);
- case GL_INT:
- return sizeof(int);
- case GL_FLOAT:
- return sizeof(float);
- case GL_DOUBLE:
- return sizeof(double);
+ case GL_BYTE:
+ return sizeof(char);
+ case GL_SHORT:
+ return sizeof(short);
+ case GL_INT:
+ return sizeof(int);
+ case GL_FLOAT:
+ return sizeof(float);
+ case GL_DOUBLE:
+ return sizeof(double);
}
return -1;
}
@@ -256,30 +256,31 @@ int BGL_typeSize(int type)
Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer)
{
Buffer *buffer;
- void *buf= NULL;
+ void *buf = NULL;
int i, size, length;
-
- length= 1;
- for (i=0; i<ndimensions; i++)
- length*= dimensions[i];
-
- size= BGL_typeSize(type);
-
- buf= MEM_mallocN(length*size, "Buffer buffer");
-
- buffer= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
- buffer->parent= NULL;
- buffer->ndimensions= ndimensions;
- buffer->dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
- memcpy(buffer->dimensions, dimensions, ndimensions*sizeof(int));
- buffer->type= type;
- buffer->buf.asvoid= buf;
+
+ length = 1;
+ for (i = 0; i < ndimensions; i++) {
+ length *= dimensions[i];
+ }
+
+ size = BGL_typeSize(type);
+
+ buf = MEM_mallocN(length * size, "Buffer buffer");
+
+ buffer = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
+ buffer->parent = NULL;
+ buffer->ndimensions = ndimensions;
+ buffer->dimensions = MEM_mallocN(ndimensions * sizeof(int), "Buffer dimensions");
+ memcpy(buffer->dimensions, dimensions, ndimensions * sizeof(int));
+ buffer->type = type;
+ buffer->buf.asvoid = buf;
if (initbuffer) {
- memcpy(buffer->buf.asvoid, initbuffer, length*size);
+ memcpy(buffer->buf.asvoid, initbuffer, length * size);
}
else {
- memset(buffer->buf.asvoid, 0, length*size);
+ memset(buffer->buf.asvoid, 0, length * size);
}
return buffer;
}
@@ -288,10 +289,10 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf
#define MAX_DIMENSIONS 256
static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
- PyObject *length_ob= NULL, *init= NULL;
+ PyObject *length_ob = NULL, *init = NULL;
Buffer *buffer;
int dimensions[MAX_DIMENSIONS];
-
+
int type;
Py_ssize_t i, ndimensions = 0;
@@ -312,15 +313,15 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
}
if (PyLong_Check(length_ob)) {
- ndimensions= 1;
- if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
+ ndimensions = 1;
+ if (((dimensions[0] = PyLong_AsLong(length_ob)) < 1)) {
PyErr_SetString(PyExc_AttributeError,
"dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
return NULL;
}
}
else if (PySequence_Check(length_ob)) {
- ndimensions= PySequence_Size(length_ob);
+ ndimensions = PySequence_Size(length_ob);
if (ndimensions > MAX_DIMENSIONS) {
PyErr_SetString(PyExc_AttributeError,
"too many dimensions, max is "STRINGIFY(MAX_DIMENSIONS));
@@ -331,11 +332,13 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
"sequence must have at least one dimension");
return NULL;
}
- for (i=0; i<ndimensions; i++) {
- PyObject *ob= PySequence_GetItem(length_ob, i);
+ for (i = 0; i < ndimensions; i++) {
+ PyObject *ob = PySequence_GetItem(length_ob, i);
- if (!PyLong_Check(ob)) dimensions[i]= 1;
- else dimensions[i]= PyLong_AsLong(ob);
+ if (!PyLong_Check(ob))
+ dimensions[i] = 1;
+ else
+ dimensions[i] = PyLong_AsLong(ob);
Py_DECREF(ob);
if (dimensions[i] < 1) {
@@ -351,16 +354,16 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
"or an int, not a %.200s", Py_TYPE(length_ob)->tp_name);
return NULL;
}
-
- buffer= BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
+
+ buffer = BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
if (init && ndimensions) {
if (Buffer_ass_slice(buffer, 0, dimensions[0], init)) {
Py_DECREF(buffer);
return NULL;
}
}
-
- return (PyObject *) buffer;
+
+ return (PyObject *)buffer;
}
/*@ Buffer sequence methods */
@@ -377,12 +380,12 @@ static PyObject *Buffer_item(Buffer *self, int i)
return NULL;
}
- if (self->ndimensions==1) {
+ if (self->ndimensions == 1) {
switch (self->type) {
- case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]);
- case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]);
- case GL_INT: return Py_BuildValue("i", self->buf.asint[i]);
- case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]);
+ case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]);
+ case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]);
+ case GL_INT: return Py_BuildValue("i", self->buf.asint[i]);
+ case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]);
case GL_DOUBLE: return Py_BuildValue("d", self->buf.asdouble[i]);
}
}
@@ -390,26 +393,24 @@ static PyObject *Buffer_item(Buffer *self, int i)
Buffer *newbuf;
int j, length, size;
- length= 1;
- for (j=1; j < self->ndimensions; j++) {
+ length = 1;
+ for (j = 1; j < self->ndimensions; j++) {
length *= self->dimensions[j];
}
- size= BGL_typeSize(self->type);
+ size = BGL_typeSize(self->type);
- newbuf= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
+ newbuf = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
Py_INCREF(self);
- newbuf->parent= (PyObject *)self;
+ newbuf->parent = (PyObject *)self;
- newbuf->ndimensions= self->ndimensions - 1;
- newbuf->type= self->type;
- newbuf->buf.asvoid= self->buf.asbyte + i*length*size;
- newbuf->dimensions= MEM_mallocN(newbuf->ndimensions*sizeof(int),
- "Buffer dimensions");
- memcpy(newbuf->dimensions, self->dimensions+1,
- newbuf->ndimensions*sizeof(int));
+ newbuf->ndimensions = self->ndimensions - 1;
+ newbuf->type = self->type;
+ newbuf->buf.asvoid = self->buf.asbyte + i * length * size;
+ newbuf->dimensions = MEM_mallocN(newbuf->ndimensions * sizeof(int), "Buffer dimensions");
+ memcpy(newbuf->dimensions, self->dimensions + 1, newbuf->ndimensions * sizeof(int));
- return (PyObject *) newbuf;
+ return (PyObject *)newbuf;
}
return NULL;
@@ -420,13 +421,13 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
PyObject *list;
int count;
- if (begin < 0) begin= 0;
- if (end > self->dimensions[0]) end= self->dimensions[0];
- if (begin > end) begin= end;
+ if (begin < 0) begin = 0;
+ if (end > self->dimensions[0]) end = self->dimensions[0];
+ if (begin > end) begin = end;
- list= PyList_New(end-begin);
+ list = PyList_New(end - begin);
- for (count= begin; count<end; count++) {
+ for (count = begin; count < end; count++) {
PyList_SET_ITEM(list, count-begin, Buffer_item(self, count));
}
return list;
@@ -440,11 +441,11 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
return -1;
}
- if (self->ndimensions!=1) {
- Buffer *row= (Buffer *)Buffer_item(self, i);
+ if (self->ndimensions != 1) {
+ Buffer *row = (Buffer *)Buffer_item(self, i);
if (row) {
- int ret= Buffer_ass_slice(row, 0, self->dimensions[1], v);
+ int ret = Buffer_ass_slice(row, 0, self->dimensions[1], v);
Py_DECREF(row);
return ret;
}
@@ -454,29 +455,23 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
}
switch (self->type) {
- case GL_BYTE:
- return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1;
- case GL_SHORT:
- return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0:-1;
- case GL_INT:
- return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0:-1;
- case GL_FLOAT:
- return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0:-1;
- case GL_DOUBLE:
- return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0:-1;
- default:
- return 0; /* should never happen */
+ case GL_BYTE: return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0 : -1;
+ case GL_SHORT: return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0 : -1;
+ case GL_INT: return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0 : -1;
+ case GL_FLOAT: return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0 : -1;
+ case GL_DOUBLE: return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0 : -1;
+ default: return 0; /* should never happen */
}
}
static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
{
PyObject *item;
- int count, err=0;
+ int count, err = 0;
- if (begin < 0) begin= 0;
- if (end > self->dimensions[0]) end= self->dimensions[0];
- if (begin > end) begin= end;
+ if (begin < 0) begin = 0;
+ if (end > self->dimensions[0]) end = self->dimensions[0];
+ if (begin > end) begin = end;
if (!PySequence_Check(seq)) {
PyErr_Format(PyExc_TypeError,
@@ -487,23 +482,25 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
}
/* re-use count var */
- if ((count= PySequence_Size(seq)) != (end - begin)) {
+ if ((count = PySequence_Size(seq)) != (end - begin)) {
PyErr_Format(PyExc_TypeError,
"buffer[:] = value, size mismatch in assignment. "
"Expected: %d (given: %d)", count, end - begin);
return -1;
}
- for (count= begin; count < end; count++) {
- item= PySequence_GetItem(seq, count - begin);
+ for (count = begin; count < end; count++) {
+ item = PySequence_GetItem(seq, count - begin);
if (item) {
- err= Buffer_ass_item(self, count, item);
+ err = Buffer_ass_item(self, count, item);
Py_DECREF(item);
}
else {
- err= -1;
+ err = -1;
+ }
+ if (err) {
+ break;
}
- if (err) break;
}
return err;
}
@@ -580,8 +577,12 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
static void Buffer_dealloc(Buffer *self)
{
- if (self->parent) Py_DECREF(self->parent);
- else MEM_freeN (self->buf.asvoid);
+ if (self->parent) {
+ Py_DECREF(self->parent);
+ }
+ else {
+ MEM_freeN(self->buf.asvoid);
+ }
MEM_freeN(self->dimensions);
@@ -591,19 +592,20 @@ static void Buffer_dealloc(Buffer *self)
static PyObject *Buffer_repr(Buffer *self)
{
- PyObject *list= Buffer_to_list_recursive(self);
+ PyObject *list = Buffer_to_list_recursive(self);
PyObject *repr;
- const char *typestr= "UNKNOWN";
+ const char *typestr;
switch (self->type) {
- case GL_BYTE: typestr= "GL_BYTE"; break;
- case GL_SHORT: typestr= "GL_SHORT"; break;
- case GL_INT: typestr= "GL_BYTE"; break;
- case GL_FLOAT: typestr= "GL_FLOAT"; break;
- case GL_DOUBLE: typestr= "GL_DOUBLE"; break;
+ case GL_BYTE: typestr = "GL_BYTE"; break;
+ case GL_SHORT: typestr = "GL_SHORT"; break;
+ case GL_INT: typestr = "GL_BYTE"; break;
+ case GL_FLOAT: typestr = "GL_FLOAT"; break;
+ case GL_DOUBLE: typestr = "GL_DOUBLE"; break;
+ default: typestr = "UNKNOWN"; break;
}
- repr= PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
+ repr = PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
Py_DECREF(list);
return repr;
@@ -1296,21 +1298,20 @@ static struct PyModuleDef BGL_module_def = {
PyObject *BPyInit_bgl(void)
{
PyObject *submodule, *dict, *item;
- submodule= PyModule_Create(&BGL_module_def);
- dict= PyModule_GetDict(submodule);
-
+ submodule = PyModule_Create(&BGL_module_def);
+ dict = PyModule_GetDict(submodule);
+
if (PyType_Ready(&BGL_bufferType) < 0)
return NULL; /* should never happen */
-
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
Py_INCREF((PyObject *)&BGL_bufferType);
-#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)
+#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item = PyLong_FromLong((int)x)); Py_DECREF(item)
/* So, for example:
* EXPP_ADDCONST(GL_CURRENT_BIT) becomes
- * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item=PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
+ * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item = PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
EXPP_ADDCONST(GL_CURRENT_BIT);
EXPP_ADDCONST(GL_POINT_BIT);
@@ -1795,4 +1796,3 @@ PyObject *BPyInit_bgl(void)
return submodule;
}
-
diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h
index 9df08882b8a..daebd7a5194 100644
--- a/source/blender/python/generic/bgl.h
+++ b/source/blender/python/generic/bgl.h
@@ -44,10 +44,10 @@ PyObject *BPyInit_bgl(void);
/*@ Create a buffer object */
/*@ dimensions is an array of ndimensions integers representing the size of each dimension */
/*@ initbuffer if not NULL holds a contiguous buffer with the correct format from which the buffer will be initialized */
-struct _Buffer *BGL_MakeBuffer( int type, int ndimensions, int *dimensions, void *initbuffer );
+struct _Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer);
/*@ Return the size of buffer element, type must be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE */
/*@ returns -1 otherwise */
-int BGL_typeSize( int type );
+int BGL_typeSize(int type);
/*@ Buffer Object */
/*@ For Python access to OpenGL functions requiring a pointer. */
@@ -312,23 +312,23 @@ extern PyTypeObject BGL_bufferType;
#define ret_ret_void return Py_INCREF(Py_None), Py_None
#define ret_def_GLint int ret_int
-#define ret_set_GLint ret_int=
+#define ret_set_GLint ret_int =
#define ret_ret_GLint return PyLong_FromLong(ret_int)
#define ret_def_GLuint unsigned int ret_uint
-#define ret_set_GLuint ret_uint=
+#define ret_set_GLuint ret_uint =
#define ret_ret_GLuint return PyLong_FromLong((long) ret_uint)
#define ret_def_GLenum unsigned int ret_uint
-#define ret_set_GLenum ret_uint=
+#define ret_set_GLenum ret_uint =
#define ret_ret_GLenum return PyLong_FromLong((long) ret_uint)
#define ret_def_GLboolean unsigned char ret_bool
-#define ret_set_GLboolean ret_bool=
+#define ret_set_GLboolean ret_bool =
#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool)
#define ret_def_GLstring const unsigned char *ret_str;
-#define ret_set_GLstring ret_str=
+#define ret_set_GLstring ret_str =
#define ret_ret_GLstring \
if (ret_str) { \
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index a4373e46e23..5b5438defee 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -182,7 +182,7 @@ static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
BLF_width_and_height(fontid, text, &r_width, &r_height);
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(r_width));
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(r_height));
return ret;
@@ -356,7 +356,7 @@ PyDoc_STRVAR(py_blf_load_doc,
);
static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
{
- char* filename;
+ char *filename;
if (!PyArg_ParseTuple(args, "s:blf.load", &filename))
return NULL;
@@ -374,7 +374,7 @@ PyDoc_STRVAR(py_blf_unload_doc,
);
static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args)
{
- char* filename;
+ char *filename;
if (!PyArg_ParseTuple(args, "s:blf.unload", &filename))
return NULL;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 36308cdc3e5..4ce68f108f6 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -101,7 +101,7 @@ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
PyObject *bpy_text_import(Text *text)
{
char *buf = NULL;
- char modulename[MAX_ID_NAME+2];
+ char modulename[MAX_ID_NAME + 2];
int len;
if (!text->compiled) {
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 33c5d3bd06d..b9785fc375c 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -74,21 +74,21 @@ static PyObject *idprop_py_from_idp_int(IDProperty *prop)
static PyObject *idprop_py_from_idp_float(IDProperty *prop)
{
- return PyFloat_FromDouble((double)(*(float*)(&prop->data.val)));
+ return PyFloat_FromDouble((double)(*(float *)(&prop->data.val)));
}
static PyObject *idprop_py_from_idp_double(IDProperty *prop)
{
- return PyFloat_FromDouble((*(double*)(&prop->data.val)));
+ return PyFloat_FromDouble((*(double *)(&prop->data.val)));
}
static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *parent)
{
- BPy_IDProperty *group= PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
+ BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
group->id = id;
group->prop = prop;
group->parent = parent; /* can be NULL */
- return (PyObject*) group;
+ return (PyObject*)group;
}
static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
@@ -96,13 +96,13 @@ static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type);
array->id = id;
array->prop = prop;
- return (PyObject*) array;
+ return (PyObject*)array;
}
static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
{
PyObject *seq = PyList_New(prop->len), *wrap;
- IDProperty *array= IDP_IDPArray(prop);
+ IDProperty *array = IDP_IDPArray(prop);
int i;
if (!seq) {
@@ -112,8 +112,8 @@ static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
return NULL;
}
- for (i=0; i<prop->len; i++) {
- wrap= BPy_IDGroup_WrapData(id, array++, prop);
+ for (i = 0; i < prop->len; i++) {
+ wrap = BPy_IDGroup_WrapData(id, array++, prop);
if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
return NULL;
@@ -134,28 +134,20 @@ static Py_hash_t BPy_IDGroup_hash(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_repr(BPy_IDProperty *self)
{
- return PyUnicode_FromFormat( "<bpy id property from \"%s\">", self->id->name);
+ return PyUnicode_FromFormat("<bpy id property from \"%s\">", self->id->name);
}
PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
{
switch (prop->type) {
- case IDP_STRING:
- return idprop_py_from_idp_string(prop);
- case IDP_INT:
- return idprop_py_from_idp_int(prop);
- case IDP_FLOAT:
- return idprop_py_from_idp_float(prop);
- case IDP_DOUBLE:
- return idprop_py_from_idp_double(prop);
- case IDP_GROUP:
- return idprop_py_from_idp_group(id, prop, parent);
- case IDP_ARRAY:
- return idprop_py_from_idp_array(id, prop);
- case IDP_IDPARRAY: /* this could be better a internal type */
- return idprop_py_from_idp_idparray(id, prop);
- default:
- Py_RETURN_NONE;
+ case IDP_STRING: return idprop_py_from_idp_string(prop);
+ case IDP_INT: return idprop_py_from_idp_int(prop);
+ case IDP_FLOAT: return idprop_py_from_idp_float(prop);
+ case IDP_DOUBLE: return idprop_py_from_idp_double(prop);
+ case IDP_GROUP: return idprop_py_from_idp_group(id, prop, parent);
+ case IDP_ARRAY: return idprop_py_from_idp_array(id, prop);
+ case IDP_IDPARRAY: return idprop_py_from_idp_idparray(id, prop); /* this could be better a internal type */
+ default: Py_RETURN_NONE;
}
}
@@ -174,10 +166,10 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
#ifdef USE_STRING_COERCE
{
int alloc_len;
- PyObject *value_coerce= NULL;
+ PyObject *value_coerce = NULL;
- st= (char *)PyC_UnicodeAsByte(value, &value_coerce);
- alloc_len= strlen(st) + 1;
+ st = (char *)PyC_UnicodeAsByte(value, &value_coerce);
+ alloc_len = strlen(st) + 1;
st = _PyUnicode_AsString(value);
IDP_ResizeArray(prop, alloc_len);
@@ -195,8 +187,8 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
case IDP_INT:
{
- int ivalue= PyLong_AsSsize_t(value);
- if (ivalue==-1 && PyErr_Occurred()) {
+ int ivalue = PyLong_AsSsize_t(value);
+ if (ivalue == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
}
@@ -205,22 +197,22 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
}
case IDP_FLOAT:
{
- float fvalue= (float)PyFloat_AsDouble(value);
- if (fvalue==-1 && PyErr_Occurred()) {
+ float fvalue = (float)PyFloat_AsDouble(value);
+ if (fvalue == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- *(float*)&self->prop->data.val = fvalue;
+ *(float *)&self->prop->data.val = fvalue;
break;
}
case IDP_DOUBLE:
{
- double dvalue= PyFloat_AsDouble(value);
- if (dvalue==-1 && PyErr_Occurred()) {
+ double dvalue = PyFloat_AsDouble(value);
+ if (dvalue == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- *(double*)&self->prop->data.val = dvalue;
+ *(double *)&self->prop->data.val = dvalue;
break;
}
default:
@@ -289,16 +281,16 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
return NULL;
}
- name= _PyUnicode_AsString(item);
+ name = _PyUnicode_AsString(item);
if (name == NULL) {
PyErr_SetString(PyExc_TypeError, "only strings are allowed as keys of ID properties");
return NULL;
}
- idprop= IDP_GetPropertyFromGroup(self->prop, name);
+ idprop = IDP_GetPropertyFromGroup(self->prop, name);
- if (idprop==NULL) {
+ if (idprop == NULL) {
PyErr_SetString(PyExc_KeyError, "key not in subgroup dict");
return NULL;
}
@@ -306,21 +298,21 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
return BPy_IDGroup_WrapData(self->id, idprop, self->prop);
}
-/*returns NULL on success, error string on failure*/
+/* returns NULL on success, error string on failure */
static int idp_sequence_type(PyObject *seq)
{
PyObject *item;
- int type= IDP_INT;
+ int type = IDP_INT;
Py_ssize_t i, len = PySequence_Size(seq);
- for (i=0; i < len; i++) {
+ for (i = 0; i < len; i++) {
item = PySequence_GetItem(seq, i);
if (PyFloat_Check(item)) {
if (type == IDP_IDPARRAY) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
- type= IDP_DOUBLE;
+ type = IDP_DOUBLE;
}
else if (PyLong_Check(item)) {
if (type == IDP_IDPARRAY) { /* mixed dict/int */
@@ -333,7 +325,7 @@ static int idp_sequence_type(PyObject *seq)
Py_DECREF(item);
return -1;
}
- type= IDP_IDPARRAY;
+ type = IDP_IDPARRAY;
}
else {
Py_XDECREF(item);
@@ -353,7 +345,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
IDProperty *prop = NULL;
IDPropertyTemplate val = {0};
- const char *name= "";
+ const char *name = "";
if (name_obj) {
Py_ssize_t name_size;
@@ -373,7 +365,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
}
else if (PyUnicode_Check(ob)) {
#ifdef USE_STRING_COERCE
- PyObject *value_coerce= NULL;
+ PyObject *value_coerce = NULL;
val.string.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce);
val.string.subtype = IDP_STRING_SUB_UTF8;
prop = IDP_New(IDP_STRING, &val, name);
@@ -384,19 +376,19 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
#endif
}
else if (PyBytes_Check(ob)) {
- val.string.str= PyBytes_AS_STRING(ob);
- val.string.len= PyBytes_GET_SIZE(ob);
- val.string.subtype= IDP_STRING_SUB_BYTE;
+ val.string.str = PyBytes_AS_STRING(ob);
+ val.string.len = PyBytes_GET_SIZE(ob);
+ val.string.subtype = IDP_STRING_SUB_BYTE;
prop = IDP_New(IDP_STRING, &val, name);
//prop = IDP_NewString(PyBytes_AS_STRING(ob), name, PyBytes_GET_SIZE(ob));
- //prop->subtype= IDP_STRING_SUB_BYTE;
+ //prop->subtype = IDP_STRING_SUB_BYTE;
}
else if (PySequence_Check(ob)) {
PyObject *item;
int i;
- if ((val.array.type= idp_sequence_type(ob)) == -1)
+ if ((val.array.type = idp_sequence_type(ob)) == -1)
return "only floats, ints and dicts are allowed in ID property arrays";
/* validate sequence and derive type.
@@ -406,34 +398,34 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
val.array.len = PySequence_Size(ob);
switch (val.array.type) {
- case IDP_DOUBLE:
- prop = IDP_New(IDP_ARRAY, &val, name);
- for (i=0; i<val.array.len; i++) {
- item = PySequence_GetItem(ob, i);
- ((double*)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
- Py_DECREF(item);
- }
- break;
- case IDP_INT:
- prop = IDP_New(IDP_ARRAY, &val, name);
- for (i=0; i<val.array.len; i++) {
- item = PySequence_GetItem(ob, i);
- ((int*)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
- Py_DECREF(item);
- }
- break;
- case IDP_IDPARRAY:
- prop= IDP_NewIDPArray(name);
- for (i=0; i<val.array.len; i++) {
- const char *error;
- item = PySequence_GetItem(ob, i);
- error= BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
- Py_DECREF(item);
-
- if (error)
- return error;
- }
- break;
+ case IDP_DOUBLE:
+ prop = IDP_New(IDP_ARRAY, &val, name);
+ for (i = 0; i < val.array.len; i++) {
+ item = PySequence_GetItem(ob, i);
+ ((double *)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
+ Py_DECREF(item);
+ }
+ break;
+ case IDP_INT:
+ prop = IDP_New(IDP_ARRAY, &val, name);
+ for (i = 0; i < val.array.len; i++) {
+ item = PySequence_GetItem(ob, i);
+ ((int *)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
+ Py_DECREF(item);
+ }
+ break;
+ case IDP_IDPARRAY:
+ prop = IDP_NewIDPArray(name);
+ for (i = 0; i < val.array.len; i++) {
+ const char *error;
+ item = PySequence_GetItem(ob, i);
+ error = BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
+ Py_DECREF(item);
+
+ if (error)
+ return error;
+ }
+ break;
}
}
else if (PyMapping_Check(ob)) {
@@ -447,7 +439,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
* we can delete it easily enough.*/
prop = IDP_New(IDP_GROUP, &val, name);
len = PyMapping_Length(ob);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
key = PySequence_GetItem(keys, i);
pval = PySequence_GetItem(vals, i);
if (!PyUnicode_Check(key)) {
@@ -476,7 +468,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
}
else return "invalid property value";
- if (group->type==IDP_IDPARRAY) {
+ if (group->type == IDP_IDPARRAY) {
IDP_AppendArray(group, prop);
// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
MEM_freeN(prop);
@@ -518,7 +510,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
err = BPy_IDProperty_Map_ValidateAndCreate(key, prop, val);
if (err) {
- PyErr_SetString(PyExc_KeyError, err );
+ PyErr_SetString(PyExc_KeyError, err);
return -1;
}
@@ -538,107 +530,107 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
iter->mode = IDPROP_ITER_KEYS;
iter->cur = self->prop->data.group.first;
Py_XINCREF(iter);
- return (PyObject*) iter;
+ return (PyObject*)iter;
}
/* for simple, non nested types this is the same as BPy_IDGroup_WrapData */
static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
- case IDP_STRING:
- return idprop_py_from_idp_string(prop);
- case IDP_INT:
- return idprop_py_from_idp_int(prop);
- case IDP_FLOAT:
- return idprop_py_from_idp_float(prop);
- case IDP_DOUBLE:
- return idprop_py_from_idp_double(prop);
- case IDP_ARRAY:
- {
- PyObject *seq = PyList_New(prop->len);
- int i;
-
- if (!seq) {
- PyErr_Format(PyExc_RuntimeError,
- "%s: IDP_ARRAY: PyList_New(%d) failed",
- __func__, prop->len);
- return NULL;
- }
-
- switch (prop->subtype) {
+ case IDP_STRING:
+ return idprop_py_from_idp_string(prop);
+ case IDP_INT:
+ return idprop_py_from_idp_int(prop);
case IDP_FLOAT:
- {
- float *array= (float*)IDP_Array(prop);
- for (i=0; i<prop->len; i++) {
- PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
- }
- break;
- }
+ return idprop_py_from_idp_float(prop);
case IDP_DOUBLE:
+ return idprop_py_from_idp_double(prop);
+ case IDP_ARRAY:
{
- double *array= (double*)IDP_Array(prop);
- for (i=0; i<prop->len; i++) {
- PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
- }
- break;
- }
- case IDP_INT:
- {
- int *array= (int*)IDP_Array(prop);
- for (i=0; i<prop->len; i++) {
- PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+ PyObject *seq = PyList_New(prop->len);
+ int i;
+
+ if (!seq) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s: IDP_ARRAY: PyList_New(%d) failed",
+ __func__, prop->len);
+ return NULL;
}
- break;
- }
- default:
- PyErr_Format(PyExc_RuntimeError,
- "%s: invalid/corrupt array type '%d'!",
- __func__, prop->subtype);
- Py_DECREF(seq);
- return NULL;
- }
- return seq;
- }
- case IDP_IDPARRAY:
- {
- PyObject *seq = PyList_New(prop->len), *wrap;
- IDProperty *array= IDP_IDPArray(prop);
- int i;
+ switch (prop->subtype) {
+ case IDP_FLOAT:
+ {
+ float *array = (float *)IDP_Array(prop);
+ for (i = 0; i < prop->len; i++) {
+ PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+ }
+ break;
+ }
+ case IDP_DOUBLE:
+ {
+ double *array = (double *)IDP_Array(prop);
+ for (i = 0; i < prop->len; i++) {
+ PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+ }
+ break;
+ }
+ case IDP_INT:
+ {
+ int *array = (int *)IDP_Array(prop);
+ for (i = 0; i < prop->len; i++) {
+ PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+ }
+ break;
+ }
+ default:
+ PyErr_Format(PyExc_RuntimeError,
+ "%s: invalid/corrupt array type '%d'!",
+ __func__, prop->subtype);
+ Py_DECREF(seq);
+ return NULL;
+ }
- if (!seq) {
- PyErr_Format(PyExc_RuntimeError,
- "%s: IDP_IDPARRAY: PyList_New(%d) failed",
- __func__, prop->len);
- return NULL;
+ return seq;
}
+ case IDP_IDPARRAY:
+ {
+ PyObject *seq = PyList_New(prop->len), *wrap;
+ IDProperty *array = IDP_IDPArray(prop);
+ int i;
+
+ if (!seq) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s: IDP_IDPARRAY: PyList_New(%d) failed",
+ __func__, prop->len);
+ return NULL;
+ }
- for (i=0; i<prop->len; i++) {
- wrap= BPy_IDGroup_MapDataToPy(array++);
+ for (i = 0; i < prop->len; i++) {
+ wrap = BPy_IDGroup_MapDataToPy(array++);
- if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
- return NULL;
+ if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
+ return NULL;
- PyList_SET_ITEM(seq, i, wrap);
+ PyList_SET_ITEM(seq, i, wrap);
+ }
+ return seq;
}
- return seq;
- }
- case IDP_GROUP:
- {
- PyObject *dict = PyDict_New(), *wrap;
- IDProperty *loop;
+ case IDP_GROUP:
+ {
+ PyObject *dict = PyDict_New(), *wrap;
+ IDProperty *loop;
- for (loop=prop->data.group.first; loop; loop=loop->next) {
- wrap = BPy_IDGroup_MapDataToPy(loop);
+ for (loop = prop->data.group.first; loop; loop = loop->next) {
+ wrap = BPy_IDGroup_MapDataToPy(loop);
- if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
- return NULL;
+ if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
+ return NULL;
- PyDict_SetItemString(dict, loop->name, wrap);
- Py_DECREF(wrap);
+ PyDict_SetItemString(dict, loop->name, wrap);
+ Py_DECREF(wrap);
+ }
+ return dict;
}
- return dict;
- }
}
PyErr_Format(PyExc_RuntimeError,
@@ -660,7 +652,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
return NULL;
}
- idprop= IDP_GetPropertyFromGroup(self->prop, name);
+ idprop = IDP_GetPropertyFromGroup(self->prop, name);
if (idprop) {
pyform = BPy_IDGroup_MapDataToPy(idprop);
@@ -687,7 +679,7 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
iter->mode = IDPROP_ITER_ITEMS;
iter->cur = self->prop->data.group.first;
Py_XINCREF(iter);
- return (PyObject*) iter;
+ return (PyObject*)iter;
}
/* utility function */
@@ -698,7 +690,7 @@ static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len,
printf("%s: ID Property Error found and corrected!\n", func);
/*fill rest of list with valid references to None*/
- for (j=len; j<prop->len; j++) {
+ for (j = len; j < prop->len; j++) {
Py_INCREF(Py_None);
PyList_SET_ITEM(seq, j, Py_None);
}
@@ -713,11 +705,13 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
IDProperty *loop;
int i;
- for (i=0, loop=prop->data.group.first; loop && (i < prop->len); loop=loop->next, i++)
+ for (i = 0, loop = prop->data.group.first; loop && (i < prop->len); loop = loop->next, i++)
PyList_SET_ITEM(list, i, PyUnicode_FromString(loop->name));
/* if the id prop is corrupt, count the remaining */
- for (; loop; loop=loop->next, i++) {}
+ for ( ; loop; loop = loop->next, i++) {
+ /* pass */
+ }
if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
BPy_IDGroup_CorrectListLen(prop, list, i, __func__);
@@ -735,7 +729,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop)
IDProperty *loop;
int i;
- for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) {
+ for (i = 0, loop = prop->data.group.first; loop; loop = loop->next, i++) {
PyList_SET_ITEM(list, i, BPy_IDGroup_WrapData(id, loop, prop));
}
@@ -755,8 +749,8 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop)
IDProperty *loop;
int i;
- for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) {
- PyObject *item= PyTuple_New(2);
+ for (i = 0, loop = prop->data.group.first; loop; loop = loop->next, i++) {
+ PyObject *item = PyTuple_New(2);
PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(loop->name));
PyTuple_SET_ITEM(item, 1, BPy_IDGroup_WrapData(id, loop, prop));
PyList_SET_ITEM(seq, i, item);
@@ -805,7 +799,7 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value)
static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
{
PyObject *pkey, *pval;
- Py_ssize_t i=0;
+ Py_ssize_t i = 0;
if (!PyDict_Check(value)) {
PyErr_Format(PyExc_TypeError,
@@ -829,18 +823,18 @@ static PyObject *BPy_IDGroup_to_dict(BPy_IDProperty *self)
/* Matches python dict.get(key, [default]) */
-static PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
+static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
{
IDProperty *idprop;
char *key;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
return NULL;
- idprop= IDP_GetPropertyFromGroup(self->prop, key);
+ idprop = IDP_GetPropertyFromGroup(self->prop, key);
if (idprop) {
- PyObject* pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
+ PyObject *pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
if (pyobj)
return pyobj;
}
@@ -955,17 +949,17 @@ static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double)
{
switch (self->prop->subtype) {
case IDP_FLOAT:
- *is_double= 0;
+ *is_double = 0;
return &PyFloat_Type;
case IDP_DOUBLE:
- *is_double= 1;
+ *is_double = 1;
return &PyFloat_Type;
case IDP_INT:
- *is_double= 0;
+ *is_double = 0;
return &PyLong_Type;
}
- *is_double= 0;
+ *is_double = 0;
return NULL;
}
@@ -977,12 +971,9 @@ static PyObject *BPy_IDArray_repr(BPy_IDArray *self)
static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
{
switch (self->prop->subtype) {
- case IDP_FLOAT:
- return PyUnicode_FromString("f");
- case IDP_DOUBLE:
- return PyUnicode_FromString("d");
- case IDP_INT:
- return PyUnicode_FromString("i");
+ case IDP_FLOAT: return PyUnicode_FromString("f");
+ case IDP_DOUBLE: return PyUnicode_FromString("d");
+ case IDP_INT: return PyUnicode_FromString("i");
}
PyErr_Format(PyExc_RuntimeError,
@@ -1023,11 +1014,11 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
switch (self->prop->subtype) {
case IDP_FLOAT:
- return PyFloat_FromDouble(((float*)IDP_Array(self->prop))[index]);
+ return PyFloat_FromDouble(((float *)IDP_Array(self->prop))[index]);
case IDP_DOUBLE:
- return PyFloat_FromDouble(((double*)IDP_Array(self->prop))[index]);
+ return PyFloat_FromDouble(((double *)IDP_Array(self->prop))[index]);
case IDP_INT:
- return PyLong_FromLong((long)((int*)IDP_Array(self->prop))[index]);
+ return PyLong_FromLong((long)((int *)IDP_Array(self->prop))[index]);
}
PyErr_Format(PyExc_RuntimeError,
@@ -1050,29 +1041,29 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
switch (self->prop->subtype) {
case IDP_FLOAT:
- f= (float)PyFloat_AsDouble(value);
- if (f==-1 && PyErr_Occurred()) {
+ f = (float)PyFloat_AsDouble(value);
+ if (f == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- ((float*)IDP_Array(self->prop))[index] = f;
+ ((float *)IDP_Array(self->prop))[index] = f;
break;
case IDP_DOUBLE:
- d= PyFloat_AsDouble(value);
- if (d==-1 && PyErr_Occurred()) {
+ d = PyFloat_AsDouble(value);
+ if (d == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- ((double*)IDP_Array(self->prop))[index] = d;
+ ((double *)IDP_Array(self->prop))[index] = d;
break;
case IDP_INT:
- i= PyLong_AsSsize_t(value);
- if (i==-1 && PyErr_Occurred()) {
+ i = PyLong_AsSsize_t(value);
+ if (i == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
}
- ((int*)IDP_Array(self->prop))[index] = i;
+ ((int *)IDP_Array(self->prop))[index] = i;
break;
}
return 0;
@@ -1097,21 +1088,21 @@ static PySequenceMethods BPy_IDArray_Seq = {
/* sequence slice (get): idparr[a:b] */
static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
{
- IDProperty *prop= self->prop;
+ IDProperty *prop = self->prop;
PyObject *tuple;
int count;
CLAMP(begin, 0, prop->len);
- if (end<0) end= prop->len+end+1;
+ if (end < 0) end = prop->len + end + 1;
CLAMP(end, 0, prop->len);
- begin= MIN2(begin, end);
+ begin = MIN2(begin, end);
- tuple= PyTuple_New(end - begin);
+ tuple = PyTuple_New(end - begin);
switch (prop->subtype) {
case IDP_FLOAT:
{
- float *array= (float*)IDP_Array(prop);
+ float *array = (float *)IDP_Array(prop);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
}
@@ -1119,7 +1110,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
}
case IDP_DOUBLE:
{
- double *array= (double*)IDP_Array(prop);
+ double *array = (double *)IDP_Array(prop);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
}
@@ -1127,7 +1118,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
}
case IDP_INT:
{
- int *array= (int*)IDP_Array(prop);
+ int *array = (int *)IDP_Array(prop);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count]));
}
@@ -1140,10 +1131,10 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
/* sequence slice (set): idparr[a:b] = value */
static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject *seq)
{
- IDProperty *prop= self->prop;
- short is_double= 0;
- const PyTypeObject *py_type= idp_array_py_type(self, &is_double);
- const size_t elem_size= is_double ? sizeof(double) : sizeof(float);
+ IDProperty *prop = self->prop;
+ short is_double = 0;
+ const PyTypeObject *py_type = idp_array_py_type(self, &is_double);
+ const size_t elem_size = is_double ? sizeof(double) : sizeof(float);
size_t alloc_len;
size_t size;
void *vec;
@@ -1153,9 +1144,9 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
begin = MIN2(begin, end);
size = (end - begin);
- alloc_len= size * elem_size;
+ alloc_len = size * elem_size;
- vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
+ vec = MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
MEM_freeN(vec);
return -1;
@@ -1167,7 +1158,7 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
return 0;
}
-static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
+static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
{
if (PyIndex_Check(item)) {
Py_ssize_t i;
@@ -1203,7 +1194,7 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
}
}
-static int BPy_IDArray_ass_subscript(BPy_IDArray* self, PyObject* item, PyObject* value)
+static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject *value)
{
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -1331,12 +1322,14 @@ static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
{
- IDProperty *cur=NULL;
- PyObject *ret;
if (self->cur) {
+ PyObject *ret;
+ IDProperty *cur;
+
cur = self->cur;
self->cur = self->cur->next;
+
if (self->mode == IDPROP_ITER_ITEMS) {
ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(cur->name));
@@ -1357,7 +1350,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
/* For printing, in format "<module>.<name>" */
"Blender IDGroup_Iter", /* char *tp_name; */
- sizeof( BPy_IDGroup_Iter ), /* int tp_basicsize; */
+ sizeof(BPy_IDGroup_Iter), /* int tp_basicsize; */
0, /* tp_itemsize; For allocation */
/* Methods to implement standard operations */
@@ -1367,7 +1360,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) IDGroup_Iter_repr, /* reprfunc tp_repr; */
+ (reprfunc) IDGroup_Iter_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 9e373fc8048..0b89b8744b9 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -67,28 +67,28 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
/* for each type */
if (type == &PyFloat_Type) {
if (is_double) {
- double *array_double= array;
- for (i=0; i<length; i++) {
+ double *array_double = array;
+ for (i = 0; i < length; i++) {
array_double[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else {
- float *array_float= array;
- for (i=0; i<length; i++) {
+ float *array_float = array;
+ for (i = 0; i < length; i++) {
array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
}
else if (type == &PyLong_Type) {
/* could use is_double for 'long int' but no use now */
- int *array_int= array;
- for (i=0; i<length; i++) {
+ int *array_int = array;
+ for (i = 0; i < length; i++) {
array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if (type == &PyBool_Type) {
- int *array_bool= array;
- for (i=0; i<length; i++) {
+ int *array_bool = array;
+ for (i = 0; i < length; i++) {
array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
@@ -117,7 +117,7 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
void PyC_ObSpit(const char *name, PyObject *var)
{
fprintf(stderr, "<%s> : ", name);
- if (var==NULL) {
+ if (var == NULL) {
fprintf(stderr, "<NIL>");
}
else {
@@ -156,10 +156,10 @@ void PyC_FileAndNum(const char **filename, int *lineno)
{
PyFrameObject *frame;
- if (filename) *filename= NULL;
+ if (filename) *filename = NULL;
if (lineno) *lineno = -1;
- if (!(frame= PyThreadState_GET()->frame)) {
+ if (!(frame = PyThreadState_GET()->frame)) {
return;
}
@@ -172,16 +172,16 @@ void PyC_FileAndNum(const char **filename, int *lineno)
if (filename && *filename == NULL) {
/* try an alternative method to get the filename - module based
* references below are all borrowed (double checked) */
- PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
+ PyObject *mod_name = PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
if (mod_name) {
- PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
+ PyObject *mod = PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
if (mod) {
- *filename= PyModule_GetFilename(mod);
+ *filename = PyModule_GetFilename(mod);
}
/* unlikely, fallback */
if (*filename == NULL) {
- *filename= _PyUnicode_AsString(mod_name);
+ *filename = _PyUnicode_AsString(mod_name);
}
}
}
@@ -204,13 +204,13 @@ void PyC_FileAndNum_Safe(const char **filename, int *lineno)
PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
{
Py_ssize_t i;
- PyObject *item= o;
+ PyObject *item = o;
char *attr;
va_list vargs;
va_start(vargs, n);
- for (i=0; i<n; i++) {
+ for (i = 0; i < n; i++) {
attr = va_arg(vargs, char *);
item = PyObject_GetAttrString(item, attr);
@@ -238,7 +238,7 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
va_list args;
va_start(args, format);
- error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
+ error_value_prefix = PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
va_end(args);
if (PyErr_Occurred()) {
@@ -271,22 +271,22 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
PyObject *PyC_ExceptionBuffer(void)
{
- PyObject *traceback_mod= NULL;
- PyObject *format_tb_func= NULL;
- PyObject *ret= NULL;
+ PyObject *traceback_mod = NULL;
+ PyObject *format_tb_func = NULL;
+ PyObject *ret = NULL;
- if (! (traceback_mod= PyImport_ImportModule("traceback")) ) {
+ if (!(traceback_mod = PyImport_ImportModule("traceback"))) {
goto error_cleanup;
}
- else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) {
+ else if (!(format_tb_func = PyObject_GetAttrString(traceback_mod, "format_exc"))) {
goto error_cleanup;
}
- ret= PyObject_CallObject(format_tb_func, NULL);
+ ret = PyObject_CallObject(format_tb_func, NULL);
if (ret == Py_None) {
Py_DECREF(ret);
- ret= NULL;
+ ret = NULL;
}
error_cleanup:
@@ -303,8 +303,8 @@ PyObject *PyC_ExceptionBuffer(void)
PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
PyObject *string_io = NULL;
PyObject *string_io_buf = NULL;
- PyObject *string_io_mod= NULL;
- PyObject *string_io_getvalue= NULL;
+ PyObject *string_io_mod = NULL;
+ PyObject *string_io_getvalue = NULL;
PyObject *error_type, *error_value, *error_traceback;
@@ -319,13 +319,13 @@ PyObject *PyC_ExceptionBuffer(void)
* string_io = io.StringIO()
*/
- if (! (string_io_mod= PyImport_ImportModule("io")) ) {
+ if (!(string_io_mod = PyImport_ImportModule("io"))) {
goto error_cleanup;
}
- else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
+ else if (!(string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
goto error_cleanup;
}
- else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
+ else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
goto error_cleanup;
}
@@ -374,7 +374,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
{
const char *result;
- result= _PyUnicode_AsString(py_str);
+ result = _PyUnicode_AsString(py_str);
if (result) {
/* 99% of the time this is enough but we better support non unicode
@@ -387,7 +387,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
if (PyBytes_Check(py_str)) {
return PyBytes_AS_STRING(py_str);
}
- else if ((*coerce= PyUnicode_EncodeFSDefault(py_str))) {
+ else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) {
return PyBytes_AS_STRING(*coerce);
}
else {
@@ -399,7 +399,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
{
- PyObject *result= PyUnicode_FromStringAndSize(str, size);
+ PyObject *result = PyUnicode_FromStringAndSize(str, size);
if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
@@ -408,7 +408,7 @@ PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
else {
PyErr_Clear();
/* this means paths will always be accessible once converted, on all OS's */
- result= PyUnicode_DecodeFSDefaultAndSize(str, size);
+ result = PyUnicode_DecodeFSDefaultAndSize(str, size);
return result;
}
}
@@ -432,8 +432,8 @@ PyObject *PyC_UnicodeFromByte(const char *str)
****************************************************************************/
PyObject *PyC_DefaultNameSpace(const char *filename)
{
- PyInterpreterState *interp= PyThreadState_GET()->interp;
- PyObject *mod_main= PyModule_New("__main__");
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+ PyObject *mod_main = PyModule_New("__main__");
PyDict_SetItemString(interp->modules, "__main__", mod_main);
Py_DECREF(mod_main); /* sys.modules owns now */
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
@@ -447,14 +447,14 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
/* restore MUST be called after this */
void PyC_MainModule_Backup(PyObject **main_mod)
{
- PyInterpreterState *interp= PyThreadState_GET()->interp;
- *main_mod= PyDict_GetItemString(interp->modules, "__main__");
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+ *main_mod = PyDict_GetItemString(interp->modules, "__main__");
Py_XINCREF(*main_mod); /* dont free */
}
void PyC_MainModule_Restore(PyObject *main_mod)
{
- PyInterpreterState *interp= PyThreadState_GET()->interp;
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
PyDict_SetItemString(interp->modules, "__main__", main_mod);
Py_XDECREF(main_mod);
}
@@ -462,7 +462,7 @@ void PyC_MainModule_Restore(PyObject *main_mod)
/* must be called before Py_Initialize, expects output of BLI_get_folder(BLENDER_PYTHON, NULL) */
void PyC_SetHomePath(const char *py_path_bundle)
{
- if (py_path_bundle==NULL) {
+ if (py_path_bundle == NULL) {
/* Common enough to have bundled *nix python but complain on OSX/Win */
#if defined(__APPLE__) || defined(_WIN32)
fprintf(stderr, "Warning! bundled python not found and is expected on this platform. "
@@ -506,34 +506,34 @@ void PyC_SetHomePath(const char *py_path_bundle)
/* Would be nice if python had this built in */
void PyC_RunQuicky(const char *filepath, int n, ...)
{
- FILE *fp= fopen(filepath, "r");
+ FILE *fp = fopen(filepath, "r");
if (fp) {
- PyGILState_STATE gilstate= PyGILState_Ensure();
+ PyGILState_STATE gilstate = PyGILState_Ensure();
va_list vargs;
- int *sizes= PyMem_MALLOC(sizeof(int) * (n / 2));
+ int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2));
int i;
PyObject *py_dict = PyC_DefaultNameSpace(filepath);
- PyObject *values= PyList_New(n / 2); /* namespace owns this, dont free */
+ PyObject *values = PyList_New(n / 2); /* namespace owns this, dont free */
PyObject *py_result, *ret;
- PyObject *struct_mod= PyImport_ImportModule("struct");
- PyObject *calcsize= PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
- PyObject *pack= PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
- PyObject *unpack= PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
+ PyObject *struct_mod = PyImport_ImportModule("struct");
+ PyObject *calcsize = PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
+ PyObject *pack = PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
+ PyObject *unpack = PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
Py_DECREF(struct_mod);
va_start(vargs, n);
- for (i=0; i * 2<n; i++) {
+ for (i = 0; i * 2 < n; i++) {
char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
- ret= PyObject_CallFunction(calcsize, (char *)"s", format);
+ ret = PyObject_CallFunction(calcsize, (char *)"s", format);
if (ret) {
sizes[i]= PyLong_AsSsize_t(ret);
@@ -554,7 +554,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
else {
if (PyTuple_GET_SIZE(ret) == 1) {
/* convenience, convert single tuples into single values */
- PyObject *tmp= PyTuple_GET_ITEM(ret, 0);
+ PyObject *tmp = PyTuple_GET_ITEM(ret, 0);
Py_INCREF(tmp);
Py_DECREF(ret);
ret = tmp;
@@ -576,29 +576,29 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
/* we could skip this but then only slice assignment would work
* better not be so strict */
- values= PyDict_GetItemString(py_dict, "values");
+ values = PyDict_GetItemString(py_dict, "values");
if (values && PyList_Check(values)) {
/* dont use the result */
Py_DECREF(py_result);
- py_result= NULL;
+ py_result = NULL;
/* now get the values back */
va_start(vargs, n);
- for (i=0; i*2 <n; i++) {
+ for (i = 0; i * 2 < n; i++) {
char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
PyObject *item;
PyObject *item_new;
/* prepend the string formatting and remake the tuple */
- item= PyList_GET_ITEM(values, i);
+ item = PyList_GET_ITEM(values, i);
if (PyTuple_CheckExact(item)) {
- int ofs= PyTuple_GET_SIZE(item);
- item_new= PyTuple_New(ofs + 1);
+ int ofs = PyTuple_GET_SIZE(item);
+ item_new = PyTuple_New(ofs + 1);
while (ofs--) {
- PyObject *member= PyTuple_GET_ITEM(item, ofs);
+ PyObject *member = PyTuple_GET_ITEM(item, ofs);
PyTuple_SET_ITEM(item_new, ofs + 1, member);
Py_INCREF(member);
}
@@ -606,7 +606,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
PyTuple_SET_ITEM(item_new, 0, PyUnicode_FromString(format));
}
else {
- item_new= Py_BuildValue("sO", format, item);
+ item_new = Py_BuildValue("sO", format, item);
}
ret = PyObject_Call(pack, item_new, NULL);
@@ -650,8 +650,8 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
/* generic function to avoid depending on RNA */
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
{
- PyObject* as_pointer;
- PyObject* pointer;
+ PyObject *as_pointer;
+ PyObject *pointer;
if (!strcmp(Py_TYPE(value)->tp_name, type_name) &&
(as_pointer = PyObject_GetAttrString(value, "as_pointer")) != NULL &&
@@ -706,7 +706,7 @@ char *PyC_FlagSet_AsString(PyC_FlagSet *item)
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *value)
{
for( ; item->identifier; item++) {
- if(strcmp(item->identifier, identifier) == 0) {
+ if (strcmp(item->identifier, identifier) == 0) {
*value = item->value;
return 1;
}
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index daa842f0629..54848161b89 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -256,10 +256,10 @@ void BPY_app_handlers_reset(const short do_all)
for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
- if ( (PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
- (dict_ptr = _PyObject_GetDictPtr(item)) &&
- (*dict_ptr) &&
- (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
+ if ((PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
+ (dict_ptr = _PyObject_GetDictPtr(item)) &&
+ (*dict_ptr) &&
+ (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
{
/* keep */
}
@@ -283,9 +283,9 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
if ((cb_list_len = PyList_GET_SIZE(cb_list)) > 0) {
PyGILState_STATE gilstate = PyGILState_Ensure();
- PyObject* args = PyTuple_New(1); // save python creating each call
- PyObject* func;
- PyObject* ret;
+ PyObject *args = PyTuple_New(1); // save python creating each call
+ PyObject *func;
+ PyObject *ret;
Py_ssize_t pos;
/* setup arguments */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 1ef9c0d3214..7e04f890303 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -238,7 +238,7 @@ void BPY_python_start(int argc, const char **argv)
Py_Initialize();
// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
- /* sigh, why do python guys not have a char** version anymore? :( */
+ /* sigh, why do python guys not have a (char **) version anymore? */
{
int i;
PyObject *py_argv = PyList_New(argc);
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index ed3b758a6b4..ee50fde35d6 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -62,7 +62,7 @@
#endif
typedef struct {
- PyObject_HEAD /* required python macro */
+ PyObject_HEAD /* required python macro */
/* collection iterator specific parts */
char relpath[FILE_MAX];
char abspath[FILE_MAX]; /* absolute path */
@@ -186,7 +186,7 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
{
static const char *kwlist[] = {"filepath", "link", "relative", NULL};
BPy_Library *ret;
- const char* filename = NULL;
+ const char *filename = NULL;
int is_rel = 0, is_link = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ii:load", (char **)kwlist, &filename, &is_link, &is_rel))
@@ -199,8 +199,8 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
BLI_path_abs(ret->abspath, G.main->name);
ret->blo_handle = NULL;
- ret->flag= (is_link ? FILE_LINK : 0) |
- (is_rel ? FILE_RELPATH : 0);
+ ret->flag = ((is_link ? FILE_LINK : 0) |
+ (is_rel ? FILE_RELPATH : 0));
ret->dict = PyDict_New();
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index ac832611ded..7beb78e8519 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -155,10 +155,10 @@ static void printf_func_error(PyObject *py_func)
/* use py style error */
fprintf(stderr, "File \"%s\", line %d, in %s\n",
- _PyUnicode_AsString(f_code->co_filename),
- f_code->co_firstlineno,
- _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
- );
+ _PyUnicode_AsString(f_code->co_filename),
+ f_code->co_firstlineno,
+ _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
+ );
}
/* operators and classes use this so it can store the args given but defer
@@ -1033,14 +1033,14 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
item = PySequence_Fast_GET_ITEM(seq_fast, i);
- if ( (PyTuple_CheckExact(item)) &&
- (item_size = PyTuple_GET_SIZE(item)) &&
- (item_size == 3 || item_size == 4) &&
- (tmp.identifier = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
- (tmp.name = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
- (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
- /* TODO, number isnt ensured to be unique from the script author */
- (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1))
+ if ((PyTuple_CheckExact(item)) &&
+ (item_size = PyTuple_GET_SIZE(item)) &&
+ (item_size == 3 || item_size == 4) &&
+ (tmp.identifier = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
+ (tmp.name = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
+ (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
+ /* TODO, number isnt ensured to be unique from the script author */
+ (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1))
{
if (is_enum_flag) {
if (item_size < 4) {
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 56c892c7d9f..80cf3048a8a 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -85,7 +85,7 @@
#define USE_MATHUTILS
#define USE_STRING_COERCE
-static PyObject* pyrna_struct_Subtype(PointerRNA *ptr);
+static PyObject *pyrna_struct_Subtype(PointerRNA *ptr);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
#define BPY_DOC_ID_PROP_TYPE_NOTE \
@@ -756,15 +756,15 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
{
- return ( (a->ptr.data == b->ptr.data) &&
- (a->ptr.type == b->ptr.type)) ? 0 : -1;
+ return (((a->ptr.data == b->ptr.data) &&
+ (a->ptr.type == b->ptr.type)) ? 0 : -1);
}
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
{
- return ( (a->prop == b->prop) &&
+ return (((a->prop == b->prop) &&
(a->ptr.data == b->ptr.data) &&
- (a->ptr.type == b->ptr.type) ) ? 0 : -1;
+ (a->ptr.type == b->ptr.type)) ? 0 : -1);
}
static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
@@ -776,21 +776,21 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
ok = pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
+ 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_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -805,21 +805,21 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
ok = pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
+ 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_LT:
+ case Py_LE:
+ case Py_GT:
+ case Py_GE:
+ res = Py_NotImplemented;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
}
return Py_INCREF(res), res;
@@ -912,7 +912,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
int len = -1;
char *c = type_fmt;
- while ((*c++= tolower(*type_id++))) {}
+ while ((*c++ = tolower(*type_id++))) {}
if (type == PROP_COLLECTION) {
len = pyrna_prop_collection_length(self);
@@ -1694,9 +1694,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
* if this causes problems in the future it should be removed.
*/
if ((ptr_type == &RNA_AnyType) &&
- (BPy_StructRNA_Check(value)) &&
- (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator))
- ) {
+ (BPy_StructRNA_Check(value)) &&
+ (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator)))
+ {
value = PyObject_GetAttrString(value, "properties");
value_new = value;
}
@@ -2640,7 +2640,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
RNA_property_float_get_array(ptr, prop, values);
for (count = start; count < stop; count++) {
- fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
+ fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count - start));
CLAMP(fval, min, max);
values[count] = fval;
}
@@ -2660,7 +2660,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
RNA_property_boolean_get_array(ptr, prop, values);
for (count = start; count < stop; count++)
- values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+ values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count - start));
if (PyErr_Occurred()) ret = -1;
else RNA_property_boolean_set_array(ptr, prop, values);
@@ -4034,7 +4034,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
IDProperty *group, *idprop;
const char *key;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -4092,7 +4092,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
PointerRNA newptr;
PyObject *key_ob;
- PyObject* def = Py_None;
+ PyObject *def = Py_None;
PYRNA_PROP_CHECK_OBJ(self);
@@ -4166,9 +4166,9 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
return PyLong_FromSsize_t(index);
}
-static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
- /* values to assign */
- RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
+static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
+ /* values to assign */
+ RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
{
PropertyRNA *prop;
*raw_type = PROP_RAW_UNSET;
@@ -4190,8 +4190,8 @@ static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
static int foreach_parse_args(
BPy_PropertyRNA *self, PyObject *args,
- /*values to assign */
- const char **attr, PyObject **seq, int *tot, int *size,
+ /* values to assign */
+ const char **attr, PyObject **seq, int *tot, int *size,
RawPropertyType *raw_type, int *attr_tot, int *attr_signed
)
{
@@ -4250,21 +4250,21 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
char f = format ? *format:'B'; /* B is assumed when not set */
switch (raw_type) {
- case PROP_RAW_CHAR:
- if (attr_signed) return (f == 'b') ? 1:0;
- else return (f == 'B') ? 1:0;
- case PROP_RAW_SHORT:
- if (attr_signed) return (f == 'h') ? 1:0;
- else return (f == 'H') ? 1:0;
- case PROP_RAW_INT:
- if (attr_signed) return (f == 'i') ? 1:0;
- else return (f == 'I') ? 1:0;
- case PROP_RAW_FLOAT:
- return (f == 'f') ? 1:0;
- case PROP_RAW_DOUBLE:
- return (f == 'd') ? 1:0;
- case PROP_RAW_UNSET:
- return 0;
+ case PROP_RAW_CHAR:
+ if (attr_signed) return (f == 'b') ? 1:0;
+ else return (f == 'B') ? 1:0;
+ case PROP_RAW_SHORT:
+ if (attr_signed) return (f == 'h') ? 1:0;
+ else return (f == 'H') ? 1:0;
+ case PROP_RAW_INT:
+ if (attr_signed) return (f == 'i') ? 1:0;
+ else return (f == 'I') ? 1:0;
+ case PROP_RAW_FLOAT:
+ return (f == 'f') ? 1:0;
+ case PROP_RAW_DOUBLE:
+ return (f == 'd') ? 1:0;
+ case PROP_RAW_UNSET:
+ return 0;
}
return 0;
@@ -4314,25 +4314,25 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
for ( ; i < tot; i++) {
item = PySequence_GetItem(seq, i);
switch (raw_type) {
- case PROP_RAW_CHAR:
- ((char *)array)[i] = (char)PyLong_AsLong(item);
- break;
- case PROP_RAW_SHORT:
- ((short *)array)[i] = (short)PyLong_AsLong(item);
- break;
- case PROP_RAW_INT:
- ((int *)array)[i] = (int)PyLong_AsLong(item);
- break;
- case PROP_RAW_FLOAT:
- ((float *)array)[i] = (float)PyFloat_AsDouble(item);
- break;
- case PROP_RAW_DOUBLE:
- ((double *)array)[i] = (double)PyFloat_AsDouble(item);
- break;
- case PROP_RAW_UNSET:
- /* should never happen */
- BLI_assert(!"Invalid array type - set");
- break;
+ case PROP_RAW_CHAR:
+ ((char *)array)[i] = (char)PyLong_AsLong(item);
+ break;
+ case PROP_RAW_SHORT:
+ ((short *)array)[i] = (short)PyLong_AsLong(item);
+ break;
+ case PROP_RAW_INT:
+ ((int *)array)[i] = (int)PyLong_AsLong(item);
+ break;
+ case PROP_RAW_FLOAT:
+ ((float *)array)[i] = (float)PyFloat_AsDouble(item);
+ break;
+ case PROP_RAW_DOUBLE:
+ ((double *)array)[i] = (double)PyFloat_AsDouble(item);
+ break;
+ case PROP_RAW_UNSET:
+ /* should never happen */
+ BLI_assert(!"Invalid array type - set");
+ break;
}
Py_DECREF(item);
@@ -4369,27 +4369,27 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
for ( ; i < tot; i++) {
switch (raw_type) {
- case PROP_RAW_CHAR:
- item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
- break;
- case PROP_RAW_SHORT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
- break;
- case PROP_RAW_INT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
- break;
- case PROP_RAW_FLOAT:
- item = PyFloat_FromDouble((double) ((float *)array)[i]);
- break;
- case PROP_RAW_DOUBLE:
- item = PyFloat_FromDouble((double) ((double *)array)[i]);
- break;
- default: /* PROP_RAW_UNSET */
- /* should never happen */
- BLI_assert(!"Invalid array type - get");
- item = Py_None;
- Py_INCREF(item);
- break;
+ case PROP_RAW_CHAR:
+ item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+ break;
+ case PROP_RAW_SHORT:
+ item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+ break;
+ case PROP_RAW_INT:
+ item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+ break;
+ case PROP_RAW_FLOAT:
+ item = PyFloat_FromDouble((double) ((float *)array)[i]);
+ break;
+ case PROP_RAW_DOUBLE:
+ item = PyFloat_FromDouble((double) ((double *)array)[i]);
+ break;
+ default: /* PROP_RAW_UNSET */
+ /* should never happen */
+ BLI_assert(!"Invalid array type - get");
+ item = Py_None;
+ Py_INCREF(item);
+ break;
}
PySequence_SetItem(seq, i, item);
@@ -5922,10 +5922,10 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
/* done with rna instance */
}
-static PyObject* pyrna_srna_Subtype(StructRNA *srna);
+static PyObject *pyrna_srna_Subtype(StructRNA *srna);
/* return a borrowed reference */
-static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict)
+static PyObject *pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict)
{
/* Assume RNA_struct_py_type_get(srna) was already checked */
StructRNA *base;
@@ -5952,7 +5952,7 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
* return a borrowed reference */
static PyObject *bpy_types_dict = NULL;
-static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
+static PyObject *pyrna_srna_ExternalType(StructRNA *srna)
{
const char *idname = RNA_struct_identifier(srna);
PyObject *newclass;
@@ -6002,7 +6002,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
return newclass;
}
-static PyObject* pyrna_srna_Subtype(StructRNA *srna)
+static PyObject *pyrna_srna_Subtype(StructRNA *srna)
{
PyObject *newclass = NULL;
@@ -6035,8 +6035,8 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
// if (!descr) descr = "(no docs)";
// "__doc__", descr
- if ( RNA_struct_idprops_check(srna) &&
- !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
+ if (RNA_struct_idprops_check(srna) &&
+ !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
{
metaclass = (PyObject *)&pyrna_struct_meta_idprop_Type;
}
@@ -6082,7 +6082,7 @@ static StructRNA *srna_from_ptr(PointerRNA *ptr)
}
/* always returns a new ref, be sure to decref when done */
-static PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+static PyObject *pyrna_struct_Subtype(PointerRNA *ptr)
{
return pyrna_srna_Subtype(srna_from_ptr(ptr));
}
@@ -6588,10 +6588,10 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
*
* So only scan base classes which are not subclasses if blender types.
* This best fits having 'mix-in' classes for operators and render engines.
- * */
+ */
if (py_superclass != &PyBaseObject_Type &&
- !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type)
- ) {
+ !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type))
+ {
ret = pyrna_deferred_register_class_recursive(srna, py_superclass);
if (ret != 0) {
@@ -7016,8 +7016,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (err == -1) {
PyC_Err_Format_Prefix(PyExc_RuntimeError,
"class %.200s, function %.200s: incompatible return value ",
- RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
- );
+ RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
}
}
else if (ret_len > 1) {
@@ -7065,10 +7064,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
- if ( (!is_static) &&
- (ptr->data) &&
- (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
- (is_valid_wm == (CTX_wm_manager(C) != NULL)))
+ if ((!is_static) &&
+ (ptr->data) &&
+ (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
+ (is_valid_wm == (CTX_wm_manager(C) != NULL)))
{
wmOperator *op = ptr->data;
reports = op->reports;
@@ -7106,7 +7105,7 @@ static void bpy_class_free(void *pyob_ptr)
PyErr_Clear();
#if 0 /* needs further investigation, too annoying so quiet for now */
- if (G.f&G_DEBUG) {
+ if (G.f & G_DEBUG) {
if (self->ob_refcnt > 1) {
PyC_ObSpit("zombie class - ref should be 1", self);
}
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 187db194c36..6e6eb015387 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -550,21 +550,21 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
{
int ret;
switch (RNA_property_type(prop)) {
- case PROP_FLOAT:
- ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
- py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
- break;
- case PROP_INT:
- ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
- py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
- break;
- case PROP_BOOLEAN:
- ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
- py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "not an array type");
- ret = -1;
+ case PROP_FLOAT:
+ ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
+ py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
+ break;
+ case PROP_INT:
+ ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
+ py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
+ break;
+ case PROP_BOOLEAN:
+ ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
+ py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "not an array type");
+ ret = -1;
}
return ret;
@@ -575,21 +575,21 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in
{
int ret;
switch (RNA_property_type(prop)) {
- case PROP_FLOAT:
- ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
- py_float_check, "float", py_to_float, float_set_index, error_prefix);
- break;
- case PROP_INT:
- ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
- py_int_check, "int", py_to_int, int_set_index, error_prefix);
- break;
- case PROP_BOOLEAN:
- ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
- py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "not an array type");
- ret = -1;
+ case PROP_FLOAT:
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ py_float_check, "float", py_to_float, float_set_index, error_prefix);
+ break;
+ case PROP_INT:
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ py_int_check, "int", py_to_int, int_set_index, error_prefix);
+ break;
+ case PROP_BOOLEAN:
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "not an array type");
+ ret = -1;
}
return ret;
@@ -600,18 +600,18 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PyObject *item;
switch (RNA_property_type(prop)) {
- case PROP_FLOAT:
- item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
- break;
- case PROP_BOOLEAN:
- item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
- break;
- case PROP_INT:
- item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "not an array type");
- item = NULL;
+ case PROP_FLOAT:
+ item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
+ break;
+ case PROP_BOOLEAN:
+ item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
+ break;
+ case PROP_INT:
+ item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "not an array type");
+ item = NULL;
}
return item;
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 01eb2653681..aaba90604f5 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -54,7 +54,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
/* new style errors. `err' is an instance */
- if (! (v = PyObject_GetAttrString(err, "msg")))
+ if (!(v = PyObject_GetAttrString(err, "msg")))
goto finally;
*message = v;
@@ -62,7 +62,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
goto finally;
if (v == Py_None)
*filename = NULL;
- else if (! (*filename = _PyUnicode_AsString(v)))
+ else if (!(*filename = _PyUnicode_AsString(v)))
goto finally;
Py_DECREF(v);
@@ -131,8 +131,8 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
if (parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
/* python adds a '/', prefix, so check for both */
if ((BLI_path_cmp(filename, filepath) == 0) ||
- ((filename[0] == '\\' || filename[0] == '/') && BLI_path_cmp(filename + 1, filepath) == 0)
- ) {
+ ((filename[0] == '\\' || filename[0] == '/') && BLI_path_cmp(filename + 1, filepath) == 0))
+ {
/* good */
}
else {
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 552abaaf414..cc7506f863e 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -77,7 +77,7 @@ static struct PyModuleDef gpumodule = {
PyMODINIT_FUNC
PyInit_gpu(void)
{
- PyObject* m;
+ PyObject *m;
m = PyModule_Create(&gpumodule);
if (m == NULL)
@@ -155,14 +155,14 @@ PyDoc_STRVAR(GPU_export_shader_doc,
" :return: Dictionary defining the shader, uniforms and attributes.\n"
" :rtype: Dict"
);
-static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
+static PyObject *GPU_export_shader(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
{
- PyObject* pyscene;
- PyObject* pymat;
- PyObject* result;
- PyObject* dict;
- PyObject* val;
- PyObject* seq;
+ PyObject *pyscene;
+ PyObject *pymat;
+ PyObject *result;
+ PyObject *dict;
+ PyObject *val;
+ PyObject *seq;
int i;
Scene *scene;
@@ -174,7 +174,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
static const char *kwlist[] = {"scene", "material", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char **)(kwlist), &pyscene, &pymat))
return NULL;
scene = (Scene *)PyC_RNA_AsPointer(pyscene, "Scene");
@@ -202,7 +202,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PY_DICT_ADD_STRING(result,shader,vertex);
}
seq = PyList_New(BLI_countlist(&shader->uniforms));
- for (i=0, uniform=shader->uniforms.first; uniform; uniform=uniform->next, i++) {
+ for (i = 0, uniform = shader->uniforms.first; uniform; uniform = uniform->next, i++) {
dict = PyDict_New();
PY_DICT_ADD_STRING(dict,uniform,varname);
PY_DICT_ADD_LONG(dict,uniform,datatype);
@@ -230,7 +230,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
Py_DECREF(seq);
seq = PyList_New(BLI_countlist(&shader->attributes));
- for (i=0, attribute=shader->attributes.first; attribute; attribute=attribute->next, i++) {
+ for (i = 0, attribute = shader->attributes.first; attribute; attribute = attribute->next, i++) {
dict = PyDict_New();
PY_DICT_ADD_STRING(dict,attribute,varname);
PY_DICT_ADD_LONG(dict,attribute,datatype);
@@ -260,9 +260,9 @@ static PyMethodDef meth_export_shader[] = {
{"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
};
-PyObject* GPU_initPython(void)
+PyObject *GPU_initPython(void)
{
- PyObject* module = PyInit_gpu();
+ PyObject *module = PyInit_gpu();
PyModule_AddObject(module, "export_shader", (PyObject *)PyCFunction_New(meth_export_shader, NULL));
PyDict_SetItemString(PyImport_GetModuleDict(), "gpu", module);
diff --git a/source/blender/python/intern/gpu.h b/source/blender/python/intern/gpu.h
index bffbae13ba2..68e7fa4aa9e 100644
--- a/source/blender/python/intern/gpu.h
+++ b/source/blender/python/intern/gpu.h
@@ -32,5 +32,5 @@
/**
* Initalizes the gpu Python module.
*/
-PyObject* GPU_initPython(void);
+PyObject *GPU_initPython(void);
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;
diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py
index ec2eead522c..7e54f3dbb41 100644
--- a/source/blender/python/simple_enum_gen.py
+++ b/source/blender/python/simple_enum_gen.py
@@ -40,7 +40,7 @@ defs = """
"""
print '\tmod = PyModule_New("dummy");'
-print '\tPyModule_AddObject( submodule, "key", mod );'
+print '\tPyModule_AddObject(submodule, "key", mod);'
for d in defs.split('\n'):
@@ -58,7 +58,7 @@ for d in defs.split('\n'):
val = w[0]
py_val = w[0]
- print '\tPyModule_AddObject( mod, "%s", PyLong_FromSize_t(%s) );' % (val, py_val)
+ print '\tPyModule_AddObject(mod, "%s", PyLong_FromSize_t(%s));' % (val, py_val)