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>2011-03-19 14:12:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-19 14:12:48 +0300
commitcadc1218c8c8932464eacf0d6a75330e8ac45266 (patch)
tree41761e87faedb7bcd1d0c86237df690ff4f3b5af /source/blender
parentff1656175ac6a408bef1b77abd91406cdf895c93 (diff)
C, style changes (mostly white space edits), no functional change.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/generic/IDProp.c33
-rw-r--r--source/blender/python/generic/bgl.c18
-rw-r--r--source/blender/python/generic/bpy_internal_import.c134
-rw-r--r--source/blender/python/generic/mathutils.c22
-rw-r--r--source/blender/python/generic/mathutils_Color.c11
-rw-r--r--source/blender/python/generic/mathutils_Euler.c11
-rw-r--r--source/blender/python/generic/mathutils_Matrix.c48
-rw-r--r--source/blender/python/generic/mathutils_Quaternion.c23
-rw-r--r--source/blender/python/generic/mathutils_Vector.c55
-rw-r--r--source/blender/python/generic/mathutils_geometry.c14
-rw-r--r--source/blender/python/generic/noise_py_api.c4
-rw-r--r--source/blender/python/generic/py_capi_utils.c6
-rw-r--r--source/blender/python/intern/bpy.c20
-rw-r--r--source/blender/python/intern/bpy_app.c12
-rw-r--r--source/blender/python/intern/bpy_driver.c33
-rw-r--r--source/blender/python/intern/bpy_interface.c88
-rw-r--r--source/blender/python/intern/bpy_library.c16
-rw-r--r--source/blender/python/intern/bpy_operator.c16
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c26
-rw-r--r--source/blender/python/intern/bpy_props.c68
-rw-r--r--source/blender/python/intern/bpy_rna.c507
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c12
-rw-r--r--source/blender/python/intern/bpy_rna_array.c34
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c4
-rw-r--r--source/blender/python/intern/bpy_traceback.c3
-rw-r--r--source/blender/python/intern/bpy_util.c10
26 files changed, 646 insertions, 582 deletions
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index 58b3f972a67..36dc6fca503 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -316,10 +316,12 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
if (PyFloat_Check(ob)) {
val.d = PyFloat_AsDouble(ob);
prop = IDP_New(IDP_DOUBLE, val, name);
- } else if (PyLong_Check(ob)) {
+ }
+ else if (PyLong_Check(ob)) {
val.i = (int) PyLong_AsSsize_t(ob);
prop = IDP_New(IDP_INT, val, name);
- } else if (PyUnicode_Check(ob)) {
+ }
+ else if (PyUnicode_Check(ob)) {
#ifdef USE_STRING_COERCE
PyObject *value_coerce= NULL;
val.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce);
@@ -329,7 +331,8 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
val.str = _PyUnicode_AsString(ob);
prop = IDP_New(IDP_STRING, val, name);
#endif
- } else if (PySequence_Check(ob)) {
+ }
+ else if (PySequence_Check(ob)) {
PyObject *item;
int i;
@@ -372,7 +375,8 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
}
break;
}
- } else if (PyMapping_Check(ob)) {
+ }
+ else if (PyMapping_Check(ob)) {
PyObject *keys, *vals, *key, *pval;
int i, len;
/*yay! we get into recursive stuff now!*/
@@ -409,13 +413,15 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
}
Py_XDECREF(keys);
Py_XDECREF(vals);
- } else return "invalid property value";
+ }
+ else return "invalid property value";
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);
- } else {
+ }
+ else {
IDP_ReplaceInGroup(group, prop);
}
@@ -436,7 +442,8 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
IDP_FreeProperty(pkey);
MEM_freeN(pkey);
return 0;
- } else {
+ }
+ else {
PyErr_SetString(PyExc_KeyError, "property not found in group");
return -1;
}
@@ -507,10 +514,12 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
if (prop->subtype == IDP_FLOAT) {
PyList_SET_ITEM(seq, i,
PyFloat_FromDouble(((float*)prop->data.pointer)[i]));
- } else if (prop->subtype == IDP_DOUBLE) {
+ }
+ else if (prop->subtype == IDP_DOUBLE) {
PyList_SET_ITEM(seq, i,
PyFloat_FromDouble(((double*)prop->data.pointer)[i]));
- } else {
+ }
+ else {
PyList_SET_ITEM(seq, i,
PyLong_FromLong(((int*)prop->data.pointer)[i]));
}
@@ -1092,10 +1101,12 @@ static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(cur->name));
PyTuple_SET_ITEM(ret, 1, BPy_IDGroup_WrapData(self->group->id, cur));
return ret;
- } else {
+ }
+ else {
return PyUnicode_FromString(cur->name);
}
- } else {
+ }
+ else {
PyErr_SetString(PyExc_StopIteration, "iterator at end");
return NULL;
}
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index e47ea1a53b7..2c15755a642 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -170,7 +170,8 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf
if (initbuffer) {
memcpy(buffer->buf.asvoid, initbuffer, length*size);
- } else {
+ }
+ else {
memset(buffer->buf.asvoid, 0, length*size);
/*
for (i= 0; i<length; i++) {
@@ -280,7 +281,8 @@ static PyObject *Buffer_item(PyObject *self, int i)
case GL_FLOAT: return PyFloat_FromDouble(buf->buf.asfloat[i]);
case GL_DOUBLE: return Py_BuildValue("d", buf->buf.asdouble[i]);
}
- } else {
+ }
+ else {
Buffer *newbuf;
int j, length, size;
@@ -350,17 +352,21 @@ static int Buffer_ass_item(PyObject *self, int i, PyObject *v)
if (buf->type==GL_BYTE) {
if (!PyArg_Parse(v, "b:Coordinates must be ints", &buf->buf.asbyte[i]))
return -1;
- } else if (buf->type==GL_SHORT) {
+ }
+ else if (buf->type==GL_SHORT) {
if (!PyArg_Parse(v, "h:Coordinates must be ints", &buf->buf.asshort[i]))
return -1;
- } else if (buf->type==GL_INT) {
+ }
+ else if (buf->type==GL_INT) {
if (!PyArg_Parse(v, "i:Coordinates must be ints", &buf->buf.asint[i]))
return -1;
- } else if (buf->type==GL_FLOAT) {
+ }
+ else if (buf->type==GL_FLOAT) {
if (!PyArg_Parse(v, "f:Coordinates must be floats", &buf->buf.asfloat[i]))
return -1;
- } else if (buf->type==GL_DOUBLE) {
+ }
+ else if (buf->type==GL_DOUBLE) {
if (!PyArg_Parse(v, "d:Coordinates must be floats", &buf->buf.asdouble[i]))
return -1;
}
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index e0af6e085eb..f4d88b33a48 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -58,7 +58,7 @@ static Main *bpy_import_main= NULL;
static void free_compiled_text(Text *text)
{
if(text->compiled) {
- Py_DECREF(( PyObject * )text->compiled);
+ Py_DECREF((PyObject *)text->compiled);
}
text->compiled= NULL;
}
@@ -81,23 +81,23 @@ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
PyObject *bpy_text_import(Text *text)
{
- char *buf = NULL;
+ char *buf= NULL;
char modulename[24];
int len;
- if( !text->compiled ) {
+ if(!text->compiled) {
char fn_dummy[256];
bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
- buf = txt_to_buf( text );
- text->compiled = Py_CompileString( buf, fn_dummy, Py_file_input );
- MEM_freeN( buf );
+ buf= txt_to_buf(text);
+ text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
+ MEM_freeN(buf);
- if( PyErr_Occurred( ) ) {
- PyErr_Print( );
- PyErr_Clear( );
+ if(PyErr_Occurred()) {
+ PyErr_Print();
+ PyErr_Clear();
PySys_SetObject("last_traceback", NULL);
- free_compiled_text( text );
+ free_compiled_text(text);
return NULL;
}
}
@@ -108,11 +108,11 @@ PyObject *bpy_text_import(Text *text)
return PyImport_ExecCodeModule(modulename, text->compiled);
}
-PyObject *bpy_text_import_name( char *name, int *found )
+PyObject *bpy_text_import_name(char *name, int *found)
{
Text *text;
char txtname[22]; /* 21+NULL */
- int namelen = strlen( name );
+ int namelen= strlen(name);
//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
Main *maggie= bpy_import_main;
@@ -125,15 +125,15 @@ PyObject *bpy_text_import_name( char *name, int *found )
if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */
- memcpy( txtname, name, namelen );
- memcpy( &txtname[namelen], ".py", 4 );
+ memcpy(txtname, name, namelen);
+ memcpy(&txtname[namelen], ".py", 4);
text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
- if( !text )
+ if(!text)
return NULL;
else
- *found = 1;
+ *found= 1;
return bpy_text_import(text);
}
@@ -143,12 +143,12 @@ PyObject *bpy_text_import_name( char *name, int *found )
* find in-memory module and recompile
*/
-PyObject *bpy_text_reimport( PyObject *module, int *found )
+PyObject *bpy_text_reimport(PyObject *module, int *found)
{
Text *text;
const char *name;
char *filepath;
- char *buf = NULL;
+ char *buf= NULL;
//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
Main *maggie= bpy_import_main;
@@ -170,50 +170,50 @@ PyObject *bpy_text_reimport( PyObject *module, int *found )
text= BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
- if( !text )
+ if(!text)
return NULL;
else
- *found = 1;
+ *found= 1;
/* if previously compiled, free the object */
/* (can't see how could be NULL, but check just in case) */
- if( text->compiled ){
- Py_DECREF( (PyObject *)text->compiled );
+ if(text->compiled){
+ Py_DECREF((PyObject *)text->compiled);
}
/* compile the buffer */
- buf = txt_to_buf( text );
- text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
- MEM_freeN( buf );
+ buf= txt_to_buf(text);
+ text->compiled= Py_CompileString(buf, text->id.name+2, Py_file_input);
+ MEM_freeN(buf);
/* if compile failed.... return this error */
- if( PyErr_Occurred( ) ) {
- PyErr_Print( );
- PyErr_Clear( );
+ if(PyErr_Occurred()) {
+ PyErr_Print();
+ PyErr_Clear();
PySys_SetObject("last_traceback", NULL);
- free_compiled_text( text );
+ free_compiled_text(text);
return NULL;
}
/* make into a module */
- return PyImport_ExecCodeModule( (char *)name, text->compiled );
+ return PyImport_ExecCodeModule((char *)name, text->compiled);
}
-static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw)
+static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw)
{
PyObject *exception, *err, *tb;
char *name;
int found= 0;
- PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
+ PyObject *globals= NULL, *locals= NULL, *fromlist= NULL;
int level= -1; /* relative imports */
PyObject *newmodule;
//PyObject_Print(args, stderr, 0);
- static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL};
+ static const char *kwlist[]= {"name", "globals", "locals", "fromlist", "level", NULL};
- if( !PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist,
- &name, &globals, &locals, &fromlist, &level) )
+ if(!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist,
+ &name, &globals, &locals, &fromlist, &level))
return NULL;
/* import existing builtin modules or modules that have been imported already */
@@ -222,28 +222,28 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObjec
if(newmodule)
return newmodule;
- PyErr_Fetch( &exception, &err, &tb ); /* get the python error incase we cant import as blender text either */
+ PyErr_Fetch(&exception, &err, &tb); /* get the python error incase we cant import as blender text either */
/* importing from existing modules failed, see if we have this module as blender text */
- newmodule = bpy_text_import_name( name, &found );
+ newmodule= bpy_text_import_name(name, &found);
- if( newmodule ) {/* found module as blender text, ignore above exception */
- PyErr_Clear( );
- Py_XDECREF( exception );
- Py_XDECREF( err );
- Py_XDECREF( tb );
- /* printf( "imported from text buffer...\n" ); */
+ if(newmodule) {/* found module as blender text, ignore above exception */
+ PyErr_Clear();
+ Py_XDECREF(exception);
+ Py_XDECREF(err);
+ Py_XDECREF(tb);
+ /* printf("imported from text buffer...\n"); */
}
else if (found==1) { /* blender text module failed to execute but was found, use its error message */
- Py_XDECREF( exception );
- Py_XDECREF( err );
- Py_XDECREF( tb );
+ Py_XDECREF(exception);
+ Py_XDECREF(err);
+ Py_XDECREF(tb);
return NULL;
}
else {
/* no blender text was found that could import the module
* rause the original error from PyImport_ImportModuleEx */
- PyErr_Restore( exception, err, tb );
+ PyErr_Restore(exception, err, tb);
}
return newmodule;
}
@@ -256,42 +256,42 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObjec
static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module)
{
PyObject *exception, *err, *tb;
- PyObject *newmodule = NULL;
+ PyObject *newmodule= NULL;
int found= 0;
/* try reimporting from file */
- newmodule = PyImport_ReloadModule( module );
- if( newmodule )
+ newmodule= PyImport_ReloadModule(module);
+ if(newmodule)
return newmodule;
/* no file, try importing from memory */
- PyErr_Fetch( &exception, &err, &tb ); /*restore for probable later use */
-
- newmodule = bpy_text_reimport( module, &found );
- if( newmodule ) {/* found module as blender text, ignore above exception */
- PyErr_Clear( );
- Py_XDECREF( exception );
- Py_XDECREF( err );
- Py_XDECREF( tb );
- /* printf( "imported from text buffer...\n" ); */
+ PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */
+
+ newmodule= bpy_text_reimport(module, &found);
+ if(newmodule) {/* found module as blender text, ignore above exception */
+ PyErr_Clear();
+ Py_XDECREF(exception);
+ Py_XDECREF(err);
+ Py_XDECREF(tb);
+ /* printf("imported from text buffer...\n"); */
}
else if (found==1) { /* blender text module failed to execute but was found, use its error message */
- Py_XDECREF( exception );
- Py_XDECREF( err );
- Py_XDECREF( tb );
+ Py_XDECREF(exception);
+ Py_XDECREF(err);
+ Py_XDECREF(tb);
return NULL;
}
else {
/* no blender text was found that could import the module
* rause the original error from PyImport_ImportModuleEx */
- PyErr_Restore( exception, err, tb );
+ PyErr_Restore(exception, err, tb);
}
return newmodule;
}
-PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
-PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
+PyMethodDef bpy_import_meth= {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
+PyMethodDef bpy_reload_meth= {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
/* Clear user modules.
@@ -327,7 +327,7 @@ void bpy_text_clear_modules(int clear_all)
/* looping over the dict */
PyObject *key, *value;
- int pos = 0;
+ int pos= 0;
/* new list */
PyObject *list;
@@ -344,7 +344,7 @@ void bpy_text_clear_modules(int clear_all)
fname= PyModule_GetFilename(value);
if(fname) {
if (clear_all || ((strstr(fname, SEPSTR))==0)) { /* no path ? */
- file_extension = strstr(fname, ".py");
+ file_extension= strstr(fname, ".py");
if(file_extension && (*(file_extension + 3) == '\0' || *(file_extension + 4) == '\0')) { /* .py or pyc extension? */
/* now we can be fairly sure its a python import from the blendfile */
PyList_Append(list, key); /* free'd with the list */
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index 1319c670093..7cb1728f817 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -315,28 +315,28 @@ PyMODINIT_FUNC BPyInit_mathutils(void)
PyObject *submodule;
PyObject *item;
- if( PyType_Ready( &vector_Type ) < 0 )
+ if(PyType_Ready(&vector_Type) < 0)
return NULL;
- if( PyType_Ready( &matrix_Type ) < 0 )
+ if(PyType_Ready(&matrix_Type) < 0)
return NULL;
- if( PyType_Ready( &euler_Type ) < 0 )
+ if(PyType_Ready(&euler_Type) < 0)
return NULL;
- if( PyType_Ready( &quaternion_Type ) < 0 )
+ if(PyType_Ready(&quaternion_Type) < 0)
return NULL;
- if( PyType_Ready( &color_Type ) < 0 )
+ if(PyType_Ready(&color_Type) < 0)
return NULL;
submodule = PyModule_Create(&M_Mathutils_module_def);
/* each type has its own new() function */
- PyModule_AddObject( submodule, "Vector", (PyObject *)&vector_Type );
- PyModule_AddObject( submodule, "Matrix", (PyObject *)&matrix_Type );
- PyModule_AddObject( submodule, "Euler", (PyObject *)&euler_Type );
- PyModule_AddObject( submodule, "Quaternion", (PyObject *)&quaternion_Type );
- PyModule_AddObject( submodule, "Color", (PyObject *)&color_Type );
+ PyModule_AddObject(submodule, "Vector", (PyObject *)&vector_Type);
+ PyModule_AddObject(submodule, "Matrix", (PyObject *)&matrix_Type);
+ PyModule_AddObject(submodule, "Euler", (PyObject *)&euler_Type);
+ PyModule_AddObject(submodule, "Quaternion", (PyObject *)&quaternion_Type);
+ PyModule_AddObject(submodule, "Color", (PyObject *)&color_Type);
/* submodule */
- PyModule_AddObject( submodule, "geometry", (item=BPyInit_mathutils_geometry()));
+ PyModule_AddObject(submodule, "geometry", (item=BPyInit_mathutils_geometry()));
/* XXX, python doesnt do imports with this usefully yet
* 'from mathutils.geometry import PolyFill'
* ...fails without this. */
diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/generic/mathutils_Color.c
index aa5d6e1b817..2b68828ea0a 100644
--- a/source/blender/python/generic/mathutils_Color.c
+++ b/source/blender/python/generic/mathutils_Color.c
@@ -243,7 +243,7 @@ static int Color_ass_slice(ColorObject * self, int begin, int end, PyObject * se
CLAMP(begin, 0, COLOR_SIZE);
if (end<0) end= (COLOR_SIZE + 1) + end;
CLAMP(end, 0, COLOR_SIZE);
- begin = MIN2(begin,end);
+ begin = MIN2(begin, end);
if((size=mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1)
return -1;
@@ -270,7 +270,8 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item)
if (i < 0)
i += COLOR_SIZE;
return Color_item(self, i);
- } else if (PySlice_Check(item)) {
+ }
+ else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
@@ -343,7 +344,7 @@ static PyMappingMethods Color_AsMapping = {
};
/* color channel, vector.r/g/b */
-static PyObject *Color_getChannel( ColorObject * self, void *type )
+static PyObject *Color_getChannel(ColorObject * self, void *type)
{
return Color_item(self, GET_INT_FROM_POINTER(type));
}
@@ -354,7 +355,7 @@ static int Color_setChannel(ColorObject * self, PyObject * value, void * type)
}
/* color channel (HSV), color.h/s/v */
-static PyObject *Color_getChannelHSV( ColorObject * self, void *type )
+static PyObject *Color_getChannelHSV(ColorObject * self, void *type)
{
float hsv[3];
int i= GET_INT_FROM_POINTER(type);
@@ -445,7 +446,7 @@ static PyGetSetDef Color_getseters[] = {
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
{(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/generic/mathutils_Euler.c
index 13a93260267..d8dd4e5fbb3 100644
--- a/source/blender/python/generic/mathutils_Euler.c
+++ b/source/blender/python/generic/mathutils_Euler.c
@@ -199,7 +199,7 @@ static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
const char *axis;
if(!PyArg_ParseTuple(args, "sf:rotate", &axis, &angle)){
- PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x,y,z)");
+ PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x, y, z)");
return NULL;
}
if(!(ELEM3(*axis, 'X', 'Y', 'Z') && axis[1]=='\0')){
@@ -428,7 +428,7 @@ static int Euler_ass_slice(EulerObject * self, int begin, int end, PyObject * se
CLAMP(begin, 0, EULER_SIZE);
if (end<0) end= (EULER_SIZE + 1) + end;
CLAMP(end, 0, EULER_SIZE);
- begin = MIN2(begin,end);
+ begin = MIN2(begin, end);
if((size=mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1)
return -1;
@@ -455,7 +455,8 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item)
if (i < 0)
i += EULER_SIZE;
return Euler_item(self, i);
- } else if (PySlice_Check(item)) {
+ }
+ else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
@@ -531,7 +532,7 @@ static PyMappingMethods Euler_AsMapping = {
/*
* euler axis, euler.x/y/z
*/
-static PyObject *Euler_getAxis(EulerObject *self, void *type )
+static PyObject *Euler_getAxis(EulerObject *self, void *type)
{
return Euler_item(self, GET_INT_FROM_POINTER(type));
}
@@ -574,7 +575,7 @@ static PyGetSetDef Euler_getseters[] = {
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
{(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c
index 8ff38205819..c048058f63c 100644
--- a/source/blender/python/generic/mathutils_Matrix.c
+++ b/source/blender/python/generic/mathutils_Matrix.c
@@ -114,7 +114,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
/* matrix vector callbacks, this is so you can do matrix[i][j] = val */
//----------------------------------mathutils.Matrix() -----------------
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
+//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
//create a new matrix type
static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
@@ -185,7 +185,7 @@ static void matrix_3x3_as_4x4(float mat[16])
/*-----------------------CLASS-METHODS----------------------------*/
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
+//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
static char C_Matrix_Rotation_doc[] =
".. classmethod:: Rotation(angle, size, axis)\n"
"\n"
@@ -257,21 +257,24 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
mat[1] = (float) sin (angle);
mat[2] = -((float) sin(angle));
mat[3] = (float) cos(angle);
- } else if(strcmp(axis, "X") == 0) {
+ }
+ else if(strcmp(axis, "X") == 0) {
//rotation around X
mat[0] = 1.0f;
mat[4] = (float) cos(angle);
mat[5] = (float) sin(angle);
mat[7] = -((float) sin(angle));
mat[8] = (float) cos(angle);
- } else if(strcmp(axis, "Y") == 0) {
+ }
+ else if(strcmp(axis, "Y") == 0) {
//rotation around Y
mat[0] = (float) cos(angle);
mat[2] = -((float) sin(angle));
mat[4] = 1.0f;
mat[6] = (float) sin(angle);
mat[8] = (float) cos(angle);
- } else if(strcmp(axis, "Z") == 0) {
+ }
+ else if(strcmp(axis, "Z") == 0) {
//rotation around Z
mat[0] = (float) cos(angle);
mat[1] = (float) sin(angle);
@@ -316,7 +319,7 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
return newMatrixObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls);
}
//----------------------------------mathutils.Matrix.Scale() -------------
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
+//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
static char C_Matrix_Scale_doc[] =
".. classmethod:: Scale(factor, size, axis)\n"
"\n"
@@ -399,7 +402,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
}
//----------------------------------mathutils.Matrix.OrthoProjection() ---
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
+//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
static char C_Matrix_OrthoProjection_doc[] =
".. classmethod:: OrthoProjection(axis, size)\n"
"\n"
@@ -610,7 +613,8 @@ static float matrix_determinant_internal(MatrixObject *self)
if(self->row_size == 2) {
return determinant_m2(self->matrix[0][0], self->matrix[0][1],
self->matrix[1][0], self->matrix[1][1]);
- } else if(self->row_size == 3) {
+ }
+ else if(self->row_size == 3) {
return determinant_m3(self->matrix[0][0], self->matrix[0][1],
self->matrix[0][2], self->matrix[1][0],
self->matrix[1][1], self->matrix[1][2],
@@ -644,9 +648,10 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
return NULL;
}
if(self->col_size == 3){
- mat3_to_quat( quat,(float (*)[3])self->contigPtr);
- }else{
- mat4_to_quat( quat,(float (*)[4])self->contigPtr);
+ mat3_to_quat(quat, (float (*)[3])self->contigPtr);
+ }
+ else {
+ mat4_to_quat(quat, (float (*)[4])self->contigPtr);
}
return newQuaternionObject(quat, Py_NEW, NULL);
@@ -691,10 +696,12 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
/*must be 3-4 cols, 3-4 rows, square matrix*/
if(self->col_size ==3 && self->row_size ==3) {
mat= (float (*)[3])self->contigPtr;
- }else if (self->col_size ==4 && self->row_size ==4) {
+ }
+ else if (self->col_size ==4 && self->row_size ==4) {
copy_m3_m4(tmat, (float (*)[4])self->contigPtr);
mat= tmat;
- }else {
+ }
+ else {
PyErr_SetString(PyExc_AttributeError, "Matrix.to_euler(): inappropriate matrix size - expects 3x3 or 4x4 matrix");
return NULL;
}
@@ -707,7 +714,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
}
if(eul_compat) {
- if(order == 1) mat3_to_compatible_eul( eul, eul_compatf, mat);
+ if(order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat);
else mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
}
else {
@@ -751,7 +758,8 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
index = (4 * (self->row_size + (blank_rows - 1))) + x;
if (index == 10 || index == 15){
self->contigPtr[index] = 1.0f;
- }else{
+ }
+ else {
self->contigPtr[index] = 0.0f;
}
}
@@ -759,7 +767,7 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
for(x = 1; x <= self->row_size; x++){
first_row_elem = (self->col_size * (self->row_size - x));
curr_pos = (first_row_elem + (self->col_size -1));
- new_pos = (4 * (self->row_size - x )) + (curr_pos - first_row_elem);
+ new_pos = (4 * (self->row_size - x)) + (curr_pos - first_row_elem);
for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){
self->contigPtr[new_pos + blank_columns] = 0.0f;
}
@@ -1346,7 +1354,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
CLAMP(begin, 0, self->row_size);
CLAMP(end, 0, self->row_size);
- begin= MIN2(begin,end);
+ begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
for(count= begin; count < end; count++) {
@@ -1368,7 +1376,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
CLAMP(begin, 0, self->row_size);
CLAMP(end, 0, self->row_size);
- begin = MIN2(begin,end);
+ begin = MIN2(begin, end);
/* non list/tuple cases */
if(!(value_fast=PySequence_Fast(value, "matrix[begin:end] = value"))) {
@@ -1712,7 +1720,7 @@ static PyGetSetDef Matrix_getseters[] = {
{(char *)"is_negative", (getter)Matrix_getIsNegative, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
{(char *)"owner",(getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------METHOD DEFINITIONS ----------------------*/
@@ -1873,7 +1881,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign
}
}
}
- else if (rowSize == colSize ) { /*or if no arguments are passed return identity matrix for square matrices */
+ else if (rowSize == colSize) { /*or if no arguments are passed return identity matrix for square matrices */
PyObject *ret_dummy= Matrix_identity(self);
Py_DECREF(ret_dummy);
}
diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/generic/mathutils_Quaternion.c
index c5fb7e61e6d..75d79d5afac 100644
--- a/source/blender/python/generic/mathutils_Quaternion.c
+++ b/source/blender/python/generic/mathutils_Quaternion.c
@@ -136,7 +136,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
if(BaseMath_ReadCallback(self) == -1)
return NULL;
- quat_to_mat3( (float (*)[3]) mat,self->quat);
+ quat_to_mat3((float (*)[3])mat, self->quat);
return newMatrixObject(mat, 3, 3, Py_NEW, NULL);
}
@@ -283,7 +283,7 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
}
//----------------------------Quaternion.normalize()----------------
-//normalize the axis of rotation of [theta,vector]
+//normalize the axis of rotation of [theta, vector]
static char Quaternion_normalize_doc[] =
".. function:: normalize()\n"
"\n"
@@ -562,7 +562,7 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
CLAMP(begin, 0, QUAT_SIZE);
if (end<0) end= (QUAT_SIZE + 1) + end;
CLAMP(end, 0, QUAT_SIZE);
- begin = MIN2(begin,end);
+ begin = MIN2(begin, end);
if((size=mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1)
return -1;
@@ -721,7 +721,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
}
- /* the only case this can happen (for a supported type is "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.0 && PyErr_Occurred())==0) {
return quat_mul_float(quat2, scalar);
@@ -811,12 +811,12 @@ static PyNumberMethods Quaternion_NumMethods = {
NULL, /* nb_index */
};
-static PyObject *Quaternion_getAxis( QuaternionObject *self, void *type )
+static PyObject *Quaternion_getAxis(QuaternionObject *self, void *type)
{
return Quaternion_item(self, GET_INT_FROM_POINTER(type));
}
-static int Quaternion_setAxis( QuaternionObject *self, PyObject *value, void *type )
+static int Quaternion_setAxis(QuaternionObject *self, PyObject *value, void *type)
{
return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
@@ -864,7 +864,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
angle= fmod(angle + M_PI*2, M_PI*4) - M_PI*2;
/* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */
- if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
) {
@@ -894,7 +894,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
quat_to_axis_angle(axis, &angle, tquat);
/* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */
- if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
) {
@@ -1022,7 +1022,7 @@ static PyGetSetDef Quaternion_getseters[] = {
{(char *)"axis",(getter)Quaternion_getAxisVec, (setter)Quaternion_setAxisVec, (char *)"quaternion axis as a vector.\n\n:type: :class:`Vector`", NULL},
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
{(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
//------------------PY_OBECT DEFINITION--------------------------
@@ -1103,12 +1103,13 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
self->quat = PyMem_Malloc(QUAT_SIZE * sizeof(float));
if(!quat) { //new empty
unit_qt(self->quat);
- }else{
+ }
+ else {
QUATCOPY(self->quat, quat);
}
self->wrapped = Py_NEW;
}
- else{
+ else {
PyErr_SetString(PyExc_RuntimeError, "Quaternion(): invalid type");
return NULL;
}
diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c
index ccb81603b3c..0ea380d1ee6 100644
--- a/source/blender/python/generic/mathutils_Vector.c
+++ b/source/blender/python/generic/mathutils_Vector.c
@@ -228,10 +228,12 @@ static PyObject *Vector_resize_4d(VectorObject *self)
PyErr_SetString(PyExc_MemoryError, "vector.resize_4d(): problem allocating pointer space");
return NULL;
}
+
if(self->size == 2){
self->vec[2] = 0.0f;
self->vec[3] = 1.0f;
- }else if(self->size == 3){
+ }
+ else if(self->size == 3){
self->vec[3] = 1.0f;
}
self->size = 4;
@@ -354,13 +356,13 @@ static char Vector_to_track_quat_doc[] =
" :return: rotation from the vector and the track and up axis.\n"
" :rtype: :class:`Quaternion`\n"
;
-static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args )
+static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
{
float vec[3], quat[4];
const char *strack, *sup;
short track = 2, up = 1;
- if(!PyArg_ParseTuple( args, "|ss:to_track_quat", &strack, &sup))
+ if(!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup))
return NULL;
if (self->size != 3) {
@@ -451,7 +453,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args )
*/
negate_v3_v3(vec, self->vec);
- vec_to_quat( quat,vec, track, up);
+ vec_to_quat(quat, vec, track, up);
return newQuaternionObject(quat, Py_NEW, NULL);
}
@@ -873,7 +875,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end,
CLAMP(begin, 0, self->size);
CLAMP(end, 0, self->size);
- begin = MIN2(begin,end);
+ begin = MIN2(begin, end);
size = (end - begin);
if(mathutils_array_parse(vec, size, size, seq, "vector[begin:end] = [...]") == -1)
@@ -1066,7 +1068,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
/* make sure v1 is always the vector */
- if (vec1 && vec2 ) {
+ if (vec1 && vec2) {
int i;
double dot = 0.0f;
@@ -1170,7 +1172,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
}
(void)BaseMath_WriteCallback(vec);
- Py_INCREF( v1 );
+ Py_INCREF(v1);
return v1;
}
@@ -1231,7 +1233,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
(void)BaseMath_WriteCallback(vec1);
- Py_INCREF( v1 );
+ Py_INCREF(v1);
return v1;
}
@@ -1272,12 +1274,13 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
VectorObject *vecA = NULL, *vecB = NULL;
int result = 0;
float epsilon = .000001f;
- double lenA,lenB;
+ double lenA, lenB;
if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)){
if (comparison_type == Py_NE){
Py_RETURN_TRUE;
- }else{
+ }
+ else {
Py_RETURN_FALSE;
}
}
@@ -1290,7 +1293,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
if (vecA->size != vecB->size){
if (comparison_type == Py_NE){
Py_RETURN_TRUE;
- }else{
+ }
+ else {
Py_RETURN_FALSE;
}
}
@@ -1299,16 +1303,17 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
case Py_LT:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA < lenB ){
+ if(lenA < lenB){
result = 1;
}
break;
case Py_LE:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA < lenB ){
+ if(lenA < lenB){
result = 1;
- }else{
+ }
+ else {
result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB));
}
break;
@@ -1321,16 +1326,17 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
case Py_GT:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA > lenB ){
+ if(lenA > lenB){
result = 1;
}
break;
case Py_GE:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA > lenB ){
+ if(lenA > lenB){
result = 1;
- }else{
+ }
+ else {
result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB));
}
break;
@@ -1340,7 +1346,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
}
if (result == 1){
Py_RETURN_TRUE;
- }else{
+ }
+ else {
Py_RETURN_FALSE;
}
}
@@ -1369,7 +1376,8 @@ static PyObject *Vector_subscript(VectorObject* self, PyObject* item)
if (i < 0)
i += self->size;
return Vector_item(self, i);
- } else if (PySlice_Check(item)) {
+ }
+ else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
@@ -2001,7 +2009,7 @@ static PyGetSetDef Vector_getseters[] = {
{(char *)"wwwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3071
{(char *)"wwwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3583
{(char *)"wwww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4095
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/* Python script used to make swizzle array */
@@ -2061,7 +2069,8 @@ static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObj
if(mat->colSize == 4 && vec_size != 3){
PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
return -1;
- }else{
+ }
+ else {
vec_cpy[3] = 1.0f;
}
}
@@ -2156,12 +2165,12 @@ PyTypeObject vector_Type = {
/* Methods to implement standard operations */
- ( destructor ) BaseMathObject_dealloc,/* destructor tp_dealloc; */
+ (destructor) BaseMathObject_dealloc,/* destructor tp_dealloc; */
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) Vector_repr, /* reprfunc tp_repr; */
+ (reprfunc)Vector_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c
index 03501ae817d..a0991e00d07 100644
--- a/source/blender/python/generic/mathutils_geometry.c
+++ b/source/blender/python/generic/mathutils_geometry.c
@@ -48,7 +48,7 @@
#include "BKE_curve.h"
-#define SWAP_FLOAT(a,b,tmp) tmp=a; a=b; b=tmp
+#define SWAP_FLOAT(a, b, tmp) tmp=a; a=b; b=tmp
#define eps 0.000001
@@ -446,7 +446,8 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
index++;
}
freedisplist(&dispbase);
- } else {
+ }
+ else {
/* no points, do this so scripts dont barf */
freedisplist(&dispbase); /* possible some dl was allocated */
tri_list= PyList_New(0);
@@ -489,7 +490,8 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
if(isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) {
return newVectorObject(vi, 2, Py_NEW, NULL);
- } else {
+ }
+ else {
Py_RETURN_NONE;
}
}
@@ -537,7 +539,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
else { l2[2]=0.0; VECCOPY2D(l2, line_2->vec) }
/* do the calculation */
- lambda= closest_to_line_v3(pt_out,pt_in, l1, l2);
+ lambda= closest_to_line_v3(pt_out, pt_in, l1, l2);
ret= PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, newVectorObject(pt_out, 3, Py_NEW, NULL));
@@ -684,7 +686,7 @@ static char M_Geometry_box_pack_2d_doc[] =
"\n"
" Returns the normal of the 3D tri or quad.\n"
"\n"
-" :arg boxes: list of boxes, each box is a list where the first 4 items are [x,y, width, height, ...] other items are ignored.\n"
+" :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, width, height, ...] other items are ignored.\n"
" :type boxes: list\n"
" :return: the width and height of the packed bounding box\n"
" :rtype: tuple, pair of floats\n"
@@ -697,7 +699,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
PyObject *ret;
if(!PyList_Check(boxlist)) {
- PyErr_SetString(PyExc_TypeError, "expected a list of boxes [[x,y,w,h], ... ]");
+ PyErr_SetString(PyExc_TypeError, "expected a list of boxes [[x, y, w, h], ... ]");
return NULL;
}
diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c
index b4ad761a305..dbae0fb13bc 100644
--- a/source/blender/python/generic/noise_py_api.c
+++ b/source/blender/python/generic/noise_py_api.c
@@ -212,8 +212,10 @@ static void randuvec(float v[3])
r = (float)sqrt(r);
v[0] = (float)(r * cos(a));
v[1] = (float)(r * sin(a));
- } else
+ }
+ else {
v[2] = 1.f;
+ }
}
static PyObject *Noise_random(PyObject *UNUSED(self))
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 113a553c6f5..fd44e09003e 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -150,9 +150,11 @@ PyObject *PyC_ExceptionBuffer(void)
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;
}
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 9abe4c9d94b..169d8a8ea6c 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -100,8 +100,8 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
char filepath_expanded[1024];
const char *lib;
- int absolute = 0;
- static const char *kwlist[] = {"absolute", NULL};
+ int absolute= 0;
+ static const char *kwlist[]= {"absolute", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|i:blend_paths", (char **)kwlist, &absolute))
return NULL;
@@ -114,7 +114,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
}
else {
- lib = BLI_bpathIterator_getLib(bpi);
+ lib= BLI_bpathIterator_getLib(bpi);
if (lib && (strcmp(lib, BLI_bpathIterator_getBasePath(bpi)))) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
}
@@ -134,13 +134,13 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
}
-// static char bpy_user_resource_doc[] = // now in bpy/utils.py
+// static char bpy_user_resource_doc[]= // now in bpy/utils.py
static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
char *subdir= NULL;
int folder_id;
- static const char *kwlist[] = {"type", "subdir", NULL};
+ static const char *kwlist[]= {"type", "subdir", NULL};
char *path;
@@ -161,14 +161,14 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
path= BLI_get_folder(folder_id, subdir);
if (!path)
- path = BLI_get_user_folder_notest(folder_id, subdir);
+ path= BLI_get_user_folder_notest(folder_id, subdir);
return PyUnicode_DecodeFSDefault(path ? path : "");
}
-static PyMethodDef meth_bpy_script_paths = {"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc};
-static PyMethodDef meth_bpy_blend_paths = {"blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS|METH_KEYWORDS, bpy_blend_paths_doc};
-static PyMethodDef meth_bpy_user_resource = {"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS|METH_KEYWORDS, NULL};
+static PyMethodDef meth_bpy_script_paths= {"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc};
+static PyMethodDef meth_bpy_blend_paths= {"blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS|METH_KEYWORDS, bpy_blend_paths_doc};
+static PyMethodDef meth_bpy_user_resource= {"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS|METH_KEYWORDS, NULL};
static PyObject *bpy_import_test(const char *modname)
{
@@ -209,7 +209,7 @@ void BPy_init_modules( void )
/* stand alone utility modules not related to blender directly */
IDProp_Init_Types(); /* not actually a submodule, just types */
- mod = PyModule_New("_bpy");
+ mod= PyModule_New("_bpy");
/* add the module so we can import it */
PyDict_SetItemString(PyImport_GetModuleDict(), "_bpy", mod);
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index c4e2500f221..d59d87c14b9 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -56,7 +56,7 @@ extern char build_system[];
static PyTypeObject BlenderAppType;
-static PyStructSequence_Field app_info_fields[] = {
+static PyStructSequence_Field app_info_fields[]= {
{(char *)"version", (char *)"The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{(char *)"version_string", (char *)"The Blender version formatted as a string"},
{(char *)"binary_path", (char *)"The location of blenders executable, useful for utilities that spawn new instances"},
@@ -75,7 +75,7 @@ static PyStructSequence_Field app_info_fields[] = {
{NULL}
};
-static PyStructSequence_Desc app_info_desc = {
+static PyStructSequence_Desc app_info_desc= {
(char *)"bpy.app", /* name */
(char *)"This module contains application values that remain unchanged during runtime.", /* doc */
app_info_fields, /* fields */
@@ -87,9 +87,9 @@ static PyObject *make_app_info(void)
extern char bprogname[]; /* argv[0] from creator.c */
PyObject *app_info;
- int pos = 0;
+ int pos= 0;
- app_info = PyStructSequence_New(&BlenderAppType);
+ app_info= PyStructSequence_New(&BlenderAppType);
if (app_info == NULL) {
return NULL;
}
@@ -229,8 +229,8 @@ PyObject *BPY_app_struct(void)
ret= make_app_info();
/* prevent user from creating new instances */
- BlenderAppType.tp_init = NULL;
- BlenderAppType.tp_new = NULL;
+ BlenderAppType.tp_init= NULL;
+ BlenderAppType.tp_new= NULL;
/* kindof a hack ontop of PyStructSequence */
py_struct_seq_getset_init();
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index 0445298649f..27260aed8d2 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -42,7 +42,7 @@
#include "bpy_driver.h"
/* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */
-PyObject *bpy_pydriver_Dict = NULL;
+PyObject *bpy_pydriver_Dict= NULL;
/* For faster execution we keep a special dictionary for pydrivers, with
* the needed modules and aliases.
@@ -54,16 +54,16 @@ int bpy_pydriver_create_dict(void)
/* validate namespace for driver evaluation */
if (bpy_pydriver_Dict) return -1;
- d = PyDict_New();
+ d= PyDict_New();
if (d == NULL)
return -1;
else
- bpy_pydriver_Dict = d;
+ bpy_pydriver_Dict= d;
/* import some modules: builtins, bpy, math, (Blender.noise )*/
PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins());
- mod = PyImport_ImportModule("math");
+ mod= PyImport_ImportModule("math");
if (mod) {
PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
Py_DECREF(mod);
@@ -90,12 +90,12 @@ void BPY_driver_reset(void)
int use_gil= 1; // (PyThreadState_Get()==NULL);
if(use_gil)
- gilstate = PyGILState_Ensure();
+ gilstate= PyGILState_Ensure();
if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
PyDict_Clear(bpy_pydriver_Dict);
Py_DECREF(bpy_pydriver_Dict);
- bpy_pydriver_Dict = NULL;
+ bpy_pydriver_Dict= NULL;
}
if(use_gil)
@@ -132,13 +132,13 @@ float BPY_driver_exec(ChannelDriver *driver)
int use_gil;
DriverVar *dvar;
- double result = 0.0; /* default return */
- char *expr = NULL;
+ double result= 0.0; /* default return */
+ char *expr= NULL;
short targets_ok= 1;
int i;
/* get the py expression to be evaluated */
- expr = driver->expression;
+ expr= driver->expression;
if ((expr == NULL) || (expr[0]=='\0'))
return 0.0f;
@@ -150,7 +150,7 @@ float BPY_driver_exec(ChannelDriver *driver)
use_gil= 1; //(PyThreadState_Get()==NULL);
if(use_gil)
- gilstate = PyGILState_Ensure();
+ gilstate= PyGILState_Ensure();
/* init global dictionary for py-driver evaluation settings */
if (!bpy_pydriver_Dict) {
@@ -200,10 +200,10 @@ float BPY_driver_exec(ChannelDriver *driver)
}
/* add target values to a dict that will be used as '__locals__' dict */
- driver_vars = PyDict_New(); // XXX do we need to decref this?
+ driver_vars= PyDict_New(); // XXX do we need to decref this?
for (dvar= driver->variables.first, i=0; dvar; dvar= dvar->next) {
- PyObject *driver_arg = NULL;
- float tval = 0.0f;
+ PyObject *driver_arg= NULL;
+ float tval= 0.0f;
/* try to get variable value */
tval= driver_get_variable_value(driver, dvar);
@@ -228,7 +228,7 @@ float BPY_driver_exec(ChannelDriver *driver)
#if 0 // slow, with this can avoid all Py_CompileString above.
/* execute expression to get a value */
- retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
+ retval= PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
#else
/* evaluate the compiled expression */
if (expr_code)
@@ -241,10 +241,11 @@ float BPY_driver_exec(ChannelDriver *driver)
/* process the result */
if (retval == NULL) {
pydriver_error(driver);
- } else if((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) {
+ }
+ else if((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) {
pydriver_error(driver);
Py_DECREF(retval);
- result = 0.0;
+ result= 0.0;
}
else {
/* all fine, make sure the "invalid expression" flag is cleared */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 58e277d9766..fb598c1ac30 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -80,7 +80,7 @@ BPy_StructRNA *bpy_context_module= NULL; /* for fast access */
#ifdef TIME_PY_RUN
#include "PIL_time.h"
-static int bpy_timer_count = 0;
+static int bpy_timer_count= 0;
static double bpy_timer; /* time since python starts */
static double bpy_timer_run; /* time for each python script run */
static double bpy_timer_run_tot; /* accumulate python runs */
@@ -91,7 +91,7 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
py_call_level++;
if(gilstate)
- *gilstate = PyGILState_Ensure();
+ *gilstate= PyGILState_Ensure();
if(py_call_level==1) {
@@ -109,7 +109,7 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
if(bpy_timer_count==0) {
/* record time from the beginning */
bpy_timer= PIL_check_seconds_timer();
- bpy_timer_run = bpy_timer_run_tot = 0.0;
+ bpy_timer_run= bpy_timer_run_tot= 0.0;
}
bpy_timer_run= PIL_check_seconds_timer();
@@ -145,9 +145,9 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
void BPY_text_free_code(Text *text)
{
- if( text->compiled ) {
- Py_DECREF( ( PyObject * ) text->compiled );
- text->compiled = NULL;
+ if(text->compiled) {
+ Py_DECREF((PyObject *)text->compiled);
+ text->compiled= NULL;
}
}
@@ -155,8 +155,8 @@ void BPY_modules_update(bContext *C)
{
#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec.
PyObject *mod= PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
- PyModule_AddObject( mod, "data", BPY_rna_module() );
- PyModule_AddObject( mod, "types", BPY_rna_types() ); // atm this does not need updating
+ PyModule_AddObject(mod, "data", BPY_rna_module());
+ PyModule_AddObject(mod, "types", BPY_rna_types()); // atm this does not need updating
#endif
/* refreshes the main struct */
@@ -228,7 +228,7 @@ static struct _inittab bpy_internal_modules[]= {
void BPY_python_start(int argc, const char **argv)
{
#ifndef WITH_PYTHON_MODULE
- PyThreadState *py_tstate = NULL;
+ PyThreadState *py_tstate= NULL;
/* not essential but nice to set our name */
static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */
@@ -245,9 +245,9 @@ void BPY_python_start(int argc, const char **argv)
* alternatively we could copy the file. */
Py_NoSiteFlag= 1;
- Py_Initialize( );
+ Py_Initialize();
- // PySys_SetArgv( argc, argv); // broken in py3, not a huge deal
+ // PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
/* sigh, why do python guys not have a char** version anymore? :( */
{
int i;
@@ -274,9 +274,9 @@ void BPY_python_start(int argc, const char **argv)
{ /* our own import and reload functions */
PyObject *item;
PyObject *mod;
- //PyObject *m = PyImport_AddModule("__builtin__");
- //PyObject *d = PyModule_GetDict(m);
- PyObject *d = PyEval_GetBuiltins( );
+ //PyObject *m= PyImport_AddModule("__builtin__");
+ //PyObject *d= PyModule_GetDict(m);
+ PyObject *d= PyEval_GetBuiltins();
// PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
PyDict_SetItemString(d, "__import__", item=PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
@@ -296,7 +296,7 @@ void BPY_python_start(int argc, const char **argv)
pyrna_alloc_types();
#ifndef WITH_PYTHON_MODULE
- py_tstate = PyGILState_GetThisThreadState();
+ py_tstate= PyGILState_GetThisThreadState();
PyEval_ReleaseThread(py_tstate);
#endif
}
@@ -312,11 +312,11 @@ void BPY_python_end(void)
/* clear all python data from structs */
- Py_Finalize( );
+ Py_Finalize();
#ifdef TIME_PY_RUN
// measure time since py started
- bpy_timer = PIL_check_seconds_timer() - bpy_timer;
+ bpy_timer= PIL_check_seconds_timer() - bpy_timer;
printf("*bpy stats* - ");
printf("tot exec: %d, ", bpy_timer_count);
@@ -380,13 +380,12 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
char fn_dummy[FILE_MAXDIR];
bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
- if( !text->compiled ) { /* if it wasn't already compiled, do it now */
- char *buf = txt_to_buf( text );
+ if(text->compiled == NULL) { /* if it wasn't already compiled, do it now */
+ char *buf= txt_to_buf(text);
- text->compiled =
- Py_CompileString( buf, fn_dummy, Py_file_input );
+ text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
- MEM_freeN( buf );
+ MEM_freeN(buf);
if(PyErr_Occurred()) {
if(do_jump) {
@@ -397,8 +396,8 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
}
if(text->compiled) {
- py_dict = PyC_DefaultNameSpace(fn_dummy);
- py_result = PyEval_EvalCode(text->compiled, py_dict, py_dict);
+ py_dict= PyC_DefaultNameSpace(fn_dummy);
+ py_result= PyEval_EvalCode(text->compiled, py_dict, py_dict);
}
}
@@ -406,7 +405,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
FILE *fp= fopen(fn, "r");
if(fp) {
- py_dict = PyC_DefaultNameSpace(fn);
+ py_dict= PyC_DefaultNameSpace(fn);
#ifdef _WIN32
/* Previously we used PyRun_File to run directly the code on a FILE
@@ -422,11 +421,11 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
pystring= MEM_mallocN(strlen(fn) + 32, "pystring");
pystring[0]= '\0';
sprintf(pystring, "exec(open(r'%s').read())", fn);
- py_result = PyRun_String( pystring, Py_file_input, py_dict, py_dict );
+ py_result= PyRun_String(pystring, Py_file_input, py_dict, py_dict);
MEM_freeN(pystring);
}
#else
- py_result = PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
+ py_result= PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
fclose(fp);
#endif
}
@@ -443,14 +442,15 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
}
}
BPy_errors_to_report(reports);
- } else {
- Py_DECREF( py_result );
+ }
+ else {
+ Py_DECREF(py_result);
}
if(py_dict) {
#ifdef PYMODULE_CLEAR_WORKAROUND
PyModuleObject *mmod= (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
- PyObject *dict_back = mmod->md_dict;
+ PyObject *dict_back= mmod->md_dict;
/* freeing the module will clear the namespace,
* gives problems running classes defined in this namespace being used later. */
mmod->md_dict= NULL;
@@ -481,7 +481,7 @@ int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, co
void BPY_DECREF(void *pyob_ptr)
{
- PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyGILState_STATE gilstate= PyGILState_Ensure();
Py_DECREF((PyObject *)pyob_ptr);
PyGILState_Release(gilstate);
}
@@ -490,7 +490,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value)
{
PyGILState_STATE gilstate;
PyObject *py_dict, *mod, *retval;
- int error_ret = 0;
+ int error_ret= 0;
PyObject *main_mod= NULL;
if (!value || !expr) return -1;
@@ -506,7 +506,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value)
py_dict= PyC_DefaultNameSpace("<blender button>");
- mod = PyImport_ImportModule("math");
+ mod= PyImport_ImportModule("math");
if (mod) {
PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
Py_DECREF(mod);
@@ -516,7 +516,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value)
PyErr_Clear();
}
- retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
+ retval= PyRun_String(expr, Py_eval_input, py_dict, py_dict);
if (retval == NULL) {
error_ret= -1;
@@ -535,7 +535,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value)
}
}
else {
- val = PyFloat_AsDouble(retval);
+ val= PyFloat_AsDouble(retval);
}
Py_DECREF(retval);
@@ -566,7 +566,7 @@ int BPY_string_exec(bContext *C, const char *expr)
PyGILState_STATE gilstate;
PyObject *main_mod= NULL;
PyObject *py_dict, *retval;
- int error_ret = 0;
+ int error_ret= 0;
if (!expr) return -1;
@@ -580,7 +580,7 @@ int BPY_string_exec(bContext *C, const char *expr)
py_dict= PyC_DefaultNameSpace("<blender string>");
- retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
+ retval= PyRun_String(expr, Py_eval_input, py_dict, py_dict);
if (retval == NULL) {
error_ret= -1;
@@ -661,7 +661,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
else {
int len= PySequence_Fast_GET_SIZE(seq_fast);
int i;
- for(i = 0; i < len; i++) {
+ for(i= 0; i < len; i++) {
PyObject *list_item= PySequence_Fast_GET_ITEM(seq_fast, i);
if(BPy_StructRNA_Check(list_item)) {
@@ -701,7 +701,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
/* TODO, reloading the module isnt functional at the moment. */
extern int main_python(int argc, const char **argv);
-static struct PyModuleDef bpy_proxy_def = {
+static struct PyModuleDef bpy_proxy_def= {
PyModuleDef_HEAD_INIT,
"bpy", /* m_name */
NULL, /* m_doc */
@@ -744,7 +744,7 @@ void bpy_module_delay_init(PyObject *bpy_proxy)
static void dealloc_obj_dealloc(PyObject *self);
-static PyTypeObject dealloc_obj_Type = {{{0}}};
+static PyTypeObject dealloc_obj_Type= {{{0}}};
/* use our own dealloc so we can free a property if we use one */
static void dealloc_obj_dealloc(PyObject *self)
@@ -778,10 +778,10 @@ PyInit_bpy(void)
dealloc_obj *dob;
/* assign dummy type */
- dealloc_obj_Type.tp_name = "dealloc_obj";
- dealloc_obj_Type.tp_basicsize = sizeof(dealloc_obj);
- dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc;
- dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ dealloc_obj_Type.tp_name= "dealloc_obj";
+ dealloc_obj_Type.tp_basicsize= sizeof(dealloc_obj);
+ dealloc_obj_Type.tp_dealloc= dealloc_obj_dealloc;
+ dealloc_obj_Type.tp_flags= Py_TPFLAGS_DEFAULT;
if(PyType_Ready(&dealloc_obj_Type) < 0)
return NULL;
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index d216c449250..08a0b514a0c 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -62,7 +62,7 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *args);
static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *args);
static PyObject *bpy_lib_dir(BPy_Library *self);
-static PyMethodDef bpy_lib_methods[] = {
+static PyMethodDef bpy_lib_methods[]= {
{"__enter__", (PyCFunction)bpy_lib_enter, METH_NOARGS},
{"__exit__", (PyCFunction)bpy_lib_exit, METH_VARARGS},
{"__dir__", (PyCFunction)bpy_lib_dir, METH_NOARGS},
@@ -76,7 +76,7 @@ static void bpy_lib_dealloc(BPy_Library *self)
}
-PyTypeObject bpy_lib_Type = {
+PyTypeObject bpy_lib_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_lib", /* tp_name */
sizeof(BPy_Library), /* tp_basicsize */
@@ -170,9 +170,9 @@ static char bpy_lib_load_doc[] =
;
static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"filepath", "link", "relative", NULL};
+ 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))
@@ -202,9 +202,9 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype)
names= BLO_blendhandle_get_datablock_names(self->blo_handle, blocktype, &totnames);
if(names) {
- int counter = 0;
- list = PyList_New(totnames);
- for(l = names; l; l = l->next) {
+ int counter= 0;
+ list= PyList_New(totnames);
+ for(l= names; l; l= l->next) {
PyList_SET_ITEM(list, counter, PyUnicode_FromString((char * )l->link));
counter++;
}
@@ -277,7 +277,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
/* here appending/linking starts */
- mainl = BLO_library_append_begin(BPy_GetContext(), &(self->blo_handle), self->relpath);
+ mainl= BLO_library_append_begin(BPy_GetContext(), &(self->blo_handle), self->relpath);
{
int i= 0, code;
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index ad1bce89896..f2ac9b282e1 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -118,7 +118,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
- int error_val = 0;
+ int error_val= 0;
PointerRNA ptr;
int operator_ret= OPERATOR_CANCELLED;
@@ -132,7 +132,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
int context= WM_OP_EXEC_DEFAULT;
// XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it...
- bContext *C = (bContext *)BPy_GetContext();
+ bContext *C= (bContext *)BPy_GetContext();
if(C==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
@@ -259,10 +259,10 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
char *opname;
PyObject *kw= NULL; /* optional args */
- int all_args = 1;
+ int all_args= 1;
int error_val= 0;
- char *buf = NULL;
+ char *buf= NULL;
PyObject *pybuf;
bContext *C= (bContext *)BPy_GetContext();
@@ -311,11 +311,11 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
static PyObject *pyop_dir(PyObject *UNUSED(self))
{
- PyObject *list = PyList_New(0), *name;
+ PyObject *list= PyList_New(0), *name;
wmOperatorType *ot;
for(ot= WM_operatortype_first(); ot; ot= ot->next) {
- name = PyUnicode_FromString(ot->idname);
+ name= PyUnicode_FromString(ot->idname);
PyList_Append(list, name);
Py_DECREF(name);
}
@@ -353,7 +353,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
return (PyObject *)pyrna;
}
-static struct PyMethodDef bpy_ops_methods[] = {
+static struct PyMethodDef bpy_ops_methods[]= {
{"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL},
{"call", (PyCFunction) pyop_call, METH_VARARGS, NULL},
{"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL},
@@ -363,7 +363,7 @@ static struct PyMethodDef bpy_ops_methods[] = {
{NULL, NULL, 0, NULL}
};
-static struct PyModuleDef bpy_ops_module = {
+static struct PyModuleDef bpy_ops_module= {
PyModuleDef_HEAD_INIT,
"_bpy.ops",
NULL,
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 0269625d906..e1ef8aa49c1 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -43,7 +43,7 @@
static void operator_properties_init(wmOperatorType *ot)
{
- PyObject *py_class = ot->ext.data;
+ PyObject *py_class= ot->ext.data;
RNA_struct_blender_type_set(ot->ext.srna, ot);
/* only call this so pyrna_deferred_register_class gives a useful error
@@ -61,7 +61,7 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
{
/* take care not to overwrite anything set in
* WM_operatortype_append_ptr before opfunc() is called */
- StructRNA *srna = ot->srna;
+ StructRNA *srna= ot->srna;
*ot= *((wmOperatorType *)userdata);
ot->srna= srna; /* restore */
@@ -72,7 +72,7 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
PropertyRNA *prop;
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
- prop = RNA_struct_find_property(&ptr, "type");
+ prop= RNA_struct_find_property(&ptr, "type");
if(prop)
ot->prop= prop;
}
@@ -80,16 +80,16 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
void macro_wrapper(wmOperatorType *ot, void *userdata)
{
- wmOperatorType *data = (wmOperatorType *)userdata;
+ wmOperatorType *data= (wmOperatorType *)userdata;
/* only copy a couple of things, the rest is set by the macro registration */
- ot->name = data->name;
- ot->idname = data->idname;
- ot->description = data->description;
+ ot->name= data->name;
+ ot->idname= data->idname;
+ ot->description= data->description;
ot->flag |= data->flag; /* append flags to the one set by registration */
- ot->pyop_poll = data->pyop_poll;
- ot->ui = data->ui;
- ot->ext = data->ext;
+ ot->pyop_poll= data->pyop_poll;
+ ot->ui= data->ui;
+ ot->ext= data->ext;
operator_properties_init(ot);
}
@@ -115,16 +115,16 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
/* identifiers */
srna= srna_from_self(macro, "Macro Define:");
- macroname = RNA_struct_identifier(srna);
+ macroname= RNA_struct_identifier(srna);
- ot = WM_operatortype_find(macroname, TRUE);
+ ot= WM_operatortype_find(macroname, TRUE);
if (!ot) {
PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid macro or hasn't been registered yet", macroname);
return NULL;
}
- otmacro = WM_operatortype_macro_define(ot, opname);
+ otmacro= WM_operatortype_macro_define(ot, opname);
RNA_pointer_create(NULL, &RNA_OperatorTypeMacro, otmacro, &ptr_otmacro);
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 09c62f8b2c8..e51ea048b92 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -47,19 +47,19 @@
#include "../generic/py_capi_utils.h"
-static EnumPropertyItem property_flag_items[] = {
+static EnumPropertyItem property_flag_items[]= {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem property_flag_enum_items[] = {
+static EnumPropertyItem property_flag_enum_items[]= {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
{0, NULL, 0, NULL, NULL}};
/* subtypes */
-static EnumPropertyItem property_subtype_string_items[] = {
+static EnumPropertyItem property_subtype_string_items[]= {
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
@@ -67,7 +67,7 @@ static EnumPropertyItem property_subtype_string_items[] = {
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem property_subtype_number_items[] = {
+static EnumPropertyItem property_subtype_number_items[]= {
{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
{PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
{PROP_FACTOR, "FACTOR", 0, "Factor", ""},
@@ -78,7 +78,7 @@ static EnumPropertyItem property_subtype_number_items[] = {
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem property_subtype_array_items[] = {
+static EnumPropertyItem property_subtype_array_items[]= {
{PROP_COLOR, "COLOR", 0, "Color", ""},
{PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
{PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
@@ -96,17 +96,17 @@ static EnumPropertyItem property_subtype_array_items[] = {
{0, NULL, 0, NULL, NULL}};
/* PyObject's */
-static PyObject *pymeth_BoolProperty = NULL;
-static PyObject *pymeth_BoolVectorProperty = NULL;
-static PyObject *pymeth_IntProperty = NULL;
-static PyObject *pymeth_IntVectorProperty = NULL;
-static PyObject *pymeth_FloatProperty = NULL;
-static PyObject *pymeth_FloatVectorProperty = NULL;
-static PyObject *pymeth_StringProperty = NULL;
-static PyObject *pymeth_EnumProperty = NULL;
-static PyObject *pymeth_PointerProperty = NULL;
-static PyObject *pymeth_CollectionProperty = NULL;
-static PyObject *pymeth_RemoveProperty = NULL;
+static PyObject *pymeth_BoolProperty= NULL;
+static PyObject *pymeth_BoolVectorProperty= NULL;
+static PyObject *pymeth_IntProperty= NULL;
+static PyObject *pymeth_IntVectorProperty= NULL;
+static PyObject *pymeth_FloatProperty= NULL;
+static PyObject *pymeth_FloatVectorProperty= NULL;
+static PyObject *pymeth_StringProperty= NULL;
+static PyObject *pymeth_EnumProperty= NULL;
+static PyObject *pymeth_PointerProperty= NULL;
+static PyObject *pymeth_CollectionProperty= NULL;
+static PyObject *pymeth_RemoveProperty= NULL;
/* operators and classes use this so it can store the args given but defer
@@ -114,7 +114,7 @@ static PyObject *pymeth_RemoveProperty = NULL;
* the default args for that operator instance */
static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
{
- PyObject *ret = PyTuple_New(2);
+ PyObject *ret= PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, func);
Py_INCREF(func);
@@ -213,7 +213,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(BoolProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
int def=0;
@@ -255,7 +255,7 @@ BPY_PROPDEF_DESC_DOC
" :type options: set\n"
" :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', 'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', 'XYZ', 'COLOR_GAMMA', 'LAYER', 'NONE'].\n"
" :type subtype: string\n"
-" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
+" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
;
static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -265,7 +265,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(BoolVectorProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", "size", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "size", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
int def[PYRNA_STACK_ARRAY]={0};
@@ -325,7 +325,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(IntProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def=0;
@@ -368,7 +368,7 @@ BPY_PROPDEF_DESC_DOC
" :type options: set\n"
" :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', 'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', 'XYZ', 'COLOR_GAMMA', 'LAYER', 'NONE'].\n"
" :type subtype: string\n"
-" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
+" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
;
static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -378,7 +378,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(IntVectorProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0};
@@ -441,7 +441,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(FloatProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def=0.0f;
@@ -492,7 +492,7 @@ BPY_PROPDEF_DESC_DOC
" :type options: set\n"
" :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', 'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', 'XYZ', 'COLOR_GAMMA', 'LAYER', 'NONE'].\n"
" :type subtype: string\n"
-" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
+" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
;
static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -502,7 +502,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
BPY_PROPDEF_HEAD(FloatVectorProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def[PYRNA_STACK_ARRAY]={0.0f};
@@ -562,7 +562,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
BPY_PROPDEF_HEAD(StringProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL};
+ static const char *kwlist[]= {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL};
const char *id=NULL, *name="", *description="", *def="";
int id_len;
int maxlen=0;
@@ -703,7 +703,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(EnumProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "items", "name", "description", "default", "options", NULL};
+ static const char *kwlist[]= {"attr", "items", "name", "description", "default", "options", NULL};
const char *id=NULL, *name="", *description="";
PyObject *def= NULL;
int id_len;
@@ -788,7 +788,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
BPY_PROPDEF_HEAD(PointerProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
+ static const char *kwlist[]= {"attr", "type", "name", "description", "options", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
PropertyRNA *prop;
@@ -835,7 +835,7 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(CollectionProperty)
if(srna) {
- static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
+ static const char *kwlist[]= {"attr", "type", "name", "description", "options", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
PropertyRNA *prop;
@@ -897,7 +897,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
return NULL;
}
else {
- static const char *kwlist[] = {"attr", NULL};
+ static const char *kwlist[]= {"attr", NULL};
char *id=NULL;
@@ -912,7 +912,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
Py_RETURN_NONE;
}
-static struct PyMethodDef props_methods[] = {
+static struct PyMethodDef props_methods[]= {
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntProperty_doc},
@@ -928,7 +928,7 @@ static struct PyMethodDef props_methods[] = {
{NULL, NULL, 0, NULL}
};
-static struct PyModuleDef props_module = {
+static struct PyModuleDef props_module= {
PyModuleDef_HEAD_INIT,
"bpy.props",
"This module defines properties to extend blenders internal data, the result of these functions"
@@ -954,7 +954,7 @@ PyObject *BPY_rna_props( void )
/* api needs the PyObjects internally */
submodule_dict= PyModule_GetDict(submodule);
-#define ASSIGN_STATIC(_name) pymeth_##_name = PyDict_GetItemString(submodule_dict, #_name)
+#define ASSIGN_STATIC(_name) pymeth_##_name= PyDict_GetItemString(submodule_dict, #_name)
ASSIGN_STATIC(BoolProperty);
ASSIGN_STATIC(BoolVectorProperty);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 81ab52ca54a..0b244943541 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -118,7 +118,7 @@ static void id_release_gc(struct ID *id)
for(j=0; j<3; j++) {
/* hack below to get the 2 other lists from _PyGC_generation0 that are normally not exposed */
PyGC_Head *gen= (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j));
- PyGC_Head *g = gen->gc.gc_next;
+ PyGC_Head *g= gen->gc.gc_next;
while ((g= g->gc.gc_next) != gen) {
PyObject *ob= FROM_GC(g);
if(PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) || PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) {
@@ -273,7 +273,7 @@ void BPY_id_release(struct ID *id)
#endif
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
- PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyGILState_STATE gilstate= PyGILState_Ensure();
id_release_weakref(id);
@@ -464,7 +464,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
return 0;
}
-static Mathutils_Callback mathutils_rna_array_cb = {
+static Mathutils_Callback mathutils_rna_array_cb= {
(BaseMathCheckFunc) mathutils_rna_generic_check,
(BaseMathGetFunc) mathutils_rna_vector_get,
(BaseMathSetFunc) mathutils_rna_vector_set,
@@ -518,7 +518,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
return 0;
}
-static Mathutils_Callback mathutils_rna_matrix_cb = {
+static Mathutils_Callback mathutils_rna_matrix_cb= {
mathutils_rna_generic_check,
mathutils_rna_matrix_get,
mathutils_rna_matrix_set,
@@ -563,11 +563,11 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
len= RNA_property_array_length(ptr, prop);
subtype= RNA_property_subtype(prop);
totdim= RNA_property_array_dimension(ptr, prop, NULL);
- is_thick = (flag & PROP_THICK_WRAP);
+ is_thick= (flag & PROP_THICK_WRAP);
if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) {
if(!is_thick)
- ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the Mathutils PyObject */
+ ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the Mathutils PyObject */
switch(RNA_property_subtype(prop)) {
case PROP_ALL_VECTOR_SUBTYPES:
@@ -658,9 +658,10 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
if(is_thick) {
/* this is an array we cant reference (since its not thin wrappable)
* and cannot be coerced into a mathutils type, so return as a list */
- ret = pyrna_prop_array_subscript_slice(NULL, ptr, prop, 0, len, len);
- } else {
- ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the Mathutils PyObject */
+ ret= pyrna_prop_array_subscript_slice(NULL, ptr, prop, 0, len, len);
+ }
+ else {
+ ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the Mathutils PyObject */
}
}
#else // USE_MATHUTILS
@@ -704,16 +705,16 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
switch (op) {
case Py_NE:
- ok = !ok; /* pass through */
+ ok= !ok; /* pass through */
case Py_EQ:
- res = ok ? Py_False : Py_True;
+ res= ok ? Py_False : Py_True;
break;
case Py_LT:
case Py_LE:
case Py_GT:
case Py_GE:
- res = Py_NotImplemented;
+ res= Py_NotImplemented;
break;
default:
PyErr_BadArgument();
@@ -733,16 +734,16 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
switch (op) {
case Py_NE:
- ok = !ok; /* pass through */
+ ok= !ok; /* pass through */
case Py_EQ:
- res = ok ? Py_False : Py_True;
+ res= ok ? Py_False : Py_True;
break;
case Py_LT:
case Py_LE:
case Py_GT:
case Py_GE:
- res = Py_NotImplemented;
+ res= Py_NotImplemented;
break;
default:
PyErr_BadArgument();
@@ -817,14 +818,15 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
}
else {
/* this should never fail */
- int len = -1;
+ int len= -1;
char *c= type_fmt;
while ((*c++= tolower(*type_id++))) {} ;
if(type==PROP_COLLECTION) {
len= pyrna_prop_collection_length(self);
- } else if (RNA_property_array_check(&self->ptr, self->prop)) {
+ }
+ else if (RNA_property_array_check(&self->ptr, self->prop)) {
len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
}
@@ -884,20 +886,20 @@ static long pyrna_struct_hash(BPy_StructRNA *self)
/* from python's meth_hash v3.1.2 */
static long pyrna_prop_hash(BPy_PropertyRNA *self)
{
- long x,y;
+ long x, y;
if (self->ptr.data == NULL)
- x = 0;
+ x= 0;
else {
- x = _Py_HashPointer(self->ptr.data);
+ x= _Py_HashPointer(self->ptr.data);
if (x == -1)
return -1;
}
- y = _Py_HashPointer((void*)(self->prop));
+ y= _Py_HashPointer((void*)(self->prop));
if (y == -1)
return -1;
x ^= y;
if (x == -1)
- x = -2;
+ x= -2;
return x;
}
@@ -1011,7 +1013,8 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
PyErr_Format(PyExc_TypeError, "%.200s expected a string enum type in (%.200s)", error_prefix, enum_str);
MEM_freeN((void *)enum_str);
return 0;
- } else {
+ }
+ else {
/* hack so that dynamic enums used for operator properties will be able to be built (i.e. context will be supplied to itemf)
* and thus running defining operator buttons for such operators in UI will work */
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -1033,8 +1036,8 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_
int ret, flag= 0;
/* set looping */
- Py_ssize_t pos = 0;
- Py_ssize_t hash = 0;
+ Py_ssize_t pos= 0;
+ Py_ssize_t hash= 0;
PyObject *key;
*r_value= 0;
@@ -1126,8 +1129,9 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
else {
const char *identifier;
if (RNA_property_enum_identifier(BPy_GetContext(), ptr, prop, val, &identifier)) {
- ret = PyUnicode_FromString(identifier);
- } else {
+ ret= PyUnicode_FromString(identifier);
+ }
+ else {
EnumPropertyItem *enum_item;
int free= FALSE;
@@ -1152,14 +1156,14 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
if(ptr_name)
MEM_freeN((void *)ptr_name);
- ret = PyUnicode_FromString("");
+ ret= PyUnicode_FromString("");
}
if(free)
MEM_freeN(enum_item);
/*PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val);
- ret = NULL;*/
+ ret= NULL;*/
}
}
@@ -1169,7 +1173,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
{
PyObject *ret;
- int type = RNA_property_type(prop);
+ int type= RNA_property_type(prop);
if (RNA_property_array_check(ptr, prop)) {
return pyrna_py_from_array(ptr, prop);
@@ -1178,19 +1182,19 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
/* see if we can coorce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
- ret = PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
+ ret= PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
break;
case PROP_INT:
- ret = PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
+ ret= PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
break;
case PROP_FLOAT:
- ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
+ ret= PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
break;
case PROP_STRING:
{
int subtype= RNA_property_subtype(prop);
const char *buf;
- buf = RNA_property_string_get_alloc(ptr, prop, NULL, -1);
+ buf= RNA_property_string_get_alloc(ptr, prop, NULL, -1);
#ifdef USE_STRING_COERCE
/* only file paths get special treatment, they may contain non utf-8 chars */
if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
@@ -1215,19 +1219,20 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA newptr;
newptr= RNA_property_pointer_get(ptr, prop);
if (newptr.data) {
- ret = pyrna_struct_CreatePyObject(&newptr);
- } else {
- ret = Py_None;
+ ret= pyrna_struct_CreatePyObject(&newptr);
+ }
+ else {
+ ret= Py_None;
Py_INCREF(ret);
}
break;
}
case PROP_COLLECTION:
- ret = pyrna_prop_CreatePyObject(ptr, prop);
+ ret= pyrna_prop_CreatePyObject(ptr, prop);
break;
default:
PyErr_Format(PyExc_TypeError, "bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)", type);
- ret = NULL;
+ ret= NULL;
break;
}
@@ -1238,12 +1243,12 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
* Its takes keyword args and fills them with property values */
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix)
{
- int error_val = 0;
+ int error_val= 0;
int totkw;
const char *arg_name= NULL;
PyObject *item;
- totkw = kw ? PyDict_Size(kw):0;
+ totkw= kw ? PyDict_Size(kw):0;
RNA_STRUCT_BEGIN(ptr, prop) {
arg_name= RNA_property_identifier(prop);
@@ -1261,10 +1266,11 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
if (item == NULL) {
if(all_args) {
PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" missing", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
- error_val = -1; /* pyrna_py_to_prop sets the error */
+ error_val= -1; /* pyrna_py_to_prop sets the error */
break;
}
- } else {
+ }
+ else {
if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) {
error_val= -1;
break;
@@ -1276,7 +1282,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
if (error_val==0 && totkw > 0) { /* some keywords were given that were not used :/ */
PyObject *key, *value;
- Py_ssize_t pos = 0;
+ Py_ssize_t pos= 0;
while (PyDict_Next(kw, &pos, &key, &value)) {
arg_name= _PyUnicode_AsString(key);
@@ -1285,7 +1291,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
}
PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" unrecognized", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
- error_val = -1;
+ error_val= -1;
}
return error_val;
@@ -1295,7 +1301,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw);
static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
{
- static PyMethodDef func_meth = {"<generic rna function>", (PyCFunction)pyrna_func_call, METH_VARARGS|METH_KEYWORDS, "python rna function"};
+ static PyMethodDef func_meth= {"<generic rna function>", (PyCFunction)pyrna_func_call, METH_VARARGS|METH_KEYWORDS, "python rna function"};
PyObject *self;
PyObject *ret;
@@ -1322,7 +1328,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
{
/* XXX hard limits should be checked here */
- int type = RNA_property_type(prop);
+ int type= RNA_property_type(prop);
if (RNA_property_array_check(ptr, prop)) {
@@ -1347,14 +1353,15 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
* however so many poll functions return None or a valid Object.
* its a hassle to convert these into a bool before returning, */
if(RNA_property_flag(prop) & PROP_OUTPUT)
- param = PyObject_IsTrue(value);
+ param= PyObject_IsTrue(value);
else
- param = PyLong_AsLong(value);
+ param= PyLong_AsLong(value);
if(param < 0) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
return -1;
- } else {
+ }
+ else {
if(data) *((int*)data)= param;
else RNA_property_boolean_set(ptr, prop, param);
}
@@ -1371,7 +1378,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
else if (param==-1 && PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected an int type, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
return -1;
- } else {
+ }
+ else {
int param_i= (int)param;
RNA_property_int_clamp(ptr, prop, &param_i);
if(data) *((int*)data)= param_i;
@@ -1381,11 +1389,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
case PROP_FLOAT:
{
- float param = PyFloat_AsDouble(value);
+ float param= PyFloat_AsDouble(value);
if (PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a float type, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
return -1;
- } else {
+ }
+ else {
RNA_property_float_clamp(ptr, prop, (float *)&param);
if(data) *((float*)data)= param;
else RNA_property_float_set(ptr, prop, param);
@@ -1458,7 +1467,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
PyObject *value_new= NULL;
StructRNA *ptr_type= RNA_property_pointer_type(ptr, prop);
- int flag = RNA_property_flag(prop);
+ int flag= RNA_property_flag(prop);
/* this is really nasty!, so we can fake the operator having direct properties eg:
* layout.prop(self, "filepath")
@@ -1482,7 +1491,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
/* if property is an OperatorProperties pointer and value is a map, forward back to pyrna_pydict_to_props */
if (RNA_struct_is_a(ptr_type, &RNA_OperatorProperties) && PyDict_Check(value)) {
- PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
+ PointerRNA opptr= RNA_property_pointer_get(ptr, prop);
return pyrna_pydict_to_props(&opptr, value, 0, error_prefix);
}
@@ -1503,13 +1512,16 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
if(!BPy_StructRNA_Check(value) && value != Py_None) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptr_type), Py_TYPE(value)->tp_name);
Py_XDECREF(value_new); return -1;
- } else if((flag & PROP_NEVER_NULL) && value == Py_None) {
+ }
+ else if((flag & PROP_NEVER_NULL) && value == Py_None) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptr_type));
Py_XDECREF(value_new); return -1;
- } else if(value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) {
+ }
+ else if(value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s ID type does not support assignment to its self", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
Py_XDECREF(value_new); return -1;
- } else {
+ }
+ else {
BPy_StructRNA *param= (BPy_StructRNA*)value;
int raise_error= FALSE;
if(data) {
@@ -1575,7 +1587,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
- seq_len = PySequence_Size(value);
+ seq_len= PySequence_Size(value);
for(i=0; i<seq_len; i++) {
item= PySequence_GetItem(value, i);
@@ -1637,7 +1649,7 @@ static PyObject *pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int in
static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, PyObject *value)
{
- int ret = 0;
+ int ret= 0;
PointerRNA *ptr= &self->ptr;
PropertyRNA *prop= self->prop;
@@ -1655,23 +1667,25 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
{
- int param = PyLong_AsLong(value);
+ int param= PyLong_AsLong(value);
if(param < 0 || param > 1) {
PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1");
- ret = -1;
- } else {
+ ret= -1;
+ }
+ else {
RNA_property_boolean_set_index(ptr, prop, index, param);
}
break;
}
case PROP_INT:
{
- int param = PyLong_AsLong(value);
+ int param= PyLong_AsLong(value);
if (param==-1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
- ret = -1;
- } else {
+ ret= -1;
+ }
+ else {
RNA_property_int_clamp(ptr, prop, &param);
RNA_property_int_set_index(ptr, prop, index, param);
}
@@ -1679,11 +1693,12 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
case PROP_FLOAT:
{
- float param = PyFloat_AsDouble(value);
+ float param= PyFloat_AsDouble(value);
if (PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float type");
- ret = -1;
- } else {
+ ret= -1;
+ }
+ else {
RNA_property_float_clamp(ptr, prop, &param);
RNA_property_float_set_index(ptr, prop, index, param);
}
@@ -1691,7 +1706,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
default:
PyErr_SetString(PyExc_AttributeError, "not an array type");
- ret = -1;
+ ret= -1;
break;
}
}
@@ -1740,7 +1755,7 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
PYRNA_PROP_CHECK_INT(self)
RNA_property_collection_begin(&self->ptr, self->prop, &iter);
- test = iter.valid;
+ test= iter.valid;
RNA_property_collection_end(&iter);
return test;
}
@@ -1865,10 +1880,10 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
/* PYRNA_PROP_CHECK_OBJ(self) isnt needed, internal use only */
- totdim = RNA_property_array_dimension(ptr, prop, NULL);
+ totdim= RNA_property_array_dimension(ptr, prop, NULL);
if (totdim > 1) {
- for (count = start; count < stop; count++)
+ for (count= start; count < stop; count++)
PyTuple_SET_ITEM(tuple, count - start, pyrna_prop_array_to_py_index(self, count));
}
else {
@@ -1940,7 +1955,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
return pyrna_prop_collection_subscript_str(self, _PyUnicode_AsString(key));
}
else if (PyIndex_Check(key)) {
- Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
@@ -1994,9 +2009,10 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
/*if (PyUnicode_Check(key)) {
return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key));
- } else*/
+ }
+ else */
if (PyIndex_Check(key)) {
- Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
return pyrna_prop_array_subscript_int(self, PyLong_AsLong(key));
@@ -2047,17 +2063,17 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
int ret= 0;
if(value_orig == NULL) {
- PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct");
+ PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice]= value: deleting with list types is not supported by bpy_struct");
return -1;
}
- if(!(value=PySequence_Fast(value_orig, "bpy_prop_array[slice] = value: assignment is not a sequence type"))) {
+ if(!(value=PySequence_Fast(value_orig, "bpy_prop_array[slice]= value: assignment is not a sequence type"))) {
return -1;
}
if(PySequence_Fast_GET_SIZE(value) != stop-start) {
Py_DECREF(value);
- PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported");
+ PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice]= value: resizing bpy_struct arrays isn't supported");
return -1;
}
@@ -2076,9 +2092,9 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
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;
+ values[count]= fval;
}
if(PyErr_Occurred()) ret= -1;
@@ -2096,7 +2112,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
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);
@@ -2117,9 +2133,9 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
RNA_property_int_get_array(ptr, prop, values);
for(count=start; count<stop; count++) {
- ival = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+ ival= PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
CLAMP(ival, min, max);
- values[count] = ival;
+ values[count]= ival;
}
if(PyErr_Occurred()) ret= -1;
@@ -2154,13 +2170,13 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k
if(keynum >= 0 && keynum < len)
return pyrna_py_to_prop_array_index(self, keynum, value);
- PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index] = value: index out of range");
+ PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index]= value: index out of range");
return -1;
}
static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *key, PyObject *value)
{
- /* char *keyname = NULL; */ /* not supported yet */
+ /* char *keyname= NULL; */ /* not supported yet */
int ret= -1;
PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self)
@@ -2171,7 +2187,7 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
}
else if (PyIndex_Check(key)) {
- Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred()) {
ret= -1;
}
@@ -2212,20 +2228,20 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
}
/* for slice only */
-static PyMappingMethods pyrna_prop_array_as_mapping = {
+static PyMappingMethods pyrna_prop_array_as_mapping= {
(lenfunc) pyrna_prop_array_length, /* mp_length */
(binaryfunc) pyrna_prop_array_subscript, /* mp_subscript */
(objobjargproc) pyrna_prop_array_ass_subscript, /* mp_ass_subscript */
};
-static PyMappingMethods pyrna_prop_collection_as_mapping = {
+static PyMappingMethods pyrna_prop_collection_as_mapping= {
(lenfunc) pyrna_prop_collection_length, /* mp_length */
(binaryfunc) pyrna_prop_collection_subscript, /* mp_subscript */
(objobjargproc) NULL, /* mp_ass_subscript */
};
/* only for fast bool's, large structs, assign nb_bool on init */
-static PyNumberMethods pyrna_prop_array_as_number = {
+static PyNumberMethods pyrna_prop_array_as_number= {
NULL, /* nb_add */
NULL, /* nb_subtract */
NULL, /* nb_multiply */
@@ -2237,7 +2253,7 @@ static PyNumberMethods pyrna_prop_array_as_number = {
NULL, /* nb_absolute */
(inquiry) pyrna_prop_array_bool, /* nb_bool */
};
-static PyNumberMethods pyrna_prop_collection_as_number = {
+static PyNumberMethods pyrna_prop_collection_as_number= {
NULL, /* nb_add */
NULL, /* nb_subtract */
NULL, /* nb_multiply */
@@ -2260,7 +2276,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *value
PointerRNA newptr; /* not used, just so RNA_property_collection_lookup_string runs */
/* key in dict style check */
- const char *keyname = _PyUnicode_AsString(value);
+ const char *keyname= _PyUnicode_AsString(value);
if(keyname==NULL) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.__contains__: expected a string");
@@ -2276,7 +2292,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *value
static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
{
IDProperty *group;
- const char *name = _PyUnicode_AsString(value);
+ const char *name= _PyUnicode_AsString(value);
PYRNA_STRUCT_CHECK_INT(self)
@@ -2298,7 +2314,7 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
return IDP_GetPropertyFromGroup(group, name) ? 1:0;
}
-static PySequenceMethods pyrna_prop_array_as_sequence = {
+static PySequenceMethods pyrna_prop_array_as_sequence= {
(lenfunc)pyrna_prop_array_length, /* Cant set the len otherwise it can evaluate as false */
NULL, /* sq_concat */
NULL, /* sq_repeat */
@@ -2311,7 +2327,7 @@ static PySequenceMethods pyrna_prop_array_as_sequence = {
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
-static PySequenceMethods pyrna_prop_collection_as_sequence = {
+static PySequenceMethods pyrna_prop_collection_as_sequence= {
(lenfunc)pyrna_prop_collection_length, /* Cant set the len otherwise it can evaluate as false */
NULL, /* sq_concat */
NULL, /* sq_repeat */
@@ -2324,7 +2340,7 @@ static PySequenceMethods pyrna_prop_collection_as_sequence = {
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
-static PySequenceMethods pyrna_struct_as_sequence = {
+static PySequenceMethods pyrna_struct_as_sequence= {
NULL, /* Cant set the len otherwise it can evaluate as false */
NULL, /* sq_concat */
NULL, /* sq_repeat */
@@ -2387,14 +2403,14 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
#endif // USE_STRING_COERCE
if(group==NULL) {
- PyErr_SetString(PyExc_TypeError, "bpy_struct[key] = val: id properties not supported for this type");
+ PyErr_SetString(PyExc_TypeError, "bpy_struct[key]= val: id properties not supported for this type");
return -1;
}
return BPy_Wrap_SetMapItem(group, key, value);
}
-static PyMappingMethods pyrna_struct_as_mapping = {
+static PyMappingMethods pyrna_struct_as_mapping= {
(lenfunc) NULL, /* mp_length */
(binaryfunc) pyrna_struct_subscript, /* mp_subscript */
(objobjargproc) pyrna_struct_ass_subscript, /* mp_ass_subscript */
@@ -2661,7 +2677,7 @@ static char pyrna_prop_path_from_id_doc[] =
static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
{
const char *path;
- PropertyRNA *prop = self->prop;
+ PropertyRNA *prop= self->prop;
PyObject *ret;
path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
@@ -2704,14 +2720,14 @@ static void pyrna_dir_members_py(PyObject *list, PyObject *self)
dict_ptr= _PyObject_GetDictPtr((PyObject *)self);
if(dict_ptr && (dict=*dict_ptr)) {
- list_tmp = PyDict_Keys(dict);
+ list_tmp= PyDict_Keys(dict);
PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
Py_DECREF(list_tmp);
}
dict= ((PyTypeObject *)Py_TYPE(self))->tp_dict;
if(dict) {
- list_tmp = PyDict_Keys(dict);
+ list_tmp= PyDict_Keys(dict);
PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
Py_DECREF(list_tmp);
}
@@ -2733,7 +2749,7 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
RNA_PROP_BEGIN(&tptr, itemptr, iterprop) {
idname= RNA_function_identifier(itemptr.data);
- pystring = PyUnicode_FromString(idname);
+ pystring= PyUnicode_FromString(idname);
PyList_Append(list, pystring);
Py_DECREF(pystring);
}
@@ -2752,7 +2768,7 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
if(nameptr) {
- pystring = PyUnicode_FromString(nameptr);
+ pystring= PyUnicode_FromString(nameptr);
PyList_Append(list, pystring);
Py_DECREF(pystring);
@@ -2775,7 +2791,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
- ret = PyList_New(0);
+ ret= PyList_New(0);
if (!BPy_StructRNA_CheckExact(self))
pyrna_dir_members_py(ret, (PyObject *)self);
@@ -2783,11 +2799,11 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
pyrna_dir_members_rna(ret, &self->ptr);
if(self->ptr.type == &RNA_Context) {
- ListBase lb = CTX_data_dir_get(self->ptr.data);
+ ListBase lb= CTX_data_dir_get(self->ptr.data);
LinkData *link;
for(link=lb.first; link; link=link->next) {
- pystring = PyUnicode_FromString(link->data);
+ pystring= PyUnicode_FromString(link->data);
PyList_Append(ret, pystring);
Py_DECREF(pystring);
}
@@ -2812,7 +2828,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
//---------------getattr--------------------------------------------
static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
{
- const char *name = _PyUnicode_AsString(pyname);
+ const char *name= _PyUnicode_AsString(pyname);
PyObject *ret;
PropertyRNA *prop;
FunctionRNA *func;
@@ -2821,27 +2837,27 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
if(name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string");
- ret = NULL;
+ ret= NULL;
}
else if(name[0]=='_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups
/* annoying exception, maybe we need to have different types for this... */
if((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idprops_check(self->ptr.type)) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: no __getitem__ support for this type");
- ret = NULL;
+ ret= NULL;
}
else {
- ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
}
}
- else if ((prop = RNA_struct_find_property(&self->ptr, name))) {
- ret = pyrna_prop_to_py(&self->ptr, prop);
+ else if ((prop= RNA_struct_find_property(&self->ptr, name))) {
+ ret= pyrna_prop_to_py(&self->ptr, prop);
}
/* RNA function only if callback is declared (no optional functions) */
- else if ((func = RNA_struct_find_function(&self->ptr, name)) && RNA_function_defined(func)) {
- ret = pyrna_func_to_py((BPy_DummyPointerRNA *)self, func);
+ else if ((func= RNA_struct_find_function(&self->ptr, name)) && RNA_function_defined(func)) {
+ ret= pyrna_func_to_py((BPy_DummyPointerRNA *)self, func);
}
else if (self->ptr.type == &RNA_Context) {
- bContext *C = self->ptr.data;
+ bContext *C= self->ptr.data;
if(C==NULL) {
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name);
ret= NULL;
@@ -2869,7 +2885,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
CollectionPointerLink *link;
PyObject *linkptr;
- ret = PyList_New(0);
+ ret= PyList_New(0);
for(link=newlb.first; link; link=link->next) {
linkptr= pyrna_struct_CreatePyObject(&link->ptr);
@@ -2887,12 +2903,12 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
}
}
else if (done==-1) { /* found but not set */
- ret = Py_None;
+ ret= Py_None;
Py_INCREF(ret);
}
else { /* not found in the context */
/* lookup the subclass. raise an error if its not found */
- ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
}
BLI_freelistN(&newlb);
@@ -2901,7 +2917,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
else {
#if 0
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name);
- ret = NULL;
+ ret= NULL;
#endif
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
@@ -2910,7 +2926,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
* */
/* The error raised here will be displayed */
- ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
}
return ret;
@@ -2939,7 +2955,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
PyObject *ret= PyType_Type.tp_getattro(cls, attr);
/* Allows:
- * >>> bpy.types.Scene.foo = BoolProperty()
+ * >>> bpy.types.Scene.foo= BoolProperty()
* >>> bpy.types.Scene.foo
* <bpy_struct, BooleanProperty("foo")>
* ...rather then returning the defered class register tuple as checked by pyrna_is_deferred_prop()
@@ -3020,7 +3036,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject *value)
{
- const char *name = _PyUnicode_AsString(pyname);
+ const char *name= _PyUnicode_AsString(pyname);
PropertyRNA *prop= NULL;
PYRNA_STRUCT_CHECK_INT(self)
@@ -3043,7 +3059,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
}
else if (self->ptr.type == &RNA_Context) {
/* code just raises correct error, context prop's cant be set, unless its apart of the py class */
- bContext *C = self->ptr.data;
+ bContext *C= self->ptr.data;
if(C==NULL) {
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context", name);
return -1;
@@ -3071,7 +3087,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
return -1;
}
- return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:");
+ return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr= val:");
}
else {
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
@@ -3086,7 +3102,7 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
- ret = PyList_New(0);
+ ret= PyList_New(0);
if (!BPy_PropertyRNA_CheckExact(self))
pyrna_dir_members_py(ret, (PyObject *)self);
@@ -3105,7 +3121,7 @@ static PyObject *pyrna_prop_array_getattro(BPy_PropertyRNA *self, PyObject *pyna
static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject *pyname)
{
- const char *name = _PyUnicode_AsString(pyname);
+ const char *name= _PyUnicode_AsString(pyname);
if(name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_prop_collection: __getattr__ must be a string");
@@ -3118,14 +3134,14 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
PointerRNA r_ptr;
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
- if ((prop = RNA_struct_find_property(&r_ptr, name))) {
- ret = pyrna_prop_to_py(&r_ptr, prop);
+ if ((prop= RNA_struct_find_property(&r_ptr, name))) {
+ ret= pyrna_prop_to_py(&r_ptr, prop);
return ret;
}
- else if ((func = RNA_struct_find_function(&r_ptr, name))) {
+ else if ((func= RNA_struct_find_function(&r_ptr, name))) {
PyObject *self_collection= pyrna_struct_CreatePyObject(&r_ptr);
- ret = pyrna_func_to_py((BPy_DummyPointerRNA *)self_collection, func);
+ ret= pyrna_func_to_py((BPy_DummyPointerRNA *)self_collection, func);
Py_DECREF(self_collection);
return ret;
@@ -3171,7 +3187,7 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
//--------------- setattr-------------------------------------------
static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pyname, PyObject *value)
{
- const char *name = _PyUnicode_AsString(pyname);
+ const char *name= _PyUnicode_AsString(pyname);
PropertyRNA *prop;
PointerRNA r_ptr;
@@ -3190,7 +3206,7 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam
return -1;
}
else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
- if ((prop = RNA_struct_find_property(&r_ptr, name))) {
+ if ((prop= RNA_struct_find_property(&r_ptr, name))) {
/* pyrna_py_to_prop sets its own exceptions */
return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
}
@@ -3265,15 +3281,15 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
/* Python attributes get/set structure: */
/*****************************************************************************/
-static PyGetSetDef pyrna_prop_getseters[] = {
+static PyGetSetDef pyrna_prop_getseters[]= {
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
-static PyGetSetDef pyrna_struct_getseters[] = {
+static PyGetSetDef pyrna_struct_getseters[]= {
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
@@ -3287,7 +3303,7 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
if(nameptr) {
/* add to python list */
- item = PyUnicode_FromString(nameptr);
+ item= PyUnicode_FromString(nameptr);
PyList_Append(ret, item);
Py_DECREF(item);
/* done */
@@ -3357,7 +3373,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)
@@ -3401,7 +3417,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
PointerRNA newptr;
const char *key;
- PyObject* def = Py_None;
+ PyObject* def= Py_None;
PYRNA_PROP_CHECK_OBJ(self)
@@ -3425,9 +3441,9 @@ static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
/* note: this is fail with zero length lists, so dont let this get caled in that case */
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
- prop = RNA_struct_find_property(&itemptr, attr);
+ prop= RNA_struct_find_property(&itemptr, attr);
*raw_type= RNA_property_raw_type(prop);
- *attr_tot = RNA_property_array_length(&itemptr, prop);
+ *attr_tot= RNA_property_array_length(&itemptr, prop);
*attr_signed= (RNA_property_subtype(prop)==PROP_UNSIGNED) ? FALSE:TRUE;
break;
}
@@ -3465,9 +3481,9 @@ static int foreach_parse_args(
*attr_tot= 1;
if (RNA_property_type(self->prop) == PROP_COLLECTION)
- array_tot = RNA_property_collection_length(&self->ptr, self->prop);
+ array_tot= RNA_property_collection_length(&self->ptr, self->prop);
else
- array_tot = RNA_property_array_length(&self->ptr, self->prop);
+ array_tot= RNA_property_array_length(&self->ptr, self->prop);
target_tot= array_tot * (*attr_tot);
@@ -3491,7 +3507,7 @@ static int foreach_parse_args(
static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
{
- char f = format ? *format:'B'; /* B is assumed when not set */
+ char f= format ? *format:'B'; /* B is assumed when not set */
switch(raw_type) {
case PROP_RAW_CHAR:
@@ -3516,7 +3532,7 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
{
- PyObject *item = NULL;
+ PyObject *item= NULL;
int i=0, ok=0, buffer_is_compat;
void *array= NULL;
@@ -3535,17 +3551,17 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
if(set) { /* get the array from python */
- buffer_is_compat = FALSE;
+ buffer_is_compat= FALSE;
if(PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
/* check if the buffer matches */
- buffer_is_compat = foreach_compat_buffer(raw_type, attr_signed, buf.format);
+ buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format);
if(buffer_is_compat) {
- ok = RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
+ ok= RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
}
PyBuffer_Release(&buf);
@@ -3582,21 +3598,21 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
Py_DECREF(item);
}
- ok = RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
+ ok= RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
}
}
else {
- buffer_is_compat = FALSE;
+ buffer_is_compat= FALSE;
if(PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
/* check if the buffer matches, TODO - signed/unsigned types */
- buffer_is_compat = foreach_compat_buffer(raw_type, attr_signed, buf.format);
+ buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format);
if(buffer_is_compat) {
- ok = RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
+ ok= RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
}
PyBuffer_Release(&buf);
@@ -3606,7 +3622,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
if(!buffer_is_compat) {
array= PyMem_Malloc(size * tot);
- ok = RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
+ ok= RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
if(!ok) i= tot; /* skip the loop */
@@ -3667,7 +3683,7 @@ static char pyrna_prop_collection_foreach_get_doc[] =
" collection.foreach_get(someseq, attr)\n"
"\n"
" # Python equivelent\n"
-" for i in range(len(seq)): someseq[i] = getattr(collection, attr)\n"
+" for i in range(len(seq)): someseq[i]= getattr(collection, attr)\n"
"\n"
;
static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
@@ -3714,7 +3730,7 @@ static PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
/* we know this is a list so no need to PyIter_Check
* otherwise it could be NULL (unlikely) if conversion failed */
if(ret) {
- iter = PyObject_GetIter(ret);
+ iter= PyObject_GetIter(ret);
Py_DECREF(ret);
}
@@ -3734,7 +3750,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
/* we know this is a list so no need to PyIter_Check
* otherwise it could be NULL (unlikely) if conversion failed */
if(ret) {
- iter = PyObject_GetIter(ret);
+ iter= PyObject_GetIter(ret);
Py_DECREF(ret);
}
@@ -3742,7 +3758,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
}
#endif /* # !USE_PYRNA_ITER */
-static struct PyMethodDef pyrna_struct_methods[] = {
+static struct PyMethodDef pyrna_struct_methods[]= {
/* only for PointerRNA's with ID'props */
{"keys", (PyCFunction)pyrna_struct_keys, METH_NOARGS, pyrna_struct_keys_doc},
@@ -3772,17 +3788,17 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_methods[] = {
+static struct PyMethodDef pyrna_prop_methods[]= {
{"path_from_id", (PyCFunction)pyrna_prop_path_from_id, METH_NOARGS, pyrna_prop_path_from_id_doc},
{"__dir__", (PyCFunction)pyrna_prop_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_array_methods[] = {
+static struct PyMethodDef pyrna_prop_array_methods[]= {
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_collection_methods[] = {
+static struct PyMethodDef pyrna_prop_collection_methods[]= {
{"foreach_get", (PyCFunction)pyrna_prop_collection_foreach_get, METH_VARARGS, pyrna_prop_collection_foreach_get_doc},
{"foreach_set", (PyCFunction)pyrna_prop_collection_foreach_set, METH_VARARGS, pyrna_prop_collection_foreach_set_doc},
@@ -3794,7 +3810,7 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = {
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
+static struct PyMethodDef pyrna_prop_collection_idprop_methods[]= {
{"add", (PyCFunction)pyrna_prop_collection_idprop_add, METH_NOARGS, NULL},
{"remove", (PyCFunction)pyrna_prop_collection_idprop_remove, METH_O, NULL},
{"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
@@ -3819,7 +3835,7 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
... def test_func(self):
... print(100)
...
- >>> myob = MyObSubclass(bpy.context.object)
+ >>> myob= MyObSubclass(bpy.context.object)
>>> myob.test_func()
100
*
@@ -3827,7 +3843,7 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
*/
BPy_StructRNA *ret;
if((ret= (BPy_StructRNA *)type->tp_alloc(type, 0))) {
- ret->ptr = base->ptr;
+ ret->ptr= base->ptr;
}
/* pass on exception & NULL if tp_alloc fails */
return (PyObject *)ret;
@@ -3855,10 +3871,11 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
if (type == Py_TYPE(base)) {
Py_INCREF(base);
return (PyObject *)base;
- } else if (PyType_IsSubtype(type, &pyrna_prop_Type)) {
- BPy_PropertyRNA *ret = (BPy_PropertyRNA *) type->tp_alloc(type, 0);
- ret->ptr = base->ptr;
- ret->prop = base->prop;
+ }
+ else if (PyType_IsSubtype(type, &pyrna_prop_Type)) {
+ BPy_PropertyRNA *ret= (BPy_PropertyRNA *) type->tp_alloc(type, 0);
+ ret->ptr= base->ptr;
+ ret->prop= base->prop;
return (PyObject *)ret;
}
else {
@@ -3870,8 +3887,8 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
{
PyObject *ret;
- int type = RNA_property_type(prop);
- int flag = RNA_property_flag(prop);
+ int type= RNA_property_type(prop);
+ int flag= RNA_property_flag(prop);
if(RNA_property_array_check(ptr, prop)) {
int a, len;
@@ -3890,12 +3907,12 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
switch (type) {
case PROP_BOOLEAN:
- ret = PyTuple_New(len);
+ ret= PyTuple_New(len);
for(a=0; a<len; a++)
PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int*)data)[a]));
break;
case PROP_INT:
- ret = PyTuple_New(len);
+ ret= PyTuple_New(len);
for(a=0; a<len; a++)
PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int*)data)[a]));
break;
@@ -3917,7 +3934,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
/* pass through */
#endif
default:
- ret = PyTuple_New(len);
+ ret= PyTuple_New(len);
for(a=0; a<len; a++)
PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float*)data)[a]));
@@ -3925,7 +3942,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
break;
default:
PyErr_Format(PyExc_TypeError, "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)", type);
- ret = NULL;
+ ret= NULL;
break;
}
}
@@ -3933,13 +3950,13 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
/* see if we can coorce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
- ret = PyBool_FromLong(*(int*)data);
+ ret= PyBool_FromLong(*(int*)data);
break;
case PROP_INT:
- ret = PyLong_FromSsize_t((Py_ssize_t)*(int*)data);
+ ret= PyLong_FromSsize_t((Py_ssize_t)*(int*)data);
break;
case PROP_FLOAT:
- ret = PyFloat_FromDouble(*(float*)data);
+ ret= PyFloat_FromDouble(*(float*)data);
break;
case PROP_STRING:
{
@@ -3960,7 +3977,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
ret= PyUnicode_FromString(data_ch);
}
#else
- ret = PyUnicode_FromString(data_ch);
+ ret= PyUnicode_FromString(data_ch);
#endif
#ifdef USE_STRING_COERCE
@@ -3986,7 +4003,8 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
else {
if(RNA_struct_is_ID(ptype)) {
RNA_id_pointer_create(*(void**)data, &newptr);
- } else {
+ }
+ else {
/* note: this is taken from the function's ID pointer
* and will break if a function returns a pointer from
* another ID block, watch this! - it should at least be
@@ -3996,9 +4014,10 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
}
if (newptr.data) {
- ret = pyrna_struct_CreatePyObject(&newptr);
- } else {
- ret = Py_None;
+ ret= pyrna_struct_CreatePyObject(&newptr);
+ }
+ else {
+ ret= Py_None;
Py_INCREF(ret);
}
break;
@@ -4009,7 +4028,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
CollectionPointerLink *link;
PyObject *linkptr;
- ret = PyList_New(0);
+ ret= PyList_New(0);
for(link=lb->first; link; link=link->next) {
linkptr= pyrna_struct_CreatePyObject(&link->ptr);
@@ -4021,7 +4040,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
}
default:
PyErr_Format(PyExc_TypeError, "RNA Error: unknown type \"%d\" (pyrna_param_to_py)", type);
- ret = NULL;
+ ret= NULL;
break;
}
}
@@ -4159,7 +4178,7 @@ static PyObject *pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
*/
if(err == 0 && kw && (pykw_len > kw_tot)) {
PyObject *key, *value;
- Py_ssize_t pos = 0;
+ Py_ssize_t pos= 0;
DynStr *bad_args= BLI_dynstr_new();
DynStr *good_args= BLI_dynstr_new();
@@ -4279,7 +4298,7 @@ static PyObject *pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
/* subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass */
/* note: tp_base member is set to &PyType_Type on init */
-PyTypeObject pyrna_struct_meta_idprop_Type = {
+PyTypeObject pyrna_struct_meta_idprop_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_struct_meta_idprop", /* tp_name */
sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's
@@ -4357,7 +4376,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type = {
/*-----------------------BPy_StructRNA method def------------------------------*/
-PyTypeObject pyrna_struct_Type = {
+PyTypeObject pyrna_struct_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_struct", /* tp_name */
sizeof(BPy_StructRNA), /* tp_basicsize */
@@ -4397,7 +4416,7 @@ PyTypeObject pyrna_struct_Type = {
(traverseproc) pyrna_struct_traverse, /* traverseproc tp_traverse; */
/* delete references to contained objects */
- (inquiry )pyrna_struct_clear, /* inquiry tp_clear; */
+ (inquiry)pyrna_struct_clear, /* inquiry tp_clear; */
#else
NULL, /* traverseproc tp_traverse; */
@@ -4446,7 +4465,7 @@ PyTypeObject pyrna_struct_Type = {
};
/*-----------------------BPy_PropertyRNA method def------------------------------*/
-PyTypeObject pyrna_prop_Type = {
+PyTypeObject pyrna_prop_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop", /* tp_name */
sizeof(BPy_PropertyRNA), /* tp_basicsize */
@@ -4530,7 +4549,7 @@ PyTypeObject pyrna_prop_Type = {
NULL
};
-PyTypeObject pyrna_prop_array_Type = {
+PyTypeObject pyrna_prop_array_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_array", /* tp_name */
sizeof(BPy_PropertyArrayRNA), /* tp_basicsize */
@@ -4613,7 +4632,7 @@ PyTypeObject pyrna_prop_array_Type = {
NULL
};
-PyTypeObject pyrna_prop_collection_Type = {
+PyTypeObject pyrna_prop_collection_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_collection", /* tp_name */
sizeof(BPy_PropertyRNA), /* tp_basicsize */
@@ -4698,7 +4717,7 @@ PyTypeObject pyrna_prop_collection_Type = {
};
/* only for add/remove/move methods */
-static PyTypeObject pyrna_prop_collection_idprop_Type = {
+static PyTypeObject pyrna_prop_collection_idprop_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_collection_idprop", /* tp_name */
sizeof(BPy_PropertyRNA), /* tp_basicsize */
@@ -4794,7 +4813,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = {
static void pyrna_prop_collection_iter_dealloc(BPy_PropertyCollectionIterRNA *self);
static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self);
-PyTypeObject pyrna_prop_collection_iter_Type = {
+PyTypeObject pyrna_prop_collection_iter_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_collection_iter", /* tp_name */
sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */
@@ -4958,7 +4977,7 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
/* python deals with the curcular ref */
RNA_pointer_create(NULL, &RNA_Struct, srna, &ptr);
- item = pyrna_struct_CreatePyObject(&ptr);
+ item= pyrna_struct_CreatePyObject(&ptr);
/* note, must set the class not the __dict__ else the internal slots are not updated correctly */
PyObject_SetAttrString(newclass, "bl_rna", item);
@@ -5011,7 +5030,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
fprintf(stderr, "pyrna_srna_ExternalType: failed to find 'bpy_types' module\n");
return NULL;
}
- bpy_types_dict = PyModule_GetDict(bpy_types); // borrow
+ bpy_types_dict= PyModule_GetDict(bpy_types); // borrow
Py_DECREF(bpy_types); // fairly safe to assume the dict is kept
}
@@ -5023,7 +5042,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
//PyObject *slots= PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values!
//PyObject *bases= PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to.
PyObject *bases= ((PyTypeObject *)newclass)->tp_bases;
- PyObject *slots = PyDict_GetItemString(((PyTypeObject *)newclass)->tp_dict, "__slots__");
+ PyObject *slots= PyDict_GetItemString(((PyTypeObject *)newclass)->tp_dict, "__slots__");
if(slots==NULL) {
fprintf(stderr, "pyrna_srna_ExternalType: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", idname);
@@ -5049,7 +5068,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
static PyObject* pyrna_srna_Subtype(StructRNA *srna)
{
- PyObject *newclass = NULL;
+ PyObject *newclass= NULL;
/* stupid/simple case */
if (srna == NULL) {
@@ -5067,7 +5086,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
/* subclass equivelents
- class myClass(myBase):
some='value' # or ...
- - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
+ - myClass= type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
*/
/* Assume RNA_struct_py_type_get(srna) was already checked */
@@ -5078,7 +5097,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
/* remove __doc__ for now */
// const char *descr= RNA_struct_ui_description(srna);
// if(!descr) descr= "(no docs)";
- // "__doc__",descr
+ // "__doc__", descr
if(RNA_struct_idprops_check(srna) && !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type)) {
metaclass= (PyObject *)&pyrna_struct_meta_idprop_Type;
@@ -5088,7 +5107,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
}
/* always use O not N when calling, N causes refcount errors */
- newclass = PyObject_CallFunction(metaclass, (char *)"s(O){sss()}", idname, py_base, "__module__","bpy.types", "__slots__");
+ newclass= PyObject_CallFunction(metaclass, (char *)"s(O){sss()}", idname, py_base, "__module__","bpy.types", "__slots__");
/* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */
@@ -5139,15 +5158,15 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
Py_RETURN_NONE;
}
else {
- PyTypeObject *tp = (PyTypeObject *)pyrna_struct_Subtype(ptr);
+ PyTypeObject *tp= (PyTypeObject *)pyrna_struct_Subtype(ptr);
if (tp) {
- pyrna = (BPy_StructRNA *) tp->tp_alloc(tp, 0);
+ pyrna= (BPy_StructRNA *) tp->tp_alloc(tp, 0);
Py_DECREF(tp); /* srna owns, cant hold a ref */
}
else {
fprintf(stderr, "Could not make type\n");
- pyrna = (BPy_StructRNA *) PyObject_GC_New(BPy_StructRNA, &pyrna_struct_Type);
+ pyrna= (BPy_StructRNA *) PyObject_GC_New(BPy_StructRNA, &pyrna_struct_Type);
#ifdef USE_WEAKREFS
pyrna->in_weakreflist= NULL;
#endif
@@ -5195,13 +5214,13 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
}
}
- pyrna = (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyRNA, type);
+ pyrna= (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyRNA, type);
#ifdef USE_WEAKREFS
pyrna->in_weakreflist= NULL;
#endif
}
else {
- pyrna = (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyArrayRNA, &pyrna_prop_array_Type);
+ pyrna= (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyArrayRNA, &pyrna_prop_array_Type);
((BPy_PropertyArrayRNA *)pyrna)->arraydim= 0;
((BPy_PropertyArrayRNA *)pyrna)->arrayoffset= 0;
#ifdef USE_WEAKREFS
@@ -5214,8 +5233,8 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
return NULL;
}
- pyrna->ptr = *ptr;
- pyrna->prop = prop;
+ pyrna->ptr= *ptr;
+ pyrna->prop= prop;
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
if(ptr->id.data) {
@@ -5305,7 +5324,7 @@ static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname
if(name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy.types: __getattr__ must be a string");
- ret = NULL;
+ ret= NULL;
}
else if (RNA_property_collection_lookup_string(&self->ptr, self->prop, name, &newptr)) {
ret= pyrna_struct_Subtype(&newptr);
@@ -5329,7 +5348,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self);
static PyObject *pyrna_register_class(PyObject *self, PyObject *py_class);
static PyObject *pyrna_unregister_class(PyObject *self, PyObject *py_class);
-static struct PyMethodDef pyrna_basetype_methods[] = {
+static struct PyMethodDef pyrna_basetype_methods[]= {
{"__dir__", (PyCFunction)pyrna_basetype_dir, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}
};
@@ -5346,7 +5365,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
#if 0 /* for now only contains __dir__ */
for(meth=pyrna_basetype_methods; meth->ml_name; meth++) {
- name = PyUnicode_FromString(meth->ml_name);
+ name= PyUnicode_FromString(meth->ml_name);
PyList_Append(list, name);
Py_DECREF(name);
}
@@ -5354,18 +5373,18 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
return list;
}
-static PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE;
+static PyTypeObject pyrna_basetype_Type= BLANK_PYTHON_TYPE;
PyObject *BPY_rna_types(void)
{
BPy_BaseTypeRNA *self;
if ((pyrna_basetype_Type.tp_flags & Py_TPFLAGS_READY)==0) {
- pyrna_basetype_Type.tp_name = "RNA_Types";
- pyrna_basetype_Type.tp_basicsize = sizeof(BPy_BaseTypeRNA);
- pyrna_basetype_Type.tp_getattro = (getattrofunc) pyrna_basetype_getattro;
- pyrna_basetype_Type.tp_flags = Py_TPFLAGS_DEFAULT;
- pyrna_basetype_Type.tp_methods = pyrna_basetype_methods;
+ pyrna_basetype_Type.tp_name= "RNA_Types";
+ pyrna_basetype_Type.tp_basicsize= sizeof(BPy_BaseTypeRNA);
+ pyrna_basetype_Type.tp_getattro= (getattrofunc) pyrna_basetype_getattro;
+ pyrna_basetype_Type.tp_flags= Py_TPFLAGS_DEFAULT;
+ pyrna_basetype_Type.tp_methods= pyrna_basetype_methods;
if(PyType_Ready(&pyrna_basetype_Type) < 0)
return NULL;
@@ -5375,7 +5394,7 @@ PyObject *BPY_rna_types(void)
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&self->ptr);
- self->prop = RNA_struct_find_property(&self->ptr, "structs");
+ self->prop= RNA_struct_find_property(&self->ptr, "structs");
#ifdef USE_WEAKREFS
self->in_weakreflist= NULL;
#endif
@@ -5384,12 +5403,12 @@ PyObject *BPY_rna_types(void)
StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix)
{
- BPy_StructRNA *py_srna = NULL;
+ BPy_StructRNA *py_srna= NULL;
StructRNA *srna;
/* ack, PyObject_GetAttrString wont look up this types tp_dict first :/ */
if(PyType_Check(self)) {
- py_srna = (BPy_StructRNA *)PyDict_GetItemString(((PyTypeObject *)self)->tp_dict, "bl_rna");
+ py_srna= (BPy_StructRNA *)PyDict_GetItemString(((PyTypeObject *)self)->tp_dict, "bl_rna");
Py_XINCREF(py_srna);
}
@@ -5397,7 +5416,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
/* be very careful with this since it will return a parent classes srna.
* modifying this will do confusing stuff! */
if(py_srna==NULL)
- py_srna = (BPy_StructRNA*)PyObject_GetAttrString(self, "bl_rna");
+ py_srna= (BPy_StructRNA*)PyObject_GetAttrString(self, "bl_rna");
}
if(py_srna==NULL) {
@@ -5474,7 +5493,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
PyErr_Format(PyExc_ValueError, "bpy_struct \"%.200s\" registration error: %.200s could not register because the property starts with an '_'\n", RNA_struct_identifier(srna), _PyUnicode_AsString(key));
return -1;
}
- py_srna_cobject = PyCapsule_New(srna, NULL, NULL);
+ py_srna_cobject= PyCapsule_New(srna, NULL, NULL);
/* not 100% nice :/, modifies the dict passed, should be ok */
PyDict_SetItemString(py_kw, "attr", key);
@@ -5482,7 +5501,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
args_fake= PyTuple_New(1);
PyTuple_SET_ITEM(args_fake, 0, py_srna_cobject);
- py_ret = PyObject_Call(py_func, args_fake, py_kw);
+ py_ret= PyObject_Call(py_func, args_fake, py_kw);
Py_DECREF(args_fake); /* free's py_srna_cobject too */
@@ -5515,7 +5534,7 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
{
PyObject *item, *key;
PyObject *order;
- Py_ssize_t pos = 0;
+ Py_ssize_t pos= 0;
int ret= 0;
/* in both cases PyDict_CheckExact(class_dict) will be true even
@@ -5616,7 +5635,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
PyObject *item;
PyObject *py_arg_count;
int i, flag, arg_count, func_arg_count;
- const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; // __name__
+ const char *py_class_name= ((PyTypeObject *)py_class)->tp_name; // __name__
if (base_class) {
@@ -5636,7 +5655,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
if(!(flag & FUNC_REGISTER))
continue;
- item = PyObject_GetAttrString(py_class, RNA_function_identifier(func));
+ item= PyObject_GetAttrString(py_class, RNA_function_identifier(func));
have_function[i]= (item != NULL);
i++;
@@ -5668,8 +5687,8 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
func_arg_count= rna_function_arg_count(func);
if (func_arg_count >= 0) { /* -1 if we dont care*/
- py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(item), "co_argcount");
- arg_count = PyLong_AsLong(py_arg_count);
+ py_arg_count= PyObject_GetAttrString(PyFunction_GET_CODE(item), "co_argcount");
+ arg_count= PyLong_AsLong(py_arg_count);
Py_DECREF(py_arg_count);
/* note, the number of args we check for and the number of args we give to
@@ -5696,7 +5715,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
continue;
identifier= RNA_property_identifier(prop);
- item = PyObject_GetAttrString(py_class, identifier);
+ item= PyObject_GetAttrString(py_class, identifier);
if (item==NULL) {
/* Sneaky workaround to use the class name as the bl_idname */
@@ -5748,7 +5767,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
ParameterIterator iter;
PointerRNA funcptr;
int err= 0, i, flag, ret_len=0;
- int is_static = RNA_function_flag(func) & FUNC_NO_SELF;
+ int is_static= RNA_function_flag(func) & FUNC_NO_SELF;
PropertyRNA *pret_single= NULL;
void *retdata_single= NULL;
@@ -5800,11 +5819,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
/* special case, instance is cached */
}
else if(py_srna == NULL) {
- py_class_instance = NULL;
+ py_class_instance= NULL;
}
else if(py_srna == Py_None) { /* probably wont ever happen but possible */
Py_DECREF(py_srna);
- py_class_instance = NULL;
+ py_class_instance= NULL;
}
else {
#if 1
@@ -5814,7 +5833,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
*/
if(py_class->tp_init) {
/* true in most cases even when the class its self doesnt define an __init__ function. */
- args = PyTuple_New(0);
+ args= PyTuple_New(0);
if (py_class->tp_init(py_srna, args, NULL) < 0) {
Py_DECREF(py_srna);
py_srna= NULL;
@@ -5828,13 +5847,13 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
#else
/* 'almost' all the time calling the class isnt needed.
* We could just do...
- py_class_instance = py_srna;
+ py_class_instance= py_srna;
Py_INCREF(py_class_instance);
* This would work fine but means __init__ functions wouldnt run.
* none of blenders default scripts use __init__ but its nice to call it
* for general correctness. just to note why this is here when it could be safely removed.
*/
- args = PyTuple_New(1);
+ args= PyTuple_New(1);
PyTuple_SET_ITEM(args, 0, py_srna);
py_class_instance= PyObject_Call(py_class, args, NULL);
Py_DECREF(args);
@@ -5844,7 +5863,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
err= -1; /* so the error is not overridden below */
}
else if(py_class_instance_store) {
- *py_class_instance_store = py_class_instance;
+ *py_class_instance_store= py_class_instance;
Py_INCREF(py_class_instance);
}
}
@@ -5857,7 +5876,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if(item) {
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
- args = PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
+ args= PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
if(is_static) {
i= 0;
@@ -5895,7 +5914,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
#endif
/* *** Main Caller *** */
- ret = PyObject_Call(item, args, NULL);
+ ret= PyObject_Call(item, args, NULL);
/* *** Done Calling *** */
@@ -5995,7 +6014,7 @@ static void bpy_class_free(void *pyob_ptr)
PyObject *self= (PyObject *)pyob_ptr;
PyGILState_STATE gilstate;
- gilstate = PyGILState_Ensure();
+ gilstate= PyGILState_Ensure();
// breaks re-registering classes
// PyDict_Clear(((PyTypeObject*)self)->tp_dict);
@@ -6024,11 +6043,11 @@ void pyrna_alloc_types(void)
PointerRNA ptr;
PropertyRNA *prop;
- gilstate = PyGILState_Ensure();
+ gilstate= PyGILState_Ensure();
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&ptr);
- prop = RNA_struct_find_property(&ptr, "structs");
+ prop= RNA_struct_find_property(&ptr, "structs");
RNA_PROP_BEGIN(&ptr, itemptr, prop) {
PyObject *item= pyrna_struct_Subtype(&itemptr);
@@ -6055,7 +6074,7 @@ void pyrna_free_types(void)
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&ptr);
- prop = RNA_struct_find_property(&ptr, "structs");
+ prop= RNA_struct_find_property(&ptr, "structs");
RNA_PROP_BEGIN(&ptr, itemptr, prop) {
@@ -6090,7 +6109,7 @@ static char pyrna_register_class_doc[] =
" .. note:: :exc:`ValueError` exception is raised if the class is not a subclass of a registerable blender class.\n"
"\n"
;
-PyMethodDef meth_bpy_register_class = {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc};
+PyMethodDef meth_bpy_register_class= {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc};
static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class)
{
bContext *C= NULL;
@@ -6192,7 +6211,7 @@ static char pyrna_unregister_class_doc[] =
"\n"
" Unload the python class from blender.\n"
;
-PyMethodDef meth_bpy_unregister_class = {"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc};
+PyMethodDef meth_bpy_unregister_class= {"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc};
static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class)
{
bContext *C= NULL;
@@ -6226,13 +6245,13 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
const char *prop_identifier= NULL;
RNA_blender_rna_pointer_create(&ptr_rna);
- prop_rna = RNA_struct_find_property(&ptr_rna, "structs");
+ prop_rna= RNA_struct_find_property(&ptr_rna, "structs");
/* loop over all structs */
RNA_PROP_BEGIN(&ptr_rna, itemptr, prop_rna) {
- srna_iter = itemptr.data;
+ srna_iter= itemptr.data;
if(pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) {
break;
}
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 9dc6fd28762..284eac19fdd 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -79,7 +79,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
}
}
else {
- prop = RNA_struct_find_property(ptr, path);
+ prop= RNA_struct_find_property(ptr, path);
r_ptr= *ptr;
}
@@ -126,17 +126,17 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
}
/* internal use for insert and delete */
-static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
+static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
{
- static const char *kwlist[] = {"data_path", "index", "frame", "group", NULL};
+ static const char *kwlist[]= {"data_path", "index", "frame", "group", NULL};
const char *path;
/* note, parse_str MUST start with 's|ifs' */
if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name))
return -1;
- if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
+ if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
return -1;
if(*cfra==FLT_MAX)
@@ -258,7 +258,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index))
return NULL;
- if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) {
+ if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) {
return NULL;
}
else {
@@ -332,7 +332,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index))
return NULL;
- if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) {
+ if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) {
return NULL;
}
else {
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 5e4291dff96..df295e812be 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -49,7 +49,7 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *)
*/
/*
- arr[2] = x
+ arr[2]= x
py_to_array_index(arraydim=0, arrayoffset=0, index=2)
validate_array(lvalue_dim=0)
@@ -187,16 +187,16 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
/* arr[3][4][5]
- arr[2] = x
+ arr[2]= x
dimsize={4, 5}
- dimsize[1] = 4
- dimsize[2] = 5
+ dimsize[1]= 4
+ dimsize[2]= 5
lvalue_dim=0, totdim=3
- arr[2][3] = x
+ arr[2][3]= x
lvalue_dim=1
- arr[2][3][4] = x
+ arr[2][3][4]= x
lvalue_dim=2 */
for (i= lvalue_dim; i < totdim; i++)
len *= dimsize[i];
@@ -234,7 +234,7 @@ static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *pro
convert_item(item, value);
rna_set_index(ptr, prop, *index, value);
- *index = *index + 1;
+ *index= *index + 1;
}
else {
convert_item(item, data);
@@ -320,11 +320,11 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, i
/* arr[3][4][5]
- arr[2] = x
- lvalue_dim=0, index = 0 + 2 * 4 * 5
+ arr[2]= x
+ lvalue_dim=0, index= 0 + 2 * 4 * 5
- arr[2][3] = x
- lvalue_dim=1, index = 40 + 3 * 5 */
+ arr[2][3]= x
+ lvalue_dim=1, index= 40 + 3 * 5 */
lvalue_dim++;
@@ -504,7 +504,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
BPy_PropertyArrayRNA *ret= NULL;
arraydim= self ? self->arraydim : 0;
- arrayoffset = self ? self->arrayoffset : 0;
+ arrayoffset= self ? self->arrayoffset : 0;
/* just in case check */
len= RNA_property_multi_array_length(ptr, prop, arraydim);
@@ -524,11 +524,11 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
/* arr[3][4][5]
- x = arr[2]
- index = 0 + 2 * 4 * 5
+ x= arr[2]
+ index= 0 + 2 * 4 * 5
- x = arr[2][3]
- index = offset + 3 * 5 */
+ x= arr[2][3]
+ index= offset + 3 * 5 */
for (i= arraydim + 1; i < totdim; i++)
index *= dimsize[i];
@@ -536,7 +536,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
ret->arrayoffset= arrayoffset + index;
}
else {
- index = arrayoffset + index;
+ index= arrayoffset + index;
ret= (BPy_PropertyArrayRNA *)pyrna_array_index(ptr, prop, index);
}
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 7581eb16a9d..20f5c6c522e 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -57,7 +57,7 @@ static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customd
cb_func= PyTuple_GET_ITEM((PyObject *)customdata, 0);
cb_args= PyTuple_GET_ITEM((PyObject *)customdata, 1);
- result = PyObject_CallObject(cb_func, cb_args);
+ result= PyObject_CallObject(cb_func, cb_args);
if(result) {
Py_DECREF(result);
@@ -88,7 +88,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
if(cb_event_str) {
- static EnumPropertyItem region_draw_mode_items[] = {
+ static EnumPropertyItem region_draw_mode_items[]= {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""},
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 171454da19b..b5dec7205a6 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -77,7 +77,8 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
*offset = -1;
Py_DECREF(v);
v = NULL;
- } else {
+ }
+ else {
hold = PyLong_AsLong(v);
Py_DECREF(v);
v = NULL;
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index ccbee2abcd1..0d3b036850d 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -37,7 +37,7 @@
#include "../generic/py_capi_utils.h"
-static bContext* __py_context = NULL;
+static bContext* __py_context= NULL;
bContext* BPy_GetContext(void) { return __py_context; }
void BPy_SetContext(bContext *C) { __py_context= C; }
@@ -52,7 +52,7 @@ char *BPy_enum_as_string(EnumPropertyItem *item)
BLI_dynstr_appendf(dynstr, (e==item)?"'%s'":", '%s'", item->identifier);
}
- cstring = BLI_dynstr_get_cstring(dynstr);
+ cstring= BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
return cstring;
}
@@ -146,19 +146,19 @@ int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, co
if(type == &PyFloat_Type) {
float *array_float= array;
for(i=0; i<length; i++) {
- array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
+ array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if(type == &PyLong_Type) {
int *array_int= array;
for(i=0; i<length; i++) {
- array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, 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++) {
- array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
+ array_bool[i]= (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
else {