formatting edits only to use more consisted style
authorCampbell Barton <ideasman42@gmail.com>
Mon, 26 Dec 2011 12:26:11 +0000 (12:26 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 26 Dec 2011 12:26:11 +0000 (12:26 +0000)
18 files changed:
source/blender/python/generic/bpy_internal_import.c
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_app.c
source/blender/python/intern/bpy_app_handlers.c
source/blender/python/intern/bpy_driver.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_interface_atexit.c
source/blender/python/intern/bpy_intern_string.c
source/blender/python/intern/bpy_library.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_operator_wrap.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_anim.c
source/blender/python/intern/bpy_rna_array.c
source/blender/python/intern/bpy_rna_callback.c
source/blender/python/intern/bpy_traceback.c
source/blender/python/intern/bpy_util.c

index d918326132959bb81c411c4f5386586c9ac72390..db3519a305643273c02e01eb98a8d06a103990b5 100644 (file)
@@ -51,7 +51,7 @@
 #include "BKE_text.h" /* txt_to_buf */ 
 #include "BKE_main.h"
 
-static Main *bpy_import_main= NULL;
+static Main *bpy_import_main = NULL;
 
 /* 'builtins' is most likely PyEval_GetBuiltins() */
 void bpy_import_init(PyObject *builtins)
@@ -59,13 +59,13 @@ void bpy_import_init(PyObject *builtins)
        PyObject *item;
        PyObject *mod;
 
-       PyDict_SetItemString(builtins, "__import__",    item=PyCFunction_New(&bpy_import_meth, NULL));  Py_DECREF(item);
+       PyDict_SetItemString(builtins, "__import__", item = PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
 
        /* move reload here
         * XXX, use import hooks */
-       mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
+       mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
        if (mod) {
-               PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+               PyDict_SetItemString(PyModule_GetDict(mod), "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
                Py_DECREF(mod);
        }
        else {
@@ -79,7 +79,7 @@ static void free_compiled_text(Text *text)
        if (text->compiled) {
                Py_DECREF((PyObject *)text->compiled);
        }
-       text->compiled= NULL;
+       text->compiled = NULL;
 }
 
 struct Main *bpy_import_main_get(void)
@@ -89,18 +89,18 @@ struct Main *bpy_import_main_get(void)
 
 void bpy_import_main_set(struct Main *maggie)
 {
-       bpy_import_main= maggie;
+       bpy_import_main = maggie;
 }
 
 /* returns a dummy filename for a textblock so we can tell what file a text block comes from */
 void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
 {
-       BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name+2);
+       BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name + 2);
 }
 
 PyObject *bpy_text_import(Text *text)
 {
-       char *buf= NULL;
+       char *buf = NULL;
        char modulename[24];
        int len;
 
@@ -108,8 +108,8 @@ PyObject *bpy_text_import(Text *text)
                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);
+               buf = txt_to_buf(text);
+               text->compiled = Py_CompileString(buf, fn_dummy, Py_file_input);
                MEM_freeN(buf);
 
                if (PyErr_Occurred()) {
@@ -121,21 +121,21 @@ PyObject *bpy_text_import(Text *text)
                }
        }
 
-       len= strlen(text->id.name+2);
-       BLI_strncpy(modulename, text->id.name+2, len);
-       modulename[len - 3]= '\0'; /* remove .py */
+       len = strlen(text->id.name + 2);
+       BLI_strncpy(modulename, text->id.name + 2, len);
+       modulename[len - 3] = '\0'; /* remove .py */
        return PyImport_ExecCodeModule(modulename, text->compiled);
 }
 
 PyObject *bpy_text_import_name(const char *name, int *found)
 {
        Text *text;
-       char txtname[MAX_ID_NAME-2];
-       int namelen= strlen(name);
-//XXX  Main *maggie= bpy_import_main ? bpy_import_main:G.main;
-       Main *maggie= bpy_import_main;
+       char txtname[MAX_ID_NAME - 2];
+       int namelen = strlen(name);
+//XXX  Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+       Main *maggie = bpy_import_main;
        
-       *found= 0;
+       *found = 0;
 
        if (!maggie) {
                printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
@@ -143,17 +143,17 @@ PyObject *bpy_text_import_name(const char *name, int *found)
        }
 
        /* we know this cant be importable, the name is too long for blender! */
-       if (namelen >= (MAX_ID_NAME-2) - 3) return NULL;
+       if (namelen >= (MAX_ID_NAME - 2) - 3) return NULL;
 
        memcpy(txtname, name, namelen);
        memcpy(&txtname[namelen], ".py", 4);
 
-       text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
+       text = BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
 
        if (!text)
                return NULL;
        else
-               *found= 1;
+               *found = 1;
        
        return bpy_text_import(text);
 }
@@ -168,32 +168,32 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
        Text *text;
        const char *name;
        char *filepath;
-       char *buf= NULL;
-//XXX  Main *maggie= bpy_import_main ? bpy_import_main:G.main;
-       Main *maggie= bpy_import_main;
+       char *buf = NULL;
+//XXX  Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+       Main *maggie = bpy_import_main;
        
        if (!maggie) {
                printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
                return NULL;
        }
        
-       *found= 0;
+       *found = 0;
        
        /* get name, filename from the module itself */
-       if ((name= PyModule_GetName(module)) == NULL)
+       if ((name = PyModule_GetName(module)) == NULL)
                return NULL;
 
-       if ((filepath= (char *)PyModule_GetFilename(module)) == NULL)
+       if ((filepath = (char *)PyModule_GetFilename(module)) == NULL)
                return NULL;
 
        /* look up the text object */
-       text= BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
+       text = BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
 
        /* uh-oh.... didn't find it */
        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) */ 
@@ -202,8 +202,8 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
        }
 
        /* compile the buffer */
-       buf= txt_to_buf(text);
-       text->compiled= Py_CompileString(buf, text->id.name+2, Py_file_input);
+       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 */
@@ -224,20 +224,22 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
 {
        PyObject *exception, *err, *tb;
        char *name;
-       int found= 0;
-       PyObject *globals= NULL, *locals= NULL, *fromlist= NULL;
-       int level= -1; /* relative imports */
+       int found = 0;
+       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))
+                                        &name, &globals, &locals, &fromlist, &level))
+       {
                return NULL;
+       }
 
        /* import existing builtin modules or modules that have been imported already */
-       newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
+       newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
        
        if (newmodule)
                return newmodule;
@@ -245,7 +247,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
        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();
@@ -254,7 +256,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
                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 */
+       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);
@@ -276,18 +278,18 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
 static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
 {
        PyObject *exception, *err, *tb;
-       PyObject *newmodule= NULL;
-       int found= 0;
+       PyObject *newmodule = NULL;
+       int found = 0;
 
        /* try reimporting from file */
-       newmodule= PyImport_ReloadModule(module);
+       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);
+       newmodule = bpy_text_reimport(module, &found);
        if (newmodule) {/* found module as blender text, ignore above exception */
                PyErr_Clear();
                Py_XDECREF(exception);
@@ -295,7 +297,7 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
                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 */
+       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);
@@ -310,5 +312,5 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
        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"};
index 4a49b9bc1c34d7395c956fdf51099a41dbc41043..e0e3dd5519c870318f3300c304710969166fa5ca 100644 (file)
@@ -58,7 +58,7 @@
 #include "../generic/blf_py_api.h"
 #include "../mathutils/mathutils.h"
 
-PyObject *bpy_package_py= NULL;
+PyObject *bpy_package_py = NULL;
 
 PyDoc_STRVAR(bpy_script_paths_doc,
 ".. function:: script_paths()\n"
@@ -70,12 +70,12 @@ PyDoc_STRVAR(bpy_script_paths_doc,
 );
 static PyObject *bpy_script_paths(PyObject *UNUSED(self))
 {
-       PyObject *ret= PyTuple_New(2);
+       PyObject *ret = PyTuple_New(2);
        char *path;
 
-       path= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
+       path = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
        PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
-       path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
+       path = BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
        PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
 
        return ret;
@@ -83,8 +83,8 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self))
 
 static int bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
 {
-       PyObject *list= (PyObject *)userdata;
-       PyObject *item= PyUnicode_DecodeFSDefault(path_src);
+       PyObject *list = (PyObject *)userdata;
+       PyObject *item = PyUnicode_DecodeFSDefault(path_src);
        PyList_Append(list, item);
        Py_DECREF(item);
        return FALSE; /* never edits the path */
@@ -106,13 +106,13 @@ PyDoc_STRVAR(bpy_blend_paths_doc,
 );
 static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 {
-       int flag= 0;
+       int flag = 0;
        PyObject *list;
 
-       int absolute= FALSE;
-       int packed=   FALSE;
-       int local=    FALSE;
-       static const char *kwlist[]= {"absolute", "packed", "local", NULL};
+       int absolute = FALSE;
+       int packed =   FALSE;
+       int local =    FALSE;
+       static const char *kwlist[] = {"absolute", "packed", "local", NULL};
 
        if (!PyArg_ParseTupleAndKeywords(args, kw, "|ii:blend_paths",
                                         (char **)kwlist, &absolute, &packed))
@@ -124,7 +124,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
        if (!packed)  flag |= BPATH_TRAVERSE_SKIP_PACKED;
        if (local)    flag |= BPATH_TRAVERSE_SKIP_LIBRARY;
 
-       list= PyList_New(0);
+       list = PyList_New(0);
 
        bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
 
@@ -132,13 +132,13 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
 }
 
 
-// PyDoc_STRVAR(bpy_user_resource_doc[]= // now in bpy/utils.py
+// PyDoc_STRVAR(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;
+       char *subdir = NULL;
        int folder_id;
-       static const char *kwlist[]= {"type", "subdir", NULL};
+       static const char *kwlist[] = {"type", "subdir", NULL};
 
        char *path;
 
@@ -146,20 +146,20 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
                return NULL;
        
        /* stupid string compare */
-       if      (!strcmp(type, "DATAFILES")) folder_id= BLENDER_USER_DATAFILES;
-       else if (!strcmp(type, "CONFIG"))    folder_id= BLENDER_USER_CONFIG;
-       else if (!strcmp(type, "SCRIPTS"))   folder_id= BLENDER_USER_SCRIPTS;
-       else if (!strcmp(type, "AUTOSAVE"))  folder_id= BLENDER_USER_AUTOSAVE;
+       if      (!strcmp(type, "DATAFILES")) folder_id = BLENDER_USER_DATAFILES;
+       else if (!strcmp(type, "CONFIG"))    folder_id = BLENDER_USER_CONFIG;
+       else if (!strcmp(type, "SCRIPTS"))   folder_id = BLENDER_USER_SCRIPTS;
+       else if (!strcmp(type, "AUTOSAVE"))  folder_id = BLENDER_USER_AUTOSAVE;
        else {
                PyErr_SetString(PyExc_ValueError, "invalid resource argument");
                return NULL;
        }
        
        /* same logic as BLI_get_folder_create(), but best leave it up to the script author to create */
-       path= BLI_get_folder(folder_id, subdir);
+       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 : "");
 }
@@ -181,8 +181,8 @@ PyDoc_STRVAR(bpy_resource_path_doc,
 static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 {
        char *type;
-       int major= BLENDER_VERSION/100, minor= BLENDER_VERSION%100;
-       static const char *kwlist[]= {"type", "major", "minor", NULL};
+       int major = BLENDER_VERSION / 100, minor = BLENDER_VERSION % 100;
+       static const char *kwlist[] = {"type", "major", "minor", NULL};
        int folder_id;
        char *path;
 
@@ -190,32 +190,32 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
                return NULL;
 
        /* stupid string compare */
-       if     (!strcmp(type, "USER"))     folder_id= BLENDER_RESOURCE_PATH_USER;
-       else if (!strcmp(type, "LOCAL"))   folder_id= BLENDER_RESOURCE_PATH_LOCAL;
-       else if (!strcmp(type, "SYSTEM"))  folder_id= BLENDER_RESOURCE_PATH_SYSTEM;
+       if     (!strcmp(type, "USER"))     folder_id = BLENDER_RESOURCE_PATH_USER;
+       else if (!strcmp(type, "LOCAL"))   folder_id = BLENDER_RESOURCE_PATH_LOCAL;
+       else if (!strcmp(type, "SYSTEM"))  folder_id = BLENDER_RESOURCE_PATH_SYSTEM;
        else {
                PyErr_SetString(PyExc_ValueError, "invalid resource argument");
                return NULL;
        }
 
-       path= BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
+       path = BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
 
        return PyUnicode_DecodeFSDefault(path);
 }
 
-static PyMethodDef meth_bpy_script_paths=
+static PyMethodDef meth_bpy_script_paths =
        {"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc};
-static PyMethodDef meth_bpy_blend_paths=
+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=
+static PyMethodDef meth_bpy_user_resource =
        {"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS|METH_KEYWORDS, NULL};
-static PyMethodDef meth_bpy_resource_path=
+static PyMethodDef meth_bpy_resource_path =
        {"resource_path", (PyCFunction)bpy_resource_path, METH_VARARGS|METH_KEYWORDS, bpy_resource_path_doc};
 
 
 static PyObject *bpy_import_test(const char *modname)
 {
-       PyObject *mod= PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0);
+       PyObject *mod = PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0);
        if (mod) {
                Py_DECREF(mod);
        }
@@ -238,11 +238,11 @@ void BPy_init_modules(void)
        PyObject *mod;
 
        /* Needs to be first since this dir is needed for future modules */
-       char *modpath= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
+       char *modpath = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
        if (modpath) {
                // printf("bpy: found module path '%s'.\n", modpath);
-               PyObject *sys_path= PySys_GetObject("path"); /* borrow */
-               PyObject *py_modpath= PyUnicode_FromString(modpath);
+               PyObject *sys_path = PySys_GetObject("path"); /* borrow */
+               PyObject *py_modpath = PyUnicode_FromString(modpath);
                PyList_Insert(sys_path, 0, py_modpath); /* add first */
                Py_DECREF(py_modpath);
        }
@@ -252,7 +252,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);
@@ -280,7 +280,7 @@ void BPy_init_modules(void)
 
        /* bpy context */
        RNA_pointer_create(NULL, &RNA_Context, (void *)BPy_GetContext(), &ctx_ptr);
-       bpy_context_module= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ctx_ptr);
+       bpy_context_module = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ctx_ptr);
        /* odd that this is needed, 1 ref on creation and another for the module
         * but without we get a crash on exit */
        Py_INCREF(bpy_context_module);
@@ -298,5 +298,5 @@ void BPy_init_modules(void)
        PyModule_AddObject(mod, meth_bpy_unregister_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_unregister_class, NULL));
 
        /* add our own modules dir, this is a python package */
-       bpy_package_py= bpy_import_test("bpy");
+       bpy_package_py = bpy_import_test("bpy");
 }
index a10be098a614585591628f26e8c10ae66a80ffed..d5f0cd205fae7dd3a892a6031cf5470f27ec314c 100644 (file)
@@ -59,7 +59,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 *)"version_char", (char *)"The Blender version character (for minor releases)"},
@@ -83,11 +83,11 @@ 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 */
-       (sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1
+       (sizeof(app_info_fields) / sizeof(PyStructSequence_Field)) - 1
 };
 
 #define DO_EXPAND(VAL)  VAL ## 1
@@ -96,9 +96,9 @@ static PyStructSequence_Desc app_info_desc= {
 static PyObject *make_app_info(void)
 {
        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;
        }
@@ -110,8 +110,11 @@ static PyObject *make_app_info(void)
 #define SetObjItem(obj) \
        PyStructSequence_SET_ITEM(app_info, pos++, obj)
 
-       SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
-       SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
+       SetObjItem(Py_BuildValue("(iii)",
+                                BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
+       SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)",
+                                       BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
+
 #if defined(BLENDER_VERSION_CHAR) && EXPAND(BLENDER_VERSION_CHAR) != 1
        SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR));
 #else
@@ -170,7 +173,7 @@ static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)
 
 static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
 {
-       int param= PyObject_IsTrue(value);
+       int param = PyObject_IsTrue(value);
 
        if (param < 0) {
                PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
@@ -193,14 +196,14 @@ static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(cl
 
 static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
 {
-       int param= PyLong_AsSsize_t(value);
+       int param = PyLong_AsSsize_t(value);
 
        if (param == -1 && PyErr_Occurred()) {
                PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
                return -1;
        }
        
-       G.rt= param;
+       G.rt = param;
 
        return 0;
 }
@@ -229,7 +232,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl
 }
 
 
-static PyGetSetDef bpy_app_getsets[]= {
+static PyGetSetDef bpy_app_getsets[] = {
        {(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, NULL},
        {(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL},
        {(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)bpy_app_tempdir_doc, NULL},
@@ -242,7 +245,7 @@ static void py_struct_seq_getset_init(void)
        /* tricky dynamic members, not to py-spec! */
        PyGetSetDef *getset;
 
-       for (getset= bpy_app_getsets; getset->name; getset++) {
+       for (getset = bpy_app_getsets; getset->name; getset++) {
                PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, PyDescr_NewGetSet(&BlenderAppType, getset));
        }
 }
@@ -255,12 +258,12 @@ PyObject *BPY_app_struct(void)
        
        PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
 
-       ret= make_app_info();
+       ret = make_app_info();
 
        /* prevent user from creating new instances */
-       BlenderAppType.tp_init= NULL;
-       BlenderAppType.tp_new= NULL;
-       BlenderAppType.tp_hash= (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
+       BlenderAppType.tp_init = NULL;
+       BlenderAppType.tp_new = NULL;
+       BlenderAppType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
 
        /* kindof a hack ontop of PyStructSequence */
        py_struct_seq_getset_init();
index dc9ef9ee8e8de76d27490b6fc66082e13c74449c..721bce5169311aa136e8300f1dc5a5cd27760612 100644 (file)
@@ -41,7 +41,7 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
 
 static PyTypeObject BlenderAppCbType;
 
-static PyStructSequence_Field app_cb_info_fields[]= {
+static PyStructSequence_Field app_cb_info_fields[] = {
        {(char *)"frame_change_pre",  (char *)"Callback list - on frame change for playback and rendering (before)"},
        {(char *)"frame_change_post", (char *)"Callback list - on frame change for playback and rendering (after)"},
        {(char *)"render_pre",        (char *)"Callback list - on render (before)"},
@@ -61,11 +61,11 @@ static PyStructSequence_Field app_cb_info_fields[]= {
        {NULL}
 };
 
-static PyStructSequence_Desc app_cb_info_desc= {
+static PyStructSequence_Desc app_cb_info_desc = {
        (char *)"bpy.app.handlers",     /* name */
        (char *)"This module contains callbacks",    /* doc */
        app_cb_info_fields,    /* fields */
-       (sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)) - 1
+       (sizeof(app_cb_info_fields) / sizeof(PyStructSequence_Field)) - 1
 };
 
 /*
@@ -86,7 +86,7 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
                return NULL;
 
        if (PyFunction_Check(value)) {
-               PyObject **dict_ptr= _PyObject_GetDictPtr(value);
+               PyObject **dict_ptr = _PyObject_GetDictPtr(value);
                if (dict_ptr == NULL) {
                        PyErr_SetString(PyExc_ValueError,
                                        "bpy.app.handlers.persistent wasn't able to "
@@ -96,7 +96,7 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
                else {
                        /* set id */
                        if (*dict_ptr == NULL) {
-                               *dict_ptr= PyDict_New();
+                               *dict_ptr = PyDict_New();
                        }
 
                        PyDict_SetItemString(*dict_ptr, PERMINENT_CB_ID, Py_None);
@@ -163,23 +163,23 @@ static PyTypeObject BPyPersistent_Type = {
     0,                                          /* tp_free */
 };
 
-static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL};
+static PyObject *py_cb_array[BLI_CB_EVT_TOT] = {NULL};
 
 static PyObject *make_app_cb_info(void)
 {
        PyObject *app_cb_info;
-       int pos= 0;
+       int pos = 0;
 
-       app_cb_info= PyStructSequence_New(&BlenderAppCbType);
+       app_cb_info = PyStructSequence_New(&BlenderAppCbType);
        if (app_cb_info == NULL) {
                return NULL;
        }
 
-       for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+       for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
                if (app_cb_info_fields[pos].name == NULL) {
                        Py_FatalError("invalid callback slots 1");
                }
-               PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0)));
+               PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos] = PyList_New(0)));
        }
        if (app_cb_info_fields[pos + APP_CB_OTHER_FIELDS].name != NULL) {
                Py_FatalError("invalid callback slots 2");
@@ -196,7 +196,7 @@ PyObject *BPY_app_handlers_struct(void)
        PyObject *ret;
 
 #if defined(_MSC_VER) || defined(FREE_WINDOWS)
-       BPyPersistent_Type.ob_base.ob_base.ob_type= &PyType_Type;
+       BPyPersistent_Type.ob_base.ob_base.ob_type = &PyType_Type;
 #endif
 
        if (PyType_Ready(&BPyPersistent_Type) < 0) {
@@ -205,24 +205,24 @@ PyObject *BPY_app_handlers_struct(void)
 
        PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
 
-       ret= make_app_cb_info();
+       ret = make_app_cb_info();
 
        /* prevent user from creating new instances */
-       BlenderAppCbType.tp_init= NULL;
-       BlenderAppCbType.tp_new= NULL;
-       BlenderAppCbType.tp_hash= (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
+       BlenderAppCbType.tp_init = NULL;
+       BlenderAppCbType.tp_new = NULL;
+       BlenderAppCbType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
 
        /* assign the C callbacks */
        if (ret) {
-               static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}};
+               static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT] = {{NULL}};
                bCallbackFuncStore *funcstore;
-               int pos= 0;
+               int pos = 0;
 
-               for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
-                       funcstore= &funcstore_array[pos];
-                       funcstore->func= bpy_app_generic_callback;
-                       funcstore->alloc= 0;
-                       funcstore->arg= SET_INT_IN_POINTER(pos);
+               for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
+                       funcstore = &funcstore_array[pos];
+                       funcstore->func = bpy_app_generic_callback;
+                       funcstore->alloc = 0;
+                       funcstore->arg = SET_INT_IN_POINTER(pos);
                        BLI_add_cb(funcstore, pos);
                }
        }
@@ -232,30 +232,30 @@ PyObject *BPY_app_handlers_struct(void)
 
 void BPY_app_handlers_reset(const short do_all)
 {
-       int pos= 0;
+       int pos = 0;
 
        if (do_all) {
-       for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+       for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
                        /* clear list */
                        PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
                }
        }
        else {
                /* save string conversion thrashing */
-               PyObject *perm_id_str= PyUnicode_FromString(PERMINENT_CB_ID);
+               PyObject *perm_id_str = PyUnicode_FromString(PERMINENT_CB_ID);
 
-               for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+               for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
                        /* clear only items without PERMINENT_CB_ID */
-                       PyObject *ls= py_cb_array[pos];
+                       PyObject *ls = py_cb_array[pos];
                        Py_ssize_t i;
 
                        PyObject *item;
                        PyObject **dict_ptr;
 
-                       for (i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
+                       for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
 
-                               if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) &&
-                                    (dict_ptr= _PyObject_GetDictPtr(item)) &&
+                               if ( (PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
+                                    (dict_ptr = _PyObject_GetDictPtr(item)) &&
                                     (*dict_ptr) &&
                                     (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
                                {
@@ -276,12 +276,12 @@ void BPY_app_handlers_reset(const short do_all)
 /* the actual callback - not necessarily called from py */
 void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
 {
-       PyObject *cb_list= py_cb_array[GET_INT_FROM_POINTER(arg)];
+       PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
        Py_ssize_t cb_list_len;
-       if ((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) {
-               PyGILState_STATE gilstate= PyGILState_Ensure();
+       if ((cb_list_len = PyList_GET_SIZE(cb_list)) > 0) {
+               PyGILState_STATE gilstate = PyGILState_Ensure();
 
-               PyObject* args= PyTuple_New(1); // save python creating each call
+               PyObject* args = PyTuple_New(1); // save python creating each call
                PyObject* func;
                PyObject* ret;
                Py_ssize_t pos;
@@ -298,10 +298,10 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
                }
 
                // Iterate the list and run the callbacks
-               for (pos=0; pos < cb_list_len; pos++) {
-                       func= PyList_GET_ITEM(cb_list, pos);
-                       ret= PyObject_Call(func, args, NULL);
-                       if (ret==NULL) {
+               for (pos = 0; pos < cb_list_len; pos++) {
+                       func = PyList_GET_ITEM(cb_list, pos);
+                       ret = PyObject_Call(func, args, NULL);
+                       if (ret == NULL) {
                                PyErr_Print();
                                PyErr_Clear();
                        }
index e628cb891d8a0d70cff4609738fec99afda89573..95b00b18f43642876341aa4f3b5a52cd70a6fd41 100644 (file)
@@ -47,7 +47,7 @@ extern void BPY_update_rna_module(void);
 
 
 /* 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.
@@ -59,32 +59,32 @@ 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);
        }
 
        /* add bpy to global namespace */
-       mod= PyImport_ImportModuleLevel((char *)"bpy", NULL, NULL, NULL, 0);
+       mod = PyImport_ImportModuleLevel((char *)"bpy", NULL, NULL, NULL, 0);
        if (mod) {
                PyDict_SetItemString(bpy_pydriver_Dict, "bpy", mod);
                Py_DECREF(mod);
        }
 
        /* add noise to global namespace */
-       mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
+       mod = PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
        if (mod) {
-               PyObject *modsub= PyDict_GetItemString(PyModule_GetDict(mod), "noise");
+               PyObject *modsub = PyDict_GetItemString(PyModule_GetDict(mod), "noise");
                PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub);
                Py_DECREF(mod);
        }
@@ -93,9 +93,9 @@ int bpy_pydriver_create_dict(void)
 }
 
 /* note, this function should do nothing most runs, only when changing frame */
-static PyObject *bpy_pydriver_InternStr__frame= NULL;
+static PyObject *bpy_pydriver_InternStr__frame = NULL;
 /* not thread safe but neither is python */
-static float bpy_pydriver_evaltime_prev= FLT_MAX;
+static float bpy_pydriver_evaltime_prev = FLT_MAX;
 
 static void bpy_pydriver_update_dict(const float evaltime)
 {
@@ -103,14 +103,14 @@ static void bpy_pydriver_update_dict(const float evaltime)
 
                /* currently only update the frame */
                if (bpy_pydriver_InternStr__frame == NULL) {
-                       bpy_pydriver_InternStr__frame= PyUnicode_FromString("frame");
+                       bpy_pydriver_InternStr__frame = PyUnicode_FromString("frame");
                }
 
                PyDict_SetItem(bpy_pydriver_Dict,
                               bpy_pydriver_InternStr__frame,
                               PyFloat_FromDouble(evaltime));
 
-               bpy_pydriver_evaltime_prev= evaltime;
+               bpy_pydriver_evaltime_prev = evaltime;
        }
 }
 
@@ -122,21 +122,21 @@ static void bpy_pydriver_update_dict(const float evaltime)
 void BPY_driver_reset(void)
 {
        PyGILState_STATE gilstate;
-       int use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
+       int use_gil = 1; /* !PYC_INTERPRETER_ACTIVE; */
 
        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 (bpy_pydriver_InternStr__frame) {
                Py_DECREF(bpy_pydriver_InternStr__frame);
-               bpy_pydriver_InternStr__frame= NULL;
-               bpy_pydriver_evaltime_prev= FLT_MAX;
+               bpy_pydriver_InternStr__frame = NULL;
+               bpy_pydriver_evaltime_prev = FLT_MAX;
        }
 
        if (use_gil)
@@ -170,22 +170,22 @@ static void pydriver_error(ChannelDriver *driver)
  */
 float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
 {
-       PyObject *driver_vars=NULL;
-       PyObject *retval= NULL;
+       PyObject *driver_vars = NULL;
+       PyObject *retval = NULL;
        PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
        PyObject *expr_code;
        PyGILState_STATE gilstate;
        int use_gil;
 
        DriverVar *dvar;
-       double result= 0.0; /* default return */
-       char *expr= NULL;
-       short targets_ok= 1;
+       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;
-       if ((expr == NULL) || (expr[0]=='\0'))
+       expr = driver->expression;
+       if ((expr == NULL) || (expr[0] == '\0'))
                return 0.0f;
 
        if (!(G.f & G_SCRIPT_AUTOEXEC)) {
@@ -193,10 +193,10 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
                return 0.0f;
        }
 
-       use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
+       use_gil = 1; /* !PYC_INTERPRETER_ACTIVE; */
 
        if (use_gil)
-               gilstate= PyGILState_Ensure();
+               gilstate = PyGILState_Ensure();
 
        /* needed since drivers are updated directly after undo where 'main' is
         * re-allocated [#28807] */
@@ -216,51 +216,51 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
        bpy_pydriver_update_dict(evaltime);
 
 
-       if (driver->expr_comp==NULL)
+       if (driver->expr_comp == NULL)
                driver->flag |= DRIVER_FLAG_RECOMPILE;
 
        /* compile the expression first if it hasn't been compiled or needs to be rebuilt */
        if (driver->flag & DRIVER_FLAG_RECOMPILE) {
                Py_XDECREF(driver->expr_comp);
-               driver->expr_comp= PyTuple_New(2);
+               driver->expr_comp = PyTuple_New(2);
 
-               expr_code= Py_CompileString(expr, "<bpy driver>", Py_eval_input);
+               expr_code = Py_CompileString(expr, "<bpy driver>", Py_eval_input);
                PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 0, expr_code);
 
                driver->flag &= ~DRIVER_FLAG_RECOMPILE;
                driver->flag |= DRIVER_FLAG_RENAMEVAR; /* maybe this can be removed but for now best keep until were sure */
        }
        else {
-               expr_code= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0);
+               expr_code = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0);
        }
 
        if (driver->flag & DRIVER_FLAG_RENAMEVAR) {
                /* may not be set */
-               expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
+               expr_vars = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
                Py_XDECREF(expr_vars);
 
-               expr_vars= PyTuple_New(BLI_countlist(&driver->variables));
+               expr_vars = PyTuple_New(BLI_countlist(&driver->variables));
                PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 1, expr_vars);
 
-               for (dvar= driver->variables.first, i=0; dvar; dvar= dvar->next) {
+               for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
                        PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
                }
                
                driver->flag &= ~DRIVER_FLAG_RENAMEVAR;
        }
        else {
-               expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
+               expr_vars = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
        }
 
        /* add target values to a dict that will be used as '__locals__' dict */
-       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;
+       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;
                
                /* try to get variable value */
-               tval= driver_get_variable_value(driver, dvar);
-               driver_arg= PyFloat_FromDouble((double)tval);
+               tval = driver_get_variable_value(driver, dvar);
+               driver_arg = PyFloat_FromDouble((double)tval);
                
                /* try to add to dictionary */
                /* if (PyDict_SetItemString(driver_vars, dvar->name, driver_arg)) { */
@@ -269,7 +269,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
                        if (targets_ok) {
                                /* first one - print some extra info for easier identification */
                                fprintf(stderr, "\nBPY_driver_eval() - Error while evaluating PyDriver:\n");
-                               targets_ok= 0;
+                               targets_ok = 0;
                        }
                        
                        fprintf(stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
@@ -282,11 +282,11 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
 
 #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)
-               retval= PyEval_EvalCode((void *)expr_code, bpy_pydriver_Dict, driver_vars);
+               retval = PyEval_EvalCode((void *)expr_code, bpy_pydriver_Dict, driver_vars);
 #endif
 
        /* decref the driver vars first...  */
@@ -296,10 +296,10 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
        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 */
index 90d5cccc85a9cfbb5fbdd01ac6c86808d5f695d6..7d91438e4f704c1e9cb5b81d437ea99d7bcea8fe 100644 (file)
 /* for internal use, when starting and ending python scripts */
 
 /* incase a python script triggers another python call, stop bpy_context_clear from invalidating */
-static int py_call_level= 0;
-BPy_StructRNA *bpy_context_module= NULL; /* for fast access */
+static int py_call_level = 0;
+BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
 
 // #define TIME_PY_RUN // simple python tests. prints on exit.
 
 #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 */
@@ -102,18 +102,18 @@ 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) {
+       if (py_call_level == 1) {
                bpy_context_update(C);
 
 #ifdef TIME_PY_RUN
-               if (bpy_timer_count==0) {
+               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 = PIL_check_seconds_timer();
+                       bpy_timer_run = bpy_timer_run_tot = 0.0;
                }
-               bpy_timer_run= PIL_check_seconds_timer();
+               bpy_timer_run = PIL_check_seconds_timer();
 
 
                bpy_timer_count++;
@@ -132,7 +132,7 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
        if (py_call_level < 0) {
                fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n");
        }
-       else if (py_call_level==0) {
+       else if (py_call_level == 0) {
                /* XXX - Calling classes currently wont store the context :\,
                 * cant set NULL because of this. but this is very flakey still. */
 #if 0
@@ -152,21 +152,21 @@ void BPY_text_free_code(Text *text)
 {
        if (text->compiled) {
                Py_DECREF((PyObject *)text->compiled);
-               text->compiled= NULL;
+               text->compiled = NULL;
        }
 }
 
 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);
+       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
 #endif
 
        /* refreshes the main struct */
        BPY_update_rna_module();
-       bpy_context_module->ptr.data= (void *)C;
+       bpy_context_module->ptr.data = (void *)C;
 }
 
 void BPY_context_set(bContext *C)
@@ -179,7 +179,7 @@ extern PyObject *AUD_initPython(void);
 /* defined in cycles/blender */
 extern PyObject *CYCLES_initPython(void);
 
-static struct _inittab bpy_internal_modules[]= {
+static struct _inittab bpy_internal_modules[] = {
        {(char *)"mathutils", PyInit_mathutils},
 //     {(char *)"mathutils.geometry", PyInit_mathutils_geometry},
 //     {(char *)"mathutils.noise", PyInit_mathutils_noise},
@@ -199,7 +199,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 program_path_wchar[FILE_MAX]; /* python holds a reference */
@@ -222,7 +222,7 @@ void BPY_python_start(int argc, const char **argv)
        /* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' to
         * parse from the 'sysconfig' module which is used by 'site',
         * so for now disable site. alternatively we could copy the file. */
-       Py_NoSiteFlag= 1;
+       Py_NoSiteFlag = 1;
 
        Py_Initialize();
 
@@ -230,8 +230,8 @@ void BPY_python_start(int argc, const char **argv)
        /* sigh, why do python guys not have a char** version anymore? :( */
        {
                int i;
-               PyObject *py_argv= PyList_New(argc);
-               for (i=0; i<argc; i++) {
+               PyObject *py_argv = PyList_New(argc);
+               for (i = 0; i < argc; i++) {
                        /* should fix bug #20021 - utf path name problems, by replacing
                         * PyUnicode_FromString, with this one */
                        PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i]));
@@ -263,7 +263,7 @@ void BPY_python_start(int argc, const char **argv)
        BPY_atexit_register(); /* this can init any time */
 
 #ifndef WITH_PYTHON_MODULE
-       py_tstate= PyGILState_GetThisThreadState();
+       py_tstate = PyGILState_GetThisThreadState();
        PyEval_ReleaseThread(py_tstate);
 #endif
 }
@@ -287,16 +287,16 @@ void BPY_python_end(void)
        
 #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);
        printf("tot run: %.4fsec,  ", bpy_timer_run_tot);
-       if (bpy_timer_count>0)
+       if (bpy_timer_count > 0)
                printf("average run: %.6fsec,  ", (bpy_timer_run_tot/bpy_timer_count));
 
-       if (bpy_timer>0.0)
-               printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer)*100.0);
+       if (bpy_timer > 0.0)
+               printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer) * 100.0);
 
        printf("\n");
 
@@ -310,7 +310,7 @@ static void python_script_error_jump_text(struct Text *text)
 {
        int lineno;
        int offset;
-       python_script_error_jump(text->id.name+2, &lineno, &offset);
+       python_script_error_jump(text->id.name + 2, &lineno, &offset);
        if (lineno != -1) {
                /* select the line with the error */
                txt_move_to(text, lineno - 1, INT_MAX, FALSE);
@@ -334,13 +334,13 @@ typedef struct {
 static int python_script_exec(bContext *C, const char *fn, struct Text *text,
                               struct ReportList *reports, const short do_jump)
 {
-       PyObject *main_mod= NULL;
-       PyObject *py_dict= NULL, *py_result= NULL;
+       PyObject *main_mod = NULL;
+       PyObject *py_dict = NULL, *py_result = NULL;
        PyGILState_STATE gilstate;
 
        BLI_assert(fn || text);
 
-       if (fn==NULL && text==NULL) {
+       if (fn == NULL && text == NULL) {
                return 0;
        }
 
@@ -353,9 +353,9 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
                bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
 
                if (text->compiled == NULL) {   /* if it wasn't already compiled, do it now */
-                       char *buf= txt_to_buf(text);
+                       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);
 
@@ -368,16 +368,16 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
                }
 
                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);
                }
 
        }
        else {
-               FILE *fp= fopen(fn, "r");
+               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
@@ -390,14 +390,14 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
 
                                fclose(fp);
 
-                               pystring= MEM_mallocN(strlen(fn) + 32, "pystring");
-                               pystring[0]= '\0';
+                               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
                }
@@ -405,7 +405,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
                        PyErr_Format(PyExc_IOError,
                                     "Python file \"%s\" could not be opened: %s",
                                     fn, strerror(errno));
-                       py_result= NULL;
+                       py_result = NULL;
                }
        }
 
@@ -423,11 +423,11 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
 
        if (py_dict) {
 #ifdef PYMODULE_CLEAR_WORKAROUND
-               PyModuleObject *mmod= (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
-               PyObject *dict_back= mmod->md_dict;
+               PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
+               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;
+               mmod->md_dict = NULL;
                Py_DECREF(dict_back);
 #endif
 
@@ -455,7 +455,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);
 }
@@ -465,13 +465,13 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
 {
        PyGILState_STATE gilstate;
        PyObject *py_dict, *mod, *retval;
-       int error_ret= 0;
-       PyObject *main_mod= NULL;
+       int error_ret = 0;
+       PyObject *main_mod = NULL;
        
        if (!value || !expr) return -1;
 
-       if (expr[0]=='\0') {
-               *value= 0.0;
+       if (expr[0] == '\0') {
+               *value = 0.0;
                return error_ret;
        }
 
@@ -479,9 +479,9 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
 
        PyC_MainModule_Backup(&main_mod);
 
-       py_dict= PyC_DefaultNameSpace("<blender button>");
+       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);
@@ -491,10 +491,10 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
                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;
+               error_ret = -1;
        }
        else {
                double val;
@@ -503,25 +503,25 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
                        /* Users my have typed in 10km, 2m
                         * add up all values */
                        int i;
-                       val= 0.0;
+                       val = 0.0;
 
-                       for (i=0; i<PyTuple_GET_SIZE(retval); i++) {
-                               val+= PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i));
+                       for (i = 0; i < PyTuple_GET_SIZE(retval); i++) {
+                               val += PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i));
                        }
                }
                else {
-                       val= PyFloat_AsDouble(retval);
+                       val = PyFloat_AsDouble(retval);
                }
                Py_DECREF(retval);
                
-               if (val==-1 && PyErr_Occurred()) {
-                       error_ret= -1;
+               if (val == -1 && PyErr_Occurred()) {
+                       error_ret = -1;
                }
                else if (!finite(val)) {
-                       *value= 0.0;
+                       *value = 0.0;
                }
                else {
-                       *value= val;
+                       *value = val;
                }
        }
        
@@ -544,14 +544,14 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
 int BPY_string_exec(bContext *C, const char *expr)
 {
        PyGILState_STATE gilstate;
-       PyObject *main_mod= NULL;
+       PyObject *main_mod = NULL;
        PyObject *py_dict, *retval;
-       int error_ret= 0;
+       int error_ret = 0;
        Main *bmain_back; /* XXX, quick fix for release (Copy Settings crash), needs further investigation */
 
        if (!expr) return -1;
 
-       if (expr[0]=='\0') {
+       if (expr[0] == '\0') {
                return error_ret;
        }
 
@@ -559,17 +559,17 @@ int BPY_string_exec(bContext *C, const char *expr)
 
        PyC_MainModule_Backup(&main_mod);
 
-       py_dict= PyC_DefaultNameSpace("<blender string>");
+       py_dict = PyC_DefaultNameSpace("<blender string>");
 
-       bmain_back= bpy_import_main_get();
+       bmain_back = bpy_import_main_get();
        bpy_import_main_set(CTX_data_main(C));
 
-       retval= PyRun_String(expr, Py_eval_input, py_dict, py_dict);
+       retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
 
        bpy_import_main_set(bmain_back);
 
        if (retval == NULL) {
-               error_ret= -1;
+               error_ret = -1;
 
                BPy_errors_to_report(CTX_wm_reports(C));
        }
@@ -588,11 +588,11 @@ int BPY_string_exec(bContext *C, const char *expr)
 void BPY_modules_load_user(bContext *C)
 {
        PyGILState_STATE gilstate;
-       Main *bmain= CTX_data_main(C);
+       Main *bmain = CTX_data_main(C);
        Text *text;
 
        /* can happen on file load */
-       if (bmain==NULL)
+       if (bmain == NULL)
                return;
 
        /* update pointers since this can run from a nested script
@@ -603,15 +603,15 @@ void BPY_modules_load_user(bContext *C)
 
        bpy_context_set(C, &gilstate);
 
-       for (text=CTX_data_main(C)->text.first; text; text= text->id.next) {
-               if (text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name+2, ".py")) {
+       for (text = CTX_data_main(C)->text.first; text; text = text->id.next) {
+               if (text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name + 2, ".py")) {
                        if (!(G.f & G_SCRIPT_AUTOEXEC)) {
-                               printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name+2);
+                               printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name + 2);
                        }
                        else {
-                               PyObject *module= bpy_text_import(text);
+                               PyObject *module = bpy_text_import(text);
 
-                               if (module==NULL) {
+                               if (module == NULL) {
                                        PyErr_Print();
                                        PyErr_Clear();
                                }
@@ -626,43 +626,43 @@ void BPY_modules_load_user(bContext *C)
 
 int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result)
 {
-       PyObject *pyctx= (PyObject *)CTX_py_dict_get(C);
-       PyObject *item= PyDict_GetItemString(pyctx, member);
-       PointerRNA *ptr= NULL;
-       int done= 0;
+       PyObject *pyctx = (PyObject *)CTX_py_dict_get(C);
+       PyObject *item = PyDict_GetItemString(pyctx, member);
+       PointerRNA *ptr = NULL;
+       int done = 0;
 
-       if (item==NULL) {
+       if (item == NULL) {
                /* pass */
        }
-       else if (item==Py_None) {
+       else if (item == Py_None) {
                /* pass */
        }
        else if (BPy_StructRNA_Check(item)) {
-               ptr= &(((BPy_StructRNA *)item)->ptr);
+               ptr = &(((BPy_StructRNA *)item)->ptr);
 
-               //result->ptr= ((BPy_StructRNA *)item)->ptr;
+               //result->ptr = ((BPy_StructRNA *)item)->ptr;
                CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
-               done= 1;
+               done = 1;
        }
        else if (PySequence_Check(item)) {
-               PyObject *seq_fast= PySequence_Fast(item, "bpy_context_get sequence conversion");
-               if (seq_fast==NULL) {
+               PyObject *seq_fast = PySequence_Fast(item, "bpy_context_get sequence conversion");
+               if (seq_fast == NULL) {
                        PyErr_Print();
                        PyErr_Clear();
                }
                else {
-                       int len= PySequence_Fast_GET_SIZE(seq_fast);
+                       int len = PySequence_Fast_GET_SIZE(seq_fast);
                        int i;
-                       for (i= 0; i < len; i++) {
-                               PyObject *list_item= PySequence_Fast_GET_ITEM(seq_fast, i);
+                       for (i = 0; i < len; i++) {
+                               PyObject *list_item = PySequence_Fast_GET_ITEM(seq_fast, i);
 
                                if (BPy_StructRNA_Check(list_item)) {
                                        /*
-                                       CollectionPointerLink *link= MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
-                                       link->ptr= ((BPy_StructRNA *)item)->ptr;
+                                       CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
+                                       link->ptr = ((BPy_StructRNA *)item)->ptr;
                                        BLI_addtail(&result->list, link);
                                        */
-                                       ptr= &(((BPy_StructRNA *)list_item)->ptr);
+                                       ptr = &(((BPy_StructRNA *)list_item)->ptr);
                                        CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data);
                                }
                                else {
@@ -672,11 +672,11 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
                        }
                        Py_DECREF(seq_fast);
 
-                       done= 1;
+                       done = 1;
                }
        }
 
-       if (done==0) {
+       if (done == 0) {
                if (item)       printf("PyContext '%s' not a valid type\n", member);
                else            printf("PyContext '%s' not found\n", member);
        }
@@ -697,7 +697,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
 static void bpy_module_free(void *mod);
 extern int main_python_enter(int argc, const char **argv);
 extern void main_python_exit(void);
-static struct PyModuleDef bpy_proxy_def= {
+static struct PyModuleDef bpy_proxy_def = {
        PyModuleDef_HEAD_INIT,
        "bpy",  /* m_name */
        NULL,  /* m_doc */
@@ -718,20 +718,20 @@ typedef struct {
 /* call once __file__ is set */
 void bpy_module_delay_init(PyObject *bpy_proxy)
 {
-       const int argc= 1;
+       const int argc = 1;
        const char *argv[2];
 
        /* updating the module dict below will loose the reference to __file__ */
-       PyObject *filename_obj= PyModule_GetFilenameObject(bpy_proxy);
+       PyObject *filename_obj = PyModule_GetFilenameObject(bpy_proxy);
 
-       const char *filename_rel= _PyUnicode_AsString(filename_obj); /* can be relative */
+       const char *filename_rel = _PyUnicode_AsString(filename_obj); /* can be relative */
        char filename_abs[1024];
 
        BLI_strncpy(filename_abs, filename_rel, sizeof(filename_abs));
        BLI_path_cwd(filename_abs);
 
-       argv[0]= filename_abs;
-       argv[1]= NULL;
+       argv[0] = filename_abs;
+       argv[1] = NULL;
        
        // printf("module found %s\n", argv[0]);
 
@@ -743,7 +743,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)
@@ -757,7 +757,7 @@ static void dealloc_obj_dealloc(PyObject *self)
 PyMODINIT_FUNC
 PyInit_bpy(void)
 {
-       PyObject *bpy_proxy= PyModule_Create(&bpy_proxy_def);
+       PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
        
        /* Problem:
         * 1) this init function is expected to have a private member defined - 'md_def'
@@ -777,16 +777,16 @@ 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;
 
-       dob= (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0);
-       dob->mod= bpy_proxy; /* borrow */
+       dob = (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0);
+       dob->mod = bpy_proxy; /* borrow */
        PyModule_AddObject(bpy_proxy, "__file__", (PyObject *)dob); /* borrow */
 
        return bpy_proxy;
index a0cf3c385030f35a8af24dc37971017afd8f7944..53775e7d8935cb9d51a292f477060fd494e33c2c 100644 (file)
 static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyObject *UNUSED(kw))
 {
        /* close down enough of blender at least not to crash */
-       struct bContext *C= BPy_GetContext();
+       struct bContext *C = BPy_GetContext();
 
        WM_exit_ext(C, 0);
 
        Py_RETURN_NONE;
 }
 
-static PyMethodDef meth_bpy_atexit= {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, NULL};
-static PyObject *func_bpy_atregister= NULL; /* borrowed referebce, atexit holds */
+static PyMethodDef meth_bpy_atexit = {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, NULL};
+static PyObject *func_bpy_atregister = NULL; /* borrowed referebce, atexit holds */
 
 static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
 {
@@ -56,15 +56,15 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
         * this is intended, but if its problematic it could be changed
         * - campbell */
 
-       PyObject *atexit_mod= PyImport_ImportModuleLevel((char *)"atexit", NULL, NULL, NULL, 0);
-       PyObject *atexit_func= PyObject_GetAttrString(atexit_mod, func_name);
-       PyObject *args= PyTuple_New(1);
+       PyObject *atexit_mod = PyImport_ImportModuleLevel((char *)"atexit", NULL, NULL, NULL, 0);
+       PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name);
+       PyObject *args = PyTuple_New(1);
        PyObject *ret;
 
        PyTuple_SET_ITEM(args, 0, atexit_func_arg);
        Py_INCREF(atexit_func_arg); /* only incref so we dont dec'ref along with 'args' */
 
-       ret= PyObject_CallObject(atexit_func, args);
+       ret = PyObject_CallObject(atexit_func, args);
 
        Py_DECREF(atexit_mod);
        Py_DECREF(atexit_func);
@@ -83,7 +83,7 @@ void BPY_atexit_register(void)
        /* atexit module owns this new function reference */
        BLI_assert(func_bpy_atregister == NULL);
 
-       func_bpy_atregister= (PyObject *)PyCFunction_New(&meth_bpy_atexit, NULL);
+       func_bpy_atregister = (PyObject *)PyCFunction_New(&meth_bpy_atexit, NULL);
        atexit_func_call("register", func_bpy_atregister);
 }
 
@@ -92,5 +92,5 @@ void BPY_atexit_unregister(void)
        BLI_assert(func_bpy_atregister != NULL);
 
        atexit_func_call("unregister", func_bpy_atregister);
-       func_bpy_atregister= NULL; /* don't really need to set but just incase */
+       func_bpy_atregister = NULL; /* don't really need to set but just incase */
 }
index 4f206c4c365533a593552b059c78054110a0c296..7c8291d62d30e23d231e3aba095d04675029fca4 100644 (file)
@@ -41,12 +41,12 @@ PyObject *bpy_intern_str___slots__;
 
 void bpy_intern_string_init(void)
 {
-       bpy_intern_str_register= PyUnicode_FromString("register");
-       bpy_intern_str_unregister= PyUnicode_FromString("unregister");
-       bpy_intern_str_bl_rna= PyUnicode_FromString("bl_rna");
-       bpy_intern_str_order= PyUnicode_FromString("order");
-       bpy_intern_str_attr= PyUnicode_FromString("attr");
-       bpy_intern_str___slots__= PyUnicode_FromString("__slots__");
+       bpy_intern_str_register = PyUnicode_FromString("register");
+       bpy_intern_str_unregister = PyUnicode_FromString("unregister");
+       bpy_intern_str_bl_rna = PyUnicode_FromString("bl_rna");
+       bpy_intern_str_order = PyUnicode_FromString("order");
+       bpy_intern_str_attr = PyUnicode_FromString("attr");
+       bpy_intern_str___slots__ = PyUnicode_FromString("__slots__");
 }
 
 void bpy_intern_string_exit(void)
index a6426a02e18418e6cedaae45b3cb497c44f03cde..ed3b758a6b4f5ea60d7e3eec56fc4ab45c4f95d2 100644 (file)
@@ -76,7 +76,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},
@@ -90,7 +90,7 @@ static void bpy_lib_dealloc(BPy_Library *self)
 }
 
 
-static PyTypeObject bpy_lib_Type= {
+static PyTypeObject bpy_lib_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        "bpy_lib",              /* tp_name */
        sizeof(BPy_Library),                    /* tp_basicsize */
@@ -184,25 +184,25 @@ PyDoc_STRVAR(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;
-       int is_rel= 0, is_link= 0;
+       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))
                return NULL;
 
-       ret= PyObject_New(BPy_Library, &bpy_lib_Type);
+       ret = PyObject_New(BPy_Library, &bpy_lib_Type);
 
        BLI_strncpy(ret->relpath, filename, sizeof(ret->relpath));
        BLI_strncpy(ret->abspath, filename, sizeof(ret->abspath));
        BLI_path_abs(ret->abspath, G.main->name);
 
-       ret->blo_handle= NULL;
+       ret->blo_handle = NULL;
        ret->flag=      (is_link ? FILE_LINK : 0) |
                                (is_rel ? FILE_RELPATH : 0);
 
-       ret->dict= PyDict_New();
+       ret->dict = PyDict_New();
 
        return (PyObject *)ret;
 }
@@ -213,19 +213,19 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype)
        LinkNode *l, *names;
        int totnames;
 
-       names= BLO_blendhandle_get_datablock_names(self->blo_handle, blocktype, &totnames);
+       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++;
                }
                BLI_linklist_free(names, free); /* free linklist *and* each node's data */
        }
        else {
-               list= PyList_New(0);
+               list = PyList_New(0);
        }
 
        return list;
@@ -235,12 +235,12 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
 {
        PyObject *ret;
        BPy_Library *self_from;
-       PyObject *from_dict= PyDict_New();
+       PyObject *from_dict = PyDict_New();
        ReportList reports;
 
        BKE_reports_init(&reports, RPT_STORE);
 
-       self->blo_handle= BLO_blendhandle_from_file(self->abspath, &reports);
+       self->blo_handle = BLO_blendhandle_from_file(self->abspath, &reports);
 
        if (self->blo_handle == NULL) {
                if (BPy_reports_to_error(&reports, PyExc_IOError, TRUE) != -1) {
@@ -251,11 +251,11 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
                return NULL;
        }
        else {
-               int i= 0, code;
-               while ((code= BKE_idcode_iter_step(&i))) {
+               int i = 0, code;
+               while ((code = BKE_idcode_iter_step(&i))) {
                        if (BKE_idcode_is_linkable(code)) {
-                               const char *name_plural= BKE_idcode_to_name_plural(code);
-                               PyObject *str= PyUnicode_FromString(name_plural);
+                               const char *name_plural = BKE_idcode_to_name_plural(code);
+                               PyObject *str = PyUnicode_FromString(name_plural);
                                PyDict_SetItem(self->dict, str, PyList_New(0));
                                PyDict_SetItem(from_dict, str, _bpy_names(self, code));
                                Py_DECREF(str);
@@ -264,16 +264,16 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
        }
 
        /* create a dummy */
-       self_from= PyObject_New(BPy_Library, &bpy_lib_Type);
+       self_from = PyObject_New(BPy_Library, &bpy_lib_Type);
        BLI_strncpy(self_from->relpath, self->relpath, sizeof(self_from->relpath));
        BLI_strncpy(self_from->abspath, self->abspath, sizeof(self_from->abspath));
 
-       self_from->blo_handle= NULL;
-       self_from->flag= 0;
-       self_from->dict= from_dict; /* owns the dict */
+       self_from->blo_handle = NULL;
+       self_from->flag = 0;
+       self_from->dict = from_dict; /* owns the dict */
 
        /* return pair */
-       ret= PyTuple_New(2);
+       ret = PyTuple_New(2);
 
        PyTuple_SET_ITEM(ret, 0, (PyObject *)self_from);
 
@@ -317,43 +317,43 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
 
 static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
 {
-       Main *bmain= CTX_data_main(BPy_GetContext());
-       Main *mainl= NULL;
-       int err= 0;
+       Main *bmain = CTX_data_main(BPy_GetContext());
+       Main *mainl = NULL;
+       int err = 0;
 
        flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
 
        /* here appending/linking starts */
-       mainl= BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath);
+       mainl = BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath);
 
        {
-               int i= 0, code;
-               while ((code= BKE_idcode_iter_step(&i))) {
+               int i = 0, code;
+               while ((code = BKE_idcode_iter_step(&i))) {
                        if (BKE_idcode_is_linkable(code)) {
-                               const char *name_plural= BKE_idcode_to_name_plural(code);
-                               PyObject *ls= PyDict_GetItemString(self->dict, name_plural);
+                               const char *name_plural = BKE_idcode_to_name_plural(code);
+                               PyObject *ls = PyDict_GetItemString(self->dict, name_plural);
                                // printf("lib: %s\n", name_plural);
                                if (ls && PyList_Check(ls)) {
                                        /* loop */
-                                       Py_ssize_t size= PyList_GET_SIZE(ls);
+                                       Py_ssize_t size = PyList_GET_SIZE(ls);
                                        Py_ssize_t i;
                                        PyObject *item;
                                        const char *item_str;
 
-                                       for (i= 0; i < size; i++) {
-                                               item= PyList_GET_ITEM(ls, i);
-                                               item_str= _PyUnicode_AsString(item);
+                                       for (i = 0; i < size; i++) {
+                                               item = PyList_GET_ITEM(ls, i);
+                                               item_str = _PyUnicode_AsString(item);
 
                                                // printf("  %s\n", item_str);
 
                                                if (item_str) {
-                                                       ID *id= BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code);
+                                                       ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code);
                                                        if (id) {
 #ifdef USE_RNA_DATABLOCKS
                                                                PointerRNA id_ptr;
                                                                RNA_id_pointer_create(id, &id_ptr);
                                                                Py_DECREF(item);
-                                                               item= pyrna_struct_CreatePyObject(&id_ptr);
+                                                               item = pyrna_struct_CreatePyObject(&id_ptr);
 #endif
                                                        }
                                                        else {
@@ -361,7 +361,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
                                                                /* just warn for now */
                                                                /* err = -1; */
 #ifdef USE_RNA_DATABLOCKS
-                                                               item= Py_None;
+                                                               item = Py_None;
                                                                Py_INCREF(item);
 #endif
                                                        }
@@ -374,7 +374,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
                                                        PyErr_Clear();
 
 #ifdef USE_RNA_DATABLOCKS
-                                                       item= Py_None;
+                                                       item = Py_None;
                                                        Py_INCREF(item);
 #endif
                                                }
@@ -391,22 +391,22 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
        if (err == -1) {
                /* exception raised above, XXX, this leaks some memory */
                BLO_blendhandle_close(self->blo_handle);
-               self->blo_handle= NULL;
+               self->blo_handle = NULL;
                flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
                return NULL;
        }
        else {
-               Library *lib= mainl->curlib; /* newly added lib, assign before append end */
+               Library *lib = mainl->curlib; /* newly added lib, assign before append end */
                BLO_library_append_end(NULL, mainl, &(self->blo_handle), 0, self->flag);
                BLO_blendhandle_close(self->blo_handle);
-               self->blo_handle= NULL;
+               self->blo_handle = NULL;
 
                {       /* copied from wm_operator.c */
                        /* mark all library linked objects to be updated */
                        recalc_all_library_objects(G.main);
 
                        /* append, rather than linking */
-                       if ((self->flag & FILE_LINK)==0) {
+                       if ((self->flag & FILE_LINK) == 0) {
                                BKE_library_make_local(bmain, lib, 1);
                        }
                }
@@ -425,14 +425,14 @@ static PyObject *bpy_lib_dir(BPy_Library *self)
 
 int bpy_lib_init(PyObject *mod_par)
 {
-       static PyMethodDef load_meth= {"load", (PyCFunction)bpy_lib_load,
+       static PyMethodDef load_meth = {"load", (PyCFunction)bpy_lib_load,
                                       METH_STATIC|METH_VARARGS|METH_KEYWORDS,
                                       bpy_lib_load_doc};
 
        PyModule_AddObject(mod_par, "_library_load", PyCFunction_New(&load_meth, NULL));
 
        /* some compilers dont like accessing this directly, delay assignment */
-       bpy_lib_Type.tp_getattro= PyObject_GenericGetAttr;
+       bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr;
 
        if (PyType_Ready(&bpy_lib_Type) < 0)
                return -1;
index 70346a65bf9e3b4f47b1a9a9f62618afa0e6a28c..6a6e6595ed4f9a0d7da4f53813e1701363b0b681 100644 (file)
@@ -66,18 +66,18 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
 {
        wmOperatorType *ot;
        char            *opname;
-       PyObject        *context_dict= NULL; /* optional args */
+       PyObject        *context_dict = NULL; /* optional args */
        PyObject        *context_dict_back;
-       char            *context_str= NULL;
+       char            *context_str = NULL;
        PyObject        *ret;
 
-       int context= WM_OP_EXEC_DEFAULT;
+       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) {
+       if (C == NULL) {
                PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
                return NULL;
        }
@@ -85,7 +85,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
        if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
                return NULL;
        
-       ot= WM_operatortype_find(opname, TRUE);
+       ot = WM_operatortype_find(opname, TRUE);
 
        if (ot == NULL) {
                PyErr_Format(PyExc_AttributeError,
@@ -95,8 +95,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
        }
 
        if (context_str) {
-               if (RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) {
-                       char *enum_str= BPy_enum_as_string(operator_context_items);
+               if (RNA_enum_value_from_id(operator_context_items, context_str, &context) == 0) {
+                       char *enum_str = BPy_enum_as_string(operator_context_items);
                        PyErr_Format(PyExc_TypeError,
                                     "Calling operator \"bpy.ops.%s.poll\" error, "
                                     "expected a string enum in (%.200s)",
@@ -106,8 +106,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
                }
        }
        
-       if (context_dict==NULL || context_dict==Py_None) {
-               context_dict= NULL;
+       if (context_dict == NULL || context_dict == Py_None) {
+               context_dict = NULL;
        }
        else if (!PyDict_Check(context_dict)) {
                PyErr_Format(PyExc_TypeError,
@@ -117,12 +117,12 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
                return NULL;
        }
 
-       context_dict_back= CTX_py_dict_get(C);
+       context_dict_back = CTX_py_dict_get(C);
        CTX_py_dict_set(C, (void *)context_dict);
        Py_XINCREF(context_dict); /* so we done loose it */
        
        /* main purpose of thsi function */
-       ret= WM_operator_poll_context((bContext*)C, ot, context) ? Py_True : Py_False;
+       ret = WM_operator_poll_context((bContext *)C, ot, context) ? Py_True : Py_False;
        
        /* restore with original context dict, probably NULL but need this for nested operator calls */
        Py_XDECREF(context_dict);
@@ -135,24 +135,24 @@ 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;
+       int operator_ret = OPERATOR_CANCELLED;
 
        char            *opname;
-       char            *context_str= NULL;
-       PyObject        *kw= NULL; /* optional args */
-       PyObject        *context_dict= NULL; /* optional args */
+       char            *context_str = NULL;
+       PyObject        *kw = NULL; /* optional args */
+       PyObject        *context_dict = NULL; /* optional args */
        PyObject        *context_dict_back;
 
        /* note that context is an int, python does the conversion in this case */
-       int context= WM_OP_EXEC_DEFAULT;
+       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) {
+       if (C == NULL) {
                PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
                return NULL;
        }
@@ -160,7 +160,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
        if (!PyArg_ParseTuple(args, "sO|O!s:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context_str))
                return NULL;
 
-       ot= WM_operatortype_find(opname, TRUE);
+       ot = WM_operatortype_find(opname, TRUE);
 
        if (ot == NULL) {
                PyErr_Format(PyExc_AttributeError,
@@ -178,8 +178,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
        }
 
        if (context_str) {
-               if (RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) {
-                       char *enum_str= BPy_enum_as_string(operator_context_items);
+               if (RNA_enum_value_from_id(operator_context_items, context_str, &context) == 0) {
+                       char *enum_str = BPy_enum_as_string(operator_context_items);
                        PyErr_Format(PyExc_TypeError,
                                     "Calling operator \"bpy.ops.%s\" error, "
                                     "expected a string enum in (%.200s)",
@@ -189,8 +189,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
                }
        }
 
-       if (context_dict==NULL || context_dict==Py_None) {
-               context_dict= NULL;
+       if (context_dict == NULL || context_dict == Py_None) {
+               context_dict = NULL;
        }
        else if (!PyDict_Check(context_dict)) {
                PyErr_Format(PyExc_TypeError,
@@ -200,31 +200,31 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
                return NULL;
        }
 
-       context_dict_back= CTX_py_dict_get(C);
+       context_dict_back = CTX_py_dict_get(C);
 
        CTX_py_dict_set(C, (void *)context_dict);
        Py_XINCREF(context_dict); /* so we done loose it */
 
-       if (WM_operator_poll_context((bContext*)C, ot, context) == FALSE) {
-               const char *msg= CTX_wm_operator_poll_msg_get(C);
+       if (WM_operator_poll_context((bContext *)C, ot, context) == FALSE) {
+               const char *msg = CTX_wm_operator_poll_msg_get(C);
                PyErr_Format(PyExc_RuntimeError,
                             "Operator bpy.ops.%.200s.poll() %.200s",
                             opname, msg ? msg : "failed, context is incorrect");
                CTX_wm_operator_poll_msg_set(C, NULL); /* better set to NULL else it could be used again */
-               error_val= -1;
+               error_val = -1;
        }
        else {
                WM_operator_properties_create_ptr(&ptr, ot);
                WM_operator_properties_sanitize(&ptr, 0);
 
                if (kw && PyDict_Size(kw))
-                       error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
+                       error_val = pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
 
 
-               if (error_val==0) {
+               if (error_val == 0) {
                        ReportList *reports;
 
-                       reports= MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
+                       reports = MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
                        BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these dont move into global reports */
 
 #ifdef BPY_RELEASE_GIL
@@ -233,10 +233,10 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
                        /* note: I havve not seen any examples of code that does this
                         * so it may not be officially supported but seems to work ok. */
                        {
-                               PyThreadState *ts= PyEval_SaveThread();
+                               PyThreadState *ts = PyEval_SaveThread();
 #endif
 
-                               operator_ret= WM_operator_call_py(C, ot, context, &ptr, reports);
+                               operator_ret = WM_operator_call_py(C, ot, context, &ptr, reports);
 
 #ifdef BPY_RELEASE_GIL
                                /* regain GIL */
@@ -244,11 +244,11 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
                        }
 #endif
 
-                       error_val= BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
+                       error_val = BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
 
                        /* operator output is nice to have in the terminal/console too */
                        if (reports->list.first) {
-                               char *report_str= BKE_reports_string(reports, 0); /* all reports */
+                               char *report_str = BKE_reports_string(reports, 0); /* all reports */
        
                                if (report_str) {
                                        PySys_WriteStdout("%s\n", report_str);
@@ -285,7 +285,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
        Py_XDECREF(context_dict);
        CTX_py_dict_set(C, (void *)context_dict_back);
 
-       if (error_val==-1) {
+       if (error_val == -1) {
                return NULL;
        }
 
@@ -308,16 +308,16 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
        PointerRNA ptr;
 
        char            *opname;
-       PyObject        *kw= NULL; /* optional args */
-       int all_args= 1;
-       int error_val= 0;
+       PyObject        *kw = NULL; /* optional args */
+       int all_args = 1;
+       int error_val = 0;
 
-       char *buf= NULL;
+       char *buf = NULL;
        PyObject *pybuf;
 
-       bContext *C= (bContext *)BPy_GetContext();
+       bContext *C = (bContext *)BPy_GetContext();
 
-       if (C==NULL) {
+       if (C == NULL) {
                PyErr_SetString(PyExc_RuntimeError, "Context is None, cant get the string representation of this object.");
                return NULL;
        }
@@ -325,7 +325,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
        if (!PyArg_ParseTuple(args, "s|O!i:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args))
                return NULL;
 
-       ot= WM_operatortype_find(opname, TRUE);
+       ot = WM_operatortype_find(opname, TRUE);
 
        if (ot == NULL) {
                PyErr_Format(PyExc_AttributeError,
@@ -339,23 +339,23 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
        RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
 
        if (kw && PyDict_Size(kw))
-               error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
+               error_val = pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
 
-       if (error_val==0)
-               buf= WM_operator_pystring(C, ot, &ptr, all_args);
+       if (error_val == 0)
+               buf = WM_operator_pystring(C, ot, &ptr, all_args);
 
        WM_operator_properties_free(&ptr);
 
-       if (error_val==-1) {
+       if (error_val == -1) {
                return NULL;
        }
 
        if (buf) {
-               pybuf= PyUnicode_FromString(buf);
+               pybuf = PyUnicode_FromString(buf);
                MEM_freeN(buf);
        }
        else {
-               pybuf= PyUnicode_FromString("");
+               pybuf = PyUnicode_FromString("");
        }
 
        return pybuf;
@@ -363,13 +363,13 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
 
 static PyObject *pyop_dir(PyObject *UNUSED(self))
 {
-       GHashIterator *iter= WM_operatortype_iter();
-       PyObject *list= PyList_New(0), *name;
+       GHashIterator *iter = WM_operatortype_iter();
+       PyObject *list = PyList_New(0), *name;
 
        for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
-               wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
+               wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
 
-               name= PyUnicode_FromString(ot->idname);
+               name = PyUnicode_FromString(ot->idname);
                PyList_Append(list, name);
                Py_DECREF(name);
        }
@@ -382,15 +382,15 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
 {
        wmOperatorType *ot;
        PointerRNA ptr;
-       const char *opname= _PyUnicode_AsString(value);
-       BPy_StructRNA *pyrna= NULL;
+       const char *opname = _PyUnicode_AsString(value);
+       BPy_StructRNA *pyrna = NULL;
        
-       if (opname==NULL) {
+       if (opname == NULL) {
                PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
                return NULL;
        }
-       ot= WM_operatortype_find(opname, TRUE);
-       if (ot==NULL) {
+       ot = WM_operatortype_find(opname, TRUE);
+       if (ot  == NULL) {
                PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
                return NULL;
        }
@@ -403,9 +403,9 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
        WM_operator_properties_sanitize(&ptr, 0);
 
        
-       pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+       pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
 #ifdef PYRNA_FREE_SUPPORT
-       pyrna->freeptr= TRUE;
+       pyrna->freeptr = TRUE;
 #endif
        return (PyObject *)pyrna;
 }
@@ -415,40 +415,40 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
        wmOperatorType *ot;
        wmOperator *op;
        PointerRNA ptr;
-       const char *opname= _PyUnicode_AsString(value);
-       BPy_StructRNA *pyrna= NULL;
+       const char *opname = _PyUnicode_AsString(value);
+       BPy_StructRNA *pyrna = NULL;
 
-       if (opname==NULL) {
+       if (opname == NULL) {
                PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument");
                return NULL;
        }
-       ot= WM_operatortype_find(opname, TRUE);
-       if (ot==NULL) {
+       ot = WM_operatortype_find(opname, TRUE);
+       if (ot == NULL) {
                PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname);
                return NULL;
        }
 
 #ifdef PYRNA_FREE_SUPPORT
-       op= MEM_callocN(sizeof(wmOperator), __func__);
+       op = MEM_callocN(sizeof(wmOperator), __func__);
 #else
-       op= PyMem_MALLOC(sizeof(wmOperator));
+       op = PyMem_MALLOC(sizeof(wmOperator));
        memset(op, 0, sizeof(wmOperator));
 #endif
        BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* incase its needed */
-       op->type= ot;
+       op->type = ot;
 
        RNA_pointer_create(NULL, &RNA_Operator, op, &ptr);
 
-       pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+       pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
 #ifdef PYRNA_FREE_SUPPORT
-       pyrna->freeptr= TRUE;
+       pyrna->freeptr = TRUE;
 #endif
-       op->ptr= &pyrna->ptr;
+       op->ptr = &pyrna->ptr;
 
        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},
@@ -459,7 +459,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,
@@ -472,7 +472,7 @@ PyObject *BPY_operator_module(void)
 {
        PyObject *submodule;
 
-       submodule= PyModule_Create(&bpy_ops_module);
+       submodule = PyModule_Create(&bpy_ops_module);
 
        return submodule;
 }
index aa45892520220735c8149600f386e091c588c49a..7860762059ce07c121dd1ad96c2d2fea2c664dab 100644 (file)
@@ -45,7 +45,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
@@ -63,9 +63,9 @@ 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;
-       *ot= *((wmOperatorType *)userdata);
-       ot->srna= srna; /* restore */
+       StructRNA *srna = ot->srna;
+       *ot = *((wmOperatorType *)userdata);
+       ot->srna = srna; /* restore */
 
        operator_properties_init(ot);
 
@@ -74,25 +74,25 @@ 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;
+                       ot->prop = prop;
                }
        }
 }
 
 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);
 }
@@ -117,17 +117,17 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
        }
 
        /* identifiers */
-       srna= srna_from_self(macro, "Macro Define:");
-       macroname= RNA_struct_identifier(srna);
+       srna = srna_from_self(macro, "Macro Define:");
+       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_OperatorMacro, otmacro, &ptr_otmacro);
 
index d140801508953a2b93c5118f5fd575dae66689be..9984e7f2fe0e2479db5a62f873eee6ffad72ae4a 100644 (file)
 
 extern BPy_StructRNA *bpy_context_module;
 
-static EnumPropertyItem property_flag_items[]= {
+static EnumPropertyItem property_flag_items[] = {
        {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
        {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
        {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_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
        {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
@@ -70,7 +70,7 @@ static EnumPropertyItem property_flag_enum_items[]= {
        {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", ""},
@@ -80,7 +80,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", ""},
@@ -91,7 +91,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", ""},
@@ -109,29 +109,29 @@ 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;
 
 static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
 {
-       PyObject *self= NULL;
+       PyObject *self = NULL;
        /* first get self */
        /* operators can store their own instance for later use */
        if (ptr->data) {
-               void **instance= RNA_struct_instance(ptr);
+               void **instance = RNA_struct_instance(ptr);
 
                if (instance) {
                        if (*instance) {
-                               self= *instance;
+                               self = *instance;
                                Py_INCREF(self);
                        }
                }
@@ -139,7 +139,7 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
 
        /* in most cases this will run */
        if (self == NULL) {
-               self= pyrna_struct_CreatePyObject(ptr);
+               self = pyrna_struct_CreatePyObject(ptr);
        }
 
        return self;
@@ -149,7 +149,7 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
 static void printf_func_error(PyObject *py_func)
 {
        /* since we return to C code we can't leave the error */
-       PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func);
+       PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(py_func);
        PyErr_Print();
        PyErr_Clear();
 
@@ -166,12 +166,12 @@ static void printf_func_error(PyObject *py_func)
  * 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);
 
-       if (kw==NULL)
-               kw= PyDict_New();
+       if (kw == NULL)
+               kw = PyDict_New();
        else
                Py_INCREF(kw);
 
@@ -184,12 +184,12 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
 static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop)
 {
        PyGILState_STATE gilstate;
-       PyObject **py_data= (PyObject **)RNA_property_py_data_get(prop);
+       PyObject **py_data = (PyObject **)RNA_property_py_data_get(prop);
        PyObject *py_func;
        PyObject *args;
        PyObject *self;
        PyObject *ret;
-       const int is_write_ok= pyrna_write_check();
+       const int is_write_ok = pyrna_write_check();
 
        BLI_assert(py_data != NULL);
 
@@ -199,16 +199,16 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
 
        bpy_context_set(C, &gilstate);
 
-       py_func= py_data[BPY_DATA_CB_SLOT_UPDATE];
+       py_func = py_data[BPY_DATA_CB_SLOT_UPDATE];
 
-       args= PyTuple_New(2);
-       self= pyrna_struct_as_instance(ptr);
+       args = PyTuple_New(2);
+       self = pyrna_struct_as_instance(ptr);
        PyTuple_SET_ITEM(args, 0, self);
 
        PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module);
        Py_INCREF(bpy_context_module);
 
-       ret= PyObject_CallObject(py_func, args);
+       ret = PyObject_CallObject(py_func, args);
 
        Py_DECREF(args);
 
@@ -241,7 +241,7 @@ static int bpy_prop_callback_check(PyObject *py_func, int argcount)
                        return -1;
                }
                else {
-                       PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func);
+                       PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(py_func);
                        if (f_code->co_argcount != argcount) {
                                PyErr_Format(PyExc_TypeError,
                                             "update keyword: expected a function taking %d arguments, not %d",
@@ -259,9 +259,9 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c
 {
        /* assume this is already checked for type and arg length */
        if (update_cb) {
-               PyObject **py_data= MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, __func__);
+               PyObject **py_data = MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, __func__);
                RNA_def_property_update_runtime(prop, (void *)bpy_prop_update_cb);
-               py_data[BPY_DATA_CB_SLOT_UPDATE]= update_cb;
+               py_data[BPY_DATA_CB_SLOT_UPDATE] = update_cb;
                RNA_def_py_data(prop, py_data);
 
                RNA_def_property_flag(prop, PROP_CONTEXT_PROPERTY_UPDATE);
@@ -274,7 +274,7 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c
 static int py_long_as_int(PyObject *py_long, int *r_int)
 {
        if (PyLong_CheckExact(py_long)) {
-               *r_int= (int)PyLong_AS_LONG(py_long);
+               *r_int = (int)PyLong_AS_LONG(py_long);
                return 0;
        }
        else {
@@ -287,9 +287,9 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
 #define BPY_PROPDEF_HEAD(_func)                                               \
        if (PyTuple_GET_SIZE(args) == 1) {                                        \
                PyObject *ret;                                                        \
-               self= PyTuple_GET_ITEM(args, 0);                                      \
-               args= PyTuple_New(0);                                                 \
-               ret= BPy_##_func(self, args, kw);                                     \
+               self = PyTuple_GET_ITEM(args, 0);                                     \
+               args = PyTuple_New(0);                                                \
+               ret = BPy_##_func(self, args, kw);                                    \
                Py_DECREF(args);                                                      \
                return ret;                                                           \
        }                                                                         \
@@ -297,8 +297,8 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
                PyErr_SetString(PyExc_ValueError, "all args must be keywords");       \
                return NULL;                                                          \
        }                                                                         \
-       srna= srna_from_self(self, #_func"(...):");                               \
-       if (srna==NULL) {                                                         \
+       srna = srna_from_self(self, #_func"(...):");                              \
+       if (srna == NULL) {                                                       \
                if (PyErr_Occurred())                                                 \
                        return NULL;                                                      \
                return bpy_prop_deferred_return(pymeth_##_func, kw);                  \
@@ -310,7 +310,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
        if (id_len >= MAX_IDPROP_NAME) {                                          \
                PyErr_Format(PyExc_TypeError,                                         \
                             #_func"(): '%.200s' too long, max length is %d",         \
-                            id, MAX_IDPROP_NAME-1);                                  \
+                            id, MAX_IDPROP_NAME - 1);                                \
                return NULL;                                                          \
        }                                                                         \
        if (RNA_def_property_free_identifier(srna, id) == -1) {                   \
@@ -322,7 +322,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
        if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items,            \
                                                 pyopts,                          \
                                                 &opts,                           \
-                                                #_func"(options={...}):"))       \
+                                                #_func"(options={ ...}):"))      \
        {                                                                         \
                return NULL;                                                          \
        }                                                                         \
@@ -331,7 +331,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
        BPY_PROPDEF_CHECK(_func, _property_flag_items)                            \
        if (pysubtype && RNA_enum_value_from_id(_subtype,                         \
                                                pysubtype,                        \
-                                               &subtype)==0)                     \
+                                               &subtype) == 0)                   \
        {                                                                         \
                PyErr_Format(PyExc_TypeError,                                         \
                             #_func"(subtype='%s'): invalid subtype",                 \
@@ -393,17 +393,17 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
        BPY_PROPDEF_HEAD(BoolProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "options", "subtype", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               const char *id = NULL, *name = "", *description = "";
                int id_len;
-               int def=0;
+               int def = 0;
                PropertyRNA *prop;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|ssiO!sO:BoolProperty",
@@ -421,13 +421,13 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
                        return NULL;
                }
 
-               prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
+               prop = RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
                RNA_def_property_boolean_default(prop, def);
                RNA_def_property_ui_text(prop, name, description);
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -461,19 +461,19 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
        BPY_PROPDEF_HEAD(BoolVectorProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "options", "subtype", "size", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               const char *id = NULL, *name = "", *description = "";
                int id_len;
-               int def[PYRNA_STACK_ARRAY]={0};
-               int size=3;
+               int def[PYRNA_STACK_ARRAY] = {0};
+               int size = 3;
                PropertyRNA *prop;
-               PyObject *pydef= NULL;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pydef = NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|ssOO!siO:BoolVectorProperty",
@@ -501,15 +501,15 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
                        return NULL;
                }
 
-               // prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
-               prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
+               // prop = RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
+               prop = RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
                RNA_def_property_array(prop, size);
                if (pydef) RNA_def_property_boolean_array_default(prop, def);
                RNA_def_property_ui_text(prop, name, description);
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -539,17 +539,17 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
        BPY_PROPDEF_HEAD(IntProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               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;
+               int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1, def = 0;
                PropertyRNA *prop;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|ssiiiiiiO!sO:IntProperty",
@@ -568,7 +568,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
                        return NULL;
                }
 
-               prop= RNA_def_property(srna, id, PROP_INT, subtype);
+               prop = RNA_def_property(srna, id, PROP_INT, subtype);
                RNA_def_property_int_default(prop, def);
                RNA_def_property_range(prop, min, max);
                RNA_def_property_ui_text(prop, name, description);
@@ -576,7 +576,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -609,20 +609,21 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
        BPY_PROPDEF_HEAD(IntVectorProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "min", "max", "soft_min", "soft_max",
                                              "step", "options", "subtype", "size", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               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};
-               int size=3;
+               int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1;
+               int def[PYRNA_STACK_ARRAY] = {0};
+               int size = 3;
                PropertyRNA *prop;
-               PyObject *pydef= NULL;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pydef = NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|ssOiiiiiO!siO:IntVectorProperty",
@@ -652,7 +653,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
                        return NULL;
                }
 
-               prop= RNA_def_property(srna, id, PROP_INT, subtype);
+               prop = RNA_def_property(srna, id, PROP_INT, subtype);
                RNA_def_property_array(prop, size);
                if (pydef) RNA_def_property_int_array_default(prop, def);
                RNA_def_property_range(prop, min, max);
@@ -661,7 +662,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -692,21 +693,21 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
        BPY_PROPDEF_HEAD(FloatProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "min", "max", "soft_min", "soft_max",
                                              "step", "precision", "options", "subtype", "unit", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               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;
-               int precision= 2;
+               float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def = 0.0f;
+               int precision = 2;
                PropertyRNA *prop;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               char *pyunit= NULL;
-               int unit= PROP_UNIT_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               char *pyunit = NULL;
+               int unit = PROP_UNIT_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|ssffffffiO!ssO:FloatProperty",
@@ -722,7 +723,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
 
                BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, property_flag_items, property_subtype_number_items)
 
-               if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) {
+               if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit) == 0) {
                        PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit", pyunit);
                        return NULL;
                }
@@ -731,7 +732,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
                        return NULL;
                }
 
-               prop= RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
+               prop = RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
                RNA_def_property_float_default(prop, def);
                RNA_def_property_range(prop, min, max);
                RNA_def_property_ui_text(prop, name, description);
@@ -739,7 +740,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -773,22 +774,22 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
        BPY_PROPDEF_HEAD(FloatVectorProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "min", "max", "soft_min", "soft_max",
                                              "step", "precision", "options", "subtype", "unit", "size", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               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};
-               int precision= 2, size=3;
+               float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def[PYRNA_STACK_ARRAY] = {0.0f};
+               int precision = 2, size = 3;
                PropertyRNA *prop;
-               PyObject *pydef= NULL;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               char *pyunit= NULL;
-               int unit= PROP_UNIT_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pydef = NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               char *pyunit = NULL;
+               int unit = PROP_UNIT_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|ssOfffffiO!ssiO:FloatVectorProperty",
@@ -804,7 +805,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
 
                BPY_PROPDEF_SUBTYPE_CHECK(FloatVectorProperty, property_flag_items, property_subtype_array_items)
 
-               if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) {
+               if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit) == 0) {
                        PyErr_Format(PyExc_TypeError, "FloatVectorProperty(unit='%s'): invalid unit", pyunit);
                        return NULL;
                }
@@ -823,7 +824,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
                        return NULL;
                }
 
-               prop= RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
+               prop = RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
                RNA_def_property_array(prop, size);
                if (pydef) RNA_def_property_float_array_default(prop, def);
                RNA_def_property_range(prop, min, max);
@@ -832,7 +833,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -861,17 +862,17 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
        BPY_PROPDEF_HEAD(StringProperty)
 
        if (srna) {
-               static const char *kwlist[]= {"attr", "name", "description", "default",
+               static const char *kwlist[] = {"attr", "name", "description", "default",
                                              "maxlen", "options", "subtype", "update", NULL};
-               const char *id=NULL, *name="", *description="", *def="";
+               const char *id = NULL, *name = "", *description = "", *def = "";
                int id_len;
-               int maxlen=0;
+               int maxlen = 0;
                PropertyRNA *prop;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               char *pysubtype= NULL;
-               int subtype= PROP_NONE;
-               PyObject *update_cb= NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               char *pysubtype = NULL;
+               int subtype = PROP_NONE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#|sssiO!sO:StringProperty",
@@ -889,14 +890,14 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
                        return NULL;
                }
 
-               prop= RNA_def_property(srna, id, PROP_STRING, subtype);
+               prop = RNA_def_property(srna, id, PROP_STRING, subtype);
                if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */
                if (def) RNA_def_property_string_default(prop, def);
                RNA_def_property_ui_text(prop, name, description);
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -909,11 +910,11 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
 /* copies orig to buf, then sets orig to buf, returns copy length */
 static size_t strswapbufcpy(char *buf, const char **orig)
 {
-       const char *src= *orig;
-       char *dst= buf;
-       size_t i= 0;
-       *orig= buf;
-       while ((*dst= *src)) { dst++; src++; i++; }
+       const char *src = *orig;
+       char *dst = buf;
+       size_t i = 0;
+       *orig = buf;
+       while ((*dst = *src)) { dst++; src++; i++; }
        return i + 1; /* include '\0' */
 }
 #endif
@@ -922,11 +923,11 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
 {
        EnumPropertyItem *items;
        PyObject *item;
-       const Py_ssize_t seq_len= PySequence_Fast_GET_SIZE(seq_fast);
-       Py_ssize_t totbuf= 0;
+       const Py_ssize_t seq_len = PySequence_Fast_GET_SIZE(seq_fast);
+       Py_ssize_t totbuf = 0;
        int i;
-       short def_used= 0;
-       const char *def_cmp= NULL;
+       short def_used = 0;
+       const char *def_cmp = NULL;
 
        if (is_enum_flag) {
                if (seq_len > RNA_ENUM_BITFLAG_SIZE) {
@@ -946,8 +947,8 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
        }
        else {
                if (def) {
-                       def_cmp= _PyUnicode_AsString(def);
-                       if (def_cmp==NULL) {
+                       def_cmp = _PyUnicode_AsString(def);
+                       if (def_cmp == NULL) {
                                PyErr_Format(PyExc_TypeError,
                                             "EnumProperty(...): default option must be a 'str' "
                                             "type when ENUM_FLAG is disabled, not a '%.200s'",
@@ -958,30 +959,30 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
        }
 
        /* blank value */
-       *defvalue= 0;
+       *defvalue = 0;
 
-       items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1");
+       items = MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1");
 
-       for (i=0; i<seq_len; i++) {
-               EnumPropertyItem tmp= {0, "", 0, "", ""};
+       for (i = 0; i < seq_len; i++) {
+               EnumPropertyItem tmp = {0, "", 0, "", ""};
                Py_ssize_t item_size;
                Py_ssize_t id_str_size;
                Py_ssize_t name_str_size;
                Py_ssize_t desc_str_size;
 
-               item= PySequence_Fast_GET_ITEM(seq_fast, i);
+               item = PySequence_Fast_GET_ITEM(seq_fast, i);
 
                if ( (PyTuple_CheckExact(item)) &&
-                    (item_size= PyTuple_GET_SIZE(item)) &&
+                    (item_size = PyTuple_GET_SIZE(item)) &&
                     (item_size == 3 || item_size == 4) &&
-                    (tmp.identifier=  _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
-                    (tmp.name=        _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
-                    (tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
+                    (tmp.identifier =  _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
+                    (tmp.name =        _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
+                    (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
                     (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1)) /* TODO, number isnt ensured to be unique from the script author */
                {
                        if (is_enum_flag) {
                                if (item_size < 4) {
-                                       tmp.value= 1<<i;
+                                       tmp.value = 1 << i;
                                }
 
                                if (def && PySet_Contains(def, PyTuple_GET_ITEM(item, 0))) {
@@ -991,16 +992,16 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
                        }
                        else {
                                if (item_size < 4) {
-                                       tmp.value= i;
+                                       tmp.value = i;
                                }
 
-                               if (def && def_used == 0 && strcmp(def_cmp, tmp.identifier)==0) {
-                                       *defvalue= tmp.value;
+                               if (def && def_used == 0 && strcmp(def_cmp, tmp.identifier) == 0) {
+                                       *defvalue = tmp.value;
                                        def_used++; /* only ever 1 */
                                }
                        }
 
-                       items[i]= tmp;
+                       items[i] = tmp;
 
                        /* calculate combine string length */
                        totbuf += id_str_size + name_str_size + desc_str_size + 3; /* 3 is for '\0's */
@@ -1046,18 +1047,18 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
         * immediately after use, so we need to duplicate them, ugh.
         * annoying because it works most of the time without this. */
        {
-               EnumPropertyItem *items_dup= MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + (sizeof(char) * totbuf),
+               EnumPropertyItem *items_dup = MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + (sizeof(char) * totbuf),
                                                         "enum_items_from_py2");
-               EnumPropertyItem *items_ptr= items_dup;
-               char *buf= ((char *)items_dup) + (sizeof(EnumPropertyItem) * (seq_len + 1));
+               EnumPropertyItem *items_ptr = items_dup;
+               char *buf = ((char *)items_dup) + (sizeof(EnumPropertyItem) * (seq_len + 1));
                memcpy(items_dup, items, sizeof(EnumPropertyItem) * (seq_len + 1));
-               for (i=0; i<seq_len; i++, items_ptr++) {
+               for (i = 0; i < seq_len; i++, items_ptr++) {
                        buf += strswapbufcpy(buf, &items_ptr->identifier);
                        buf += strswapbufcpy(buf, &items_ptr->name);
                        buf += strswapbufcpy(buf, &items_ptr->description);
                }
                MEM_freeN(items);
-               items=items_dup;
+               items = items_dup;
        }
        /* end string duplication */
 #endif
@@ -1069,47 +1070,47 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
 {
        PyGILState_STATE gilstate;
 
-       PyObject *py_func= RNA_property_enum_py_data_get(prop);
-       PyObject *self= NULL;
+       PyObject *py_func = RNA_property_enum_py_data_get(prop);
+       PyObject *self = NULL;
        PyObject *args;
        PyObject *items; /* returned from the function call */
 
-       EnumPropertyItem *eitems= NULL;
-       int err= 0;
+       EnumPropertyItem *eitems = NULL;
+       int err = 0;
 
        bpy_context_set(C, &gilstate);
 
-       args= PyTuple_New(2);
-       self= pyrna_struct_as_instance(ptr);
+       args = PyTuple_New(2);
+       self = pyrna_struct_as_instance(ptr);
        PyTuple_SET_ITEM(args, 0, self);
 
        /* now get the context */
        PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module);
        Py_INCREF(bpy_context_module);
 
-       items= PyObject_CallObject(py_func, args);
+       items = PyObject_CallObject(py_func, args);
 
        Py_DECREF(args);
 
-       if (items==NULL) {
-               err= -1;
+       if (items == NULL) {
+               err = -1;
        }
        else {
                PyObject *items_fast;
-               int defvalue_dummy=0;
+               int defvalue_dummy = 0;
 
-               if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): "
+               if (!(items_fast = PySequence_Fast(items, "EnumProperty(...): "
                                                  "return value from the callback was not a sequence")))
                {
-                       err= -1;
+                       err = -1;
                }
                else {
-                       eitems= enum_items_from_py(items_fast, NULL, &defvalue_dummy, (RNA_property_flag(prop) & PROP_ENUM_FLAG)!=0);
+                       eitems = enum_items_from_py(items_fast, NULL, &defvalue_dummy, (RNA_property_flag(prop) & PROP_ENUM_FLAG) != 0);
 
                        Py_DECREF(items_fast);
 
                        if (!eitems) {
-                               err= -1;
+                               err = -1;
                        }
                }
 
@@ -1117,12 +1118,12 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
        }
 
        if (err != -1) { /* worked */
-               *free= 1;
+               *free = 1;
        }
        else {
                printf_func_error(py_func);
 
-               eitems= DummyRNA_NULL_items;
+               eitems = DummyRNA_NULL_items;
        }
 
 
@@ -1160,19 +1161,19 @@ 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",
+               static const char *kwlist[] = {"attr", "items", "name", "description", "default",
                                              "options", "update", NULL};
-               const char *id=NULL, *name="", *description="";
-               PyObject *def= NULL;
+               const char *id = NULL, *name = "", *description = "";
+               PyObject *def = NULL;
                int id_len;
-               int defvalue=0;
+               int defvalue = 0;
                PyObject *items, *items_fast;
                EnumPropertyItem *eitems;
                PropertyRNA *prop;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               short is_itemf= FALSE;
-               PyObject *update_cb= NULL;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               short is_itemf = FALSE;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#O|ssOO!O:EnumProperty",
@@ -1192,7 +1193,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
 
                /* items can be a list or a callable */
                if (PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
-                       PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items);
+                       PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items);
                        if (f_code->co_argcount != 2) {
                                PyErr_Format(PyExc_ValueError,
                                             "EnumProperty(...): expected 'items' function to take 2 arguments, not %d",
@@ -1207,17 +1208,17 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
                                return NULL;
                        }
 
-                       is_itemf= TRUE;
-                       eitems= DummyRNA_NULL_items;
+                       is_itemf = TRUE;
+                       eitems = DummyRNA_NULL_items;
                }
                else {
-                       if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): "
+                       if (!(items_fast = PySequence_Fast(items, "EnumProperty(...): "
                                                          "expected a sequence of tuples for the enum items or a function")))
                        {
                                return NULL;
                        }
 
-                       eitems= enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG)!=0);
+                       eitems = enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG) != 0);
 
                        Py_DECREF(items_fast);
 
@@ -1226,8 +1227,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
                        }
                }
 
-               if (opts & PROP_ENUM_FLAG)  prop= RNA_def_enum_flag(srna, id, eitems, defvalue, name, description);
-               else                        prop= RNA_def_enum(srna, id, eitems, defvalue, name, description);
+               if (opts & PROP_ENUM_FLAG)  prop = RNA_def_enum_flag(srna, id, eitems, defvalue, name, description);
+               else                        prop = RNA_def_enum(srna, id, eitems, defvalue, name, description);
 
                if (is_itemf) {
                        RNA_def_enum_funcs(prop, bpy_props_enum_itemf);
@@ -1240,7 +1241,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
 
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -1257,11 +1258,11 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
 {
        StructRNA *srna;
 
-       srna= srna_from_self(value, "");
+       srna = srna_from_self(value, "");
        if (!srna) {
                if (PyErr_Occurred()) {
-                       PyObject *msg= PyC_ExceptionBuffer();
-                       const char *msg_char= _PyUnicode_AsString(msg);
+                       PyObject *msg = PyC_ExceptionBuffer();
+                       const char *msg_char = _PyUnicode_AsString(msg);
                        PyErr_Format(PyExc_TypeError,
                                     "%.200s expected an RNA type derived from PropertyGroup, failed with: %s",
                                     error_prefix, msg_char);
@@ -1305,15 +1306,15 @@ 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", "update", NULL};
-               const char *id=NULL, *name="", *description="";
+               static const char *kwlist[] = {"attr", "type", "name", "description", "options", "update", NULL};
+               const char *id = NULL, *name = "", *description = "";
                int id_len;
                PropertyRNA *prop;
                StructRNA *ptype;
-               PyObject *type= Py_None;
-               PyObject *pyopts= NULL;
-               int opts=0;
-               PyObject *update_cb= NULL;
+               PyObject *type = Py_None;
+               PyObject *pyopts = NULL;
+               int opts = 0;
+               PyObject *update_cb = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#O|ssO!O:PointerProperty",
@@ -1327,7 +1328,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
 
                BPY_PROPDEF_CHECK(PointerProperty, property_flag_items)
 
-               ptype= pointer_type_from_py(type, "PointerProperty(...):");
+               ptype = pointer_type_from_py(type, "PointerProperty(...):");
                if (!ptype)
                        return NULL;
 
@@ -1335,10 +1336,10 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
                        return NULL;
                }
 
-               prop= RNA_def_pointer_runtime(srna, id, ptype, name, description);
+               prop = RNA_def_pointer_runtime(srna, id, ptype, name, description);
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                bpy_prop_callback_assign(prop, update_cb);
@@ -1366,14 +1367,14 @@ 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};
-               const char *id=NULL, *name="", *description="";
+               static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
+               const char *id = NULL, *name = "", *description = "";
                int id_len;
                PropertyRNA *prop;
                StructRNA *ptype;
-               PyObject *type= Py_None;
-               PyObject *pyopts= NULL;
-               int opts=0;
+               PyObject *type = Py_None;
+               PyObject *pyopts = NULL;
+               int opts = 0;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s#O|ssO!:CollectionProperty",
@@ -1386,14 +1387,14 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
 
                BPY_PROPDEF_CHECK(CollectionProperty, property_flag_items)
 
-               ptype= pointer_type_from_py(type, "CollectionProperty(...):");
+               ptype = pointer_type_from_py(type, "CollectionProperty(...):");
                if (!ptype)
                        return NULL;
 
-               prop= RNA_def_collection_runtime(srna, id, ptype, name, description);
+               prop = RNA_def_collection_runtime(srna, id, ptype, name, description);
                if (pyopts) {
                        if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
-                       if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+                       if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
                        if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
                }
                RNA_def_property_duplicate_pointers(srna, prop);
@@ -1415,9 +1416,9 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
 
        if (PyTuple_GET_SIZE(args) == 1) {
                PyObject *ret;
-               self= PyTuple_GET_ITEM(args, 0);
-               args= PyTuple_New(0);
-               ret= BPy_RemoveProperty(self, args, kw);
+               self = PyTuple_GET_ITEM(args, 0);
+               args = PyTuple_New(0);
+               ret = BPy_RemoveProperty(self, args, kw);
                Py_DECREF(args);
                return ret;     
        }
@@ -1426,18 +1427,18 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
                return NULL;
        }
 
-       srna= srna_from_self(self, "RemoveProperty(...):");
-       if (srna==NULL && PyErr_Occurred()) {
+       srna = srna_from_self(self, "RemoveProperty(...):");
+       if (srna == NULL && PyErr_Occurred()) {
                return NULL; /* self's type was compatible but error getting the srna */
        }
-       else if (srna==NULL) {
+       else if (srna == NULL) {
                PyErr_SetString(PyExc_TypeError, "RemoveProperty(): struct rna not available for this type");
                return NULL;
        }
        else {
-               static const char *kwlist[]= {"attr", NULL};
+               static const char *kwlist[] = {"attr", NULL};
                
-               char *id=NULL;
+               char *id = NULL;
 
                if (!PyArg_ParseTupleAndKeywords(args, kw,
                                                 "s:RemoveProperty",
@@ -1454,7 +1455,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},
@@ -1470,7 +1471,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"
@@ -1485,7 +1486,7 @@ PyObject *BPY_rna_props(void)
        PyObject *submodule;
        PyObject *submodule_dict;
        
-       submodule= PyModule_Create(&props_module);
+       submodule = PyModule_Create(&props_module);
        PyDict_SetItemString(PyImport_GetModuleDict(), props_module.m_name, submodule);
 
        /* INCREF since its its assumed that all these functions return the
@@ -1494,9 +1495,9 @@ PyObject *BPY_rna_props(void)
        Py_INCREF(submodule);
        
        /* api needs the PyObjects internally */
-       submodule_dict= PyModule_GetDict(submodule);
+       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);
index ded0f2f768c2cf836965d86d73287f84ccfe143c..b23db759603a4a1373222934673cfa999c4a1b92 100644 (file)
@@ -120,13 +120,13 @@ int pyrna_prop_validity_check(BPy_PropertyRNA *self)
 #if defined(USE_PYRNA_INVALIDATE_GC) || defined(USE_PYRNA_INVALIDATE_WEAKREF)
 static void pyrna_invalidate(BPy_DummyPointerRNA *self)
 {
-       self->ptr.type= NULL; /* this is checked for validity */
-       self->ptr.id.data= NULL; /* should not be needed but prevent bad pointer access, just incase */
+       self->ptr.type = NULL; /* this is checked for validity */
+       self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just incase */
 }
 #endif
 
 #ifdef USE_PYRNA_INVALIDATE_GC
-#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1))
+#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g) + 1))
 
 /* only for sizeof() */
 struct gc_generation {
@@ -138,15 +138,15 @@ struct gc_generation {
 static void id_release_gc(struct ID *id)
 {
        unsigned int j;
-       // unsigned int i= 0;
-       for (j=0; j<3; j++) {
+       // unsigned int i = 0;
+       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;
-               while ((g= g->gc.gc_next) != gen) {
-                       PyObject *ob= FROM_GC(g);
+               PyGC_Head *gen = (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j));
+               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)) {
-                               BPy_DummyPointerRNA *ob_ptr= (BPy_DummyPointerRNA *)ob;
+                               BPy_DummyPointerRNA *ob_ptr = (BPy_DummyPointerRNA *)ob;
                                if (ob_ptr->ptr.id.data == id) {
                                        pyrna_invalidate(ob_ptr);
                                        // printf("freeing: %p %s, %.200s\n", (void *)ob, id->name, Py_TYPE(ob)->tp_name);
@@ -162,27 +162,27 @@ static void id_release_gc(struct ID *id)
 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
 //#define DEBUG_RNA_WEAKREF
 
-struct GHash *id_weakref_pool= NULL;
+struct GHash *id_weakref_pool = NULL;
 static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref);
-static PyMethodDef id_free_weakref_cb_def= {"id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O, NULL};
+static PyMethodDef id_free_weakref_cb_def = {"id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O, NULL};
 
 /* adds a reference to the list, remember to decref */
 static GHash *id_weakref_pool_get(ID *id)
 {
-       GHash *weakinfo_hash= NULL;
+       GHash *weakinfo_hash = NULL;
 
        if (id_weakref_pool) {
-               weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id);
+               weakinfo_hash = BLI_ghash_lookup(id_weakref_pool, (void *)id);
        }
        else {
                /* first time, allocate pool */
-               id_weakref_pool= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_global_pool");
-               weakinfo_hash= NULL;
+               id_weakref_pool = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_global_pool");
+               weakinfo_hash = NULL;
        }
 
-       if (weakinfo_hash==NULL) {
+       if (weakinfo_hash == NULL) {
                /* we're using a ghash as a set, could use libHX's HXMAP_SINGULAR but would be an extra dep. */
-               weakinfo_hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_id");
+               weakinfo_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_id");
                BLI_ghash_insert(id_weakref_pool, (void *)id, weakinfo_hash);
        }
 
@@ -197,14 +197,14 @@ void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna)
        PyObject *weakref_cb_py;
 
        /* create a new function instance and insert the list as 'self' so we can remove ourself from it */
-       GHash *weakinfo_hash= id_weakref_pool_get(id); /* new or existing */
+       GHash *weakinfo_hash = id_weakref_pool_get(id); /* new or existing */
 
-       weakref_capsule= PyCapsule_New(weakinfo_hash, NULL, NULL);
-       weakref_cb_py= PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
+       weakref_capsule = PyCapsule_New(weakinfo_hash, NULL, NULL);
+       weakref_cb_py = PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
        Py_DECREF(weakref_capsule);
 
        /* add weakref to weakinfo_hash list */
-       weakref= PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
+       weakref = PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
 
        Py_DECREF(weakref_cb_py); /* function owned by the weakref now */
 
@@ -218,14 +218,14 @@ void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna)
 static ID *_id_tmp_ptr;
 static void value_id_set(void *id)
 {
-       _id_tmp_ptr= (ID *)id;
+       _id_tmp_ptr = (ID *)id;
 }
 
 static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash);
 static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject *weakref)
 {
        /* important to search backwards */
-       GHash *weakinfo_hash= PyCapsule_GetPointer(weakinfo_capsule, NULL);
+       GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_capsule, NULL);
 
 
        if (BLI_ghash_size(weakinfo_hash) > 1) {
@@ -252,8 +252,8 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
 #endif
 
        while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) {
-               PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
-               PyObject *item= PyWeakref_GET_OBJECT(weakref);
+               PyObject *weakref = (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
+               PyObject *item = PyWeakref_GET_OBJECT(weakref);
                if (item != Py_None) {
 
 #ifdef DEBUG_RNA_WEAKREF
@@ -273,7 +273,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
 
        if (BLI_ghash_size(id_weakref_pool) == 0) {
                BLI_ghash_free(id_weakref_pool, NULL, NULL);
-               id_weakref_pool= NULL;
+               id_weakref_pool = NULL;
 #ifdef DEBUG_RNA_WEAKREF
                printf("id_release_weakref freeing pool\n");
 #endif
@@ -282,7 +282,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
 
 static void id_release_weakref(struct ID *id)
 {
-       GHash *weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id);
+       GHash *weakinfo_hash = BLI_ghash_lookup(id_weakref_pool, (void *)id);
        if (weakinfo_hash) {
                id_release_weakref_list(id, weakinfo_hash);
        }
@@ -298,7 +298,7 @@ void BPY_id_release(struct ID *id)
 
 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
        if (id_weakref_pool) {
-               PyGILState_STATE gilstate= PyGILState_Ensure();
+               PyGILState_STATE gilstate = PyGILState_Ensure();
 
                id_release_weakref(id);
 
@@ -310,25 +310,25 @@ void BPY_id_release(struct ID *id)
 }
 
 #ifdef USE_PEDANTIC_WRITE
-static short rna_disallow_writes= FALSE;
+static short rna_disallow_writes = FALSE;
 
 static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
 {
-       ID *id= ptr->id.data;
+       ID *id = ptr->id.data;
        if (id) {
-               const short idcode= GS(id->name);
+               const short idcode = GS(id->name);
                if (!ELEM(idcode, ID_WM, ID_SCR)) { /* may need more added here */
-                       const char *idtype= BKE_idcode_to_name(idcode);
+                       const char *idtype = BKE_idcode_to_name(idcode);
                        const char *pyname;
-                       if (key && PyUnicode_Check(key)) pyname= _PyUnicode_AsString(key);
-                       else                             pyname= "<UNKNOWN>";
+                       if (key && PyUnicode_Check(key)) pyname = _PyUnicode_AsString(key);
+                       else                             pyname = "<UNKNOWN>";
 
                        /* make a nice string error */
                        BLI_assert(idtype != NULL);
                        PyErr_Format(PyExc_AttributeError,
                                     "Writing to ID classes in this context is not allowed: "
                                     "%.200s, %.200s datablock, error setting %.200s.%.200s",
-                                    id->name+2, idtype, RNA_struct_identifier(ptr->type), pyname);
+                                    id->name + 2, idtype, RNA_struct_identifier(ptr->type), pyname);
 
                        return TRUE;
                }
@@ -346,7 +346,7 @@ int pyrna_write_check(void)
 
 void pyrna_write_set(int val)
 {
-       rna_disallow_writes= !val;
+       rna_disallow_writes = !val;
 }
 #else // USE_PEDANTIC_WRITE
 int pyrna_write_check(void)
@@ -372,7 +372,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
 
 /* bpyrna vector/euler/quat callbacks */
-static int mathutils_rna_array_cb_index= -1; /* index for our callbacks */
+static int mathutils_rna_array_cb_index = -1; /* index for our callbacks */
 
 /* subtype not used much yet */
 #define MATHUTILS_CB_SUBTYPE_EUL 0
@@ -382,7 +382,7 @@ static int mathutils_rna_array_cb_index= -1; /* index for our callbacks */
 
 static int mathutils_rna_generic_check(BaseMathObject *bmo)
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
 
        PYRNA_PROP_CHECK_INT(self);
 
@@ -391,20 +391,20 @@ static int mathutils_rna_generic_check(BaseMathObject *bmo)
 
 static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop==NULL)
+       if (self->prop == NULL)
                return -1;
 
        RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
 
        /* Euler order exception */
-       if (subtype==MATHUTILS_CB_SUBTYPE_EUL) {
-               EulerObject *eul= (EulerObject *)bmo;
-               PropertyRNA *prop_eul_order= NULL;
-               eul->order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
+       if (subtype == MATHUTILS_CB_SUBTYPE_EUL) {
+               EulerObject *eul = (EulerObject *)bmo;
+               PropertyRNA *prop_eul_order = NULL;
+               eul->order = pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
        }
 
        return 0;
@@ -412,12 +412,12 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
 
 static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
        float min, max;
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop==NULL)
+       if (self->prop == NULL)
                return -1;
 
 #ifdef USE_PEDANTIC_WRITE
@@ -436,8 +436,8 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
        RNA_property_float_range(&self->ptr, self->prop, &min, &max);
 
        if (min != FLT_MIN || max != FLT_MAX) {
-               int i, len= RNA_property_array_length(&self->ptr, self->prop);
-               for (i=0; i<len; i++) {
+               int i, len = RNA_property_array_length(&self->ptr, self->prop);
+               for (i = 0; i < len; i++) {
                        CLAMP(bmo->data[i], min, max);
                }
        }
@@ -448,10 +448,10 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
        }
 
        /* Euler order exception */
-       if (subtype==MATHUTILS_CB_SUBTYPE_EUL) {
-               EulerObject *eul= (EulerObject *)bmo;
-               PropertyRNA *prop_eul_order= NULL;
-               short order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
+       if (subtype == MATHUTILS_CB_SUBTYPE_EUL) {
+               EulerObject *eul = (EulerObject *)bmo;
+               PropertyRNA *prop_eul_order = NULL;
+               short order = pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
                if (order != eul->order) {
                        RNA_property_enum_set(&self->ptr, prop_eul_order, eul->order);
                        if (RNA_property_update_check(prop_eul_order)) {
@@ -464,24 +464,24 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
 
 static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop==NULL)
+       if (self->prop == NULL)
                return -1;
 
-       bmo->data[index]= RNA_property_float_get_index(&self->ptr, self->prop, index);
+       bmo->data[index] = RNA_property_float_get_index(&self->ptr, self->prop, index);
        return 0;
 }
 
 static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop==NULL)
+       if (self->prop == NULL)
                return -1;
 
 #ifdef USE_PEDANTIC_WRITE
@@ -507,7 +507,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,
@@ -517,15 +517,15 @@ static Mathutils_Callback mathutils_rna_array_cb= {
 
 
 /* bpyrna matrix callbacks */
-static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
+static int mathutils_rna_matrix_cb_index = -1; /* index for our callbacks */
 
 static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop==NULL)
+       if (self->prop == NULL)
                return -1;
 
        RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
@@ -534,11 +534,11 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
 
 static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
 {
-       BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+       BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
 
        PYRNA_PROP_CHECK_INT(self);
 
-       if (self->prop==NULL)
+       if (self->prop == NULL)
                return -1;
 
 #ifdef USE_PEDANTIC_WRITE
@@ -563,7 +563,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,
@@ -574,11 +574,11 @@ static Mathutils_Callback mathutils_rna_matrix_cb= {
 static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback)
 {
        /* attempt to get order */
-       if (*prop_eul_order==NULL)
-               *prop_eul_order= RNA_struct_find_property(ptr, "rotation_mode");
+       if (*prop_eul_order == NULL)
+               *prop_eul_order = RNA_struct_find_property(ptr, "rotation_mode");
 
        if (*prop_eul_order) {
-               short order= RNA_property_enum_get(ptr, *prop_eul_order);
+               short order = RNA_property_enum_get(ptr, *prop_eul_order);
                if (order >= EULER_ORDER_XYZ && order <= EULER_ORDER_ZYX) /* could be quat or axisangle */
                        return order;
        }
@@ -602,107 +602,107 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_
 
 PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
 {
-       PyObject *ret= NULL;
+       PyObject *ret = NULL;
 
 #ifdef USE_MATHUTILS
        int subtype, totdim;
        int len;
        int is_thick;
-       const int flag= RNA_property_flag(prop);
+       const int flag = RNA_property_flag(prop);
 
        /* disallow dynamic sized arrays to be wrapped since the size could change
         * to a size mathutils does not support */
        if ((RNA_property_type(prop) != PROP_FLOAT) || (flag & PROP_DYNAMIC))
                return NULL;
 
-       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);
+       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);
 
        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 (subtype) {
                case PROP_ALL_VECTOR_SUBTYPES:
-                       if (len>=2 && len <= 4) {
+                       if (len >= 2 && len <= 4) {
                                if (is_thick) {
-                                       ret= Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
+                                       ret = Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
                                        RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec);
                                }
                                else {
-                                       PyObject *vec_cb= Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
+                                       PyObject *vec_cb = Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
                                        Py_DECREF(ret); /* the vector owns now */
-                                       ret= vec_cb; /* return the vector instead */
+                                       ret = vec_cb; /* return the vector instead */
                                }
                        }
                        break;
                case PROP_MATRIX:
-                       if (len==16) {
+                       if (len == 16) {
                                if (is_thick) {
-                                       ret= Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
+                                       ret = Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
                                        RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
                                }
                                else {
-                                       PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
+                                       PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
                                        Py_DECREF(ret); /* the matrix owns now */
-                                       ret= mat_cb; /* return the matrix instead */
+                                       ret = mat_cb; /* return the matrix instead */
                                }
                        }
-                       else if (len==9) {
+                       else if (len == 9) {
                                if (is_thick) {
-                                       ret= Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
+                                       ret = Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
                                        RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
                                }
                                else {
-                                       PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
+                                       PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
                                        Py_DECREF(ret); /* the matrix owns now */
-                                       ret= mat_cb; /* return the matrix instead */
+                                       ret = mat_cb; /* return the matrix instead */
                                }
                        }
                        break;
                case PROP_EULER:
                case PROP_QUATERNION:
-                       if (len==3) { /* euler */
+                       if (len == 3) { /* euler */
                                if (is_thick) {
                                        /* attempt to get order, only needed for thick types since wrapped with update via callbacks */
-                                       PropertyRNA *prop_eul_order= NULL;
-                                       short order= pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ);
+                                       PropertyRNA *prop_eul_order = NULL;
+                                       short order = pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ);
 
-                                       ret= Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
+                                       ret = Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
                                        RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
                                }
                                else {
                                        /* order will be updated from callback on use */
-                                       PyObject *eul_cb= Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
+                                       PyObject *eul_cb = Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
                                        Py_DECREF(ret); /* the euler owns now */
-                                       ret= eul_cb; /* return the euler instead */
+                                       ret = eul_cb; /* return the euler instead */
                                }
                        }
-                       else if (len==4) {
+                       else if (len == 4) {
                                if (is_thick) {
-                                       ret= Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
+                                       ret = Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
                                        RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat);
                                }
                                else {
-                                       PyObject *quat_cb= Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
+                                       PyObject *quat_cb = Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
                                        Py_DECREF(ret); /* the quat owns now */
-                                       ret= quat_cb; /* return the quat instead */
+                                       ret = quat_cb; /* return the quat instead */
                                }
                        }
                        break;
                case PROP_COLOR:
                case PROP_COLOR_GAMMA:
-                       if (len==3) { /* color */
+                       if (len == 3) { /* color */
                                if (is_thick) {
-                                       ret= Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
+                                       ret = Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
                                        RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
                                }
                                else {
-                                       PyObject *col_cb= Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
+                                       PyObject *col_cb = Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
                                        Py_DECREF(ret); /* the color owns now */
-                                       ret= col_cb; /* return the color instead */
+                                       ret = col_cb; /* return the color instead */
                                }
                        }
                default:
@@ -710,14 +710,14 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
                }
        }
 
-       if (ret==NULL) {
+       if (ret == NULL) {
                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);
+                       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_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
                }
        }
 #else // USE_MATHUTILS
@@ -732,7 +732,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
 int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix)
 {
        if (RNA_enum_value_from_id(item, identifier, value) == 0) {
-               const char *enum_str= BPy_enum_as_string(item);
+               const char *enum_str = BPy_enum_as_string(item);
                PyErr_Format(PyExc_TypeError,
                             "%s: '%.200s' not found in (%s)",
                             error_prefix, identifier, enum_str);
@@ -745,34 +745,34 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
 
 static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
 {
-       return (a->ptr.data==b->ptr.data) ? 0 : -1;
+       return (a->ptr.data == b->ptr.data) ? 0 : -1;
 }
 
 static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
 {
-       return (a->prop==b->prop && a->ptr.data==b->ptr.data) ? 0 : -1;
+       return (a->prop == b->prop && a->ptr.data == b->ptr.data) ? 0 : -1;
 }
 
 static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
 {
        PyObject *res;
-       int ok= -1; /* zero is true */
+       int ok = -1; /* zero is true */
 
        if (BPy_StructRNA_Check(a) && BPy_StructRNA_Check(b))
-               ok= pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
+               ok = pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
 
        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();
@@ -785,23 +785,23 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
 static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
 {
        PyObject *res;
-       int ok= -1; /* zero is true */
+       int ok = -1; /* zero is true */
 
        if (BPy_PropertyRNA_Check(a) && BPy_PropertyRNA_Check(b))
-               ok= pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
+               ok = pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
 
        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();
@@ -823,9 +823,9 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
        }
 
        /* print name if available */
-       name= RNA_struct_name_get_alloc(&self->ptr, NULL, 0, NULL);
+       name = RNA_struct_name_get_alloc(&self->ptr, NULL, 0, NULL);
        if (name) {
-               ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
+               ret = PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
                                          RNA_struct_identifier(self->ptr.type),
                                          name);
                MEM_freeN((void *)name);
@@ -839,32 +839,32 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
 
 static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
 {
-       ID *id= self->ptr.id.data;
+       ID *id = self->ptr.id.data;
        PyObject *tmp_str;
        PyObject *ret;
 
        if (id == NULL || !PYRNA_STRUCT_IS_VALID(self))
                return pyrna_struct_str(self); /* fallback */
 
-       tmp_str= PyUnicode_FromString(id->name+2);
+       tmp_str = PyUnicode_FromString(id->name + 2);
 
        if (RNA_struct_is_ID(self->ptr.type)) {
-               ret= PyUnicode_FromFormat("bpy.data.%s[%R]",
+               ret = PyUnicode_FromFormat("bpy.data.%s[%R]",
                                            BKE_idcode_to_name_plural(GS(id->name)),
                                            tmp_str);
        }
        else {
                const char *path;
-               path= RNA_path_from_ID_to_struct(&self->ptr);
+               path = RNA_path_from_ID_to_struct(&self->ptr);
                if (path) {
-                       ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+                       ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
                                                  BKE_idcode_to_name_plural(GS(id->name)),
                                                  tmp_str,
                                                  path);
                        MEM_freeN((void *)path);
                }
                else { /* cant find, print something sane */
-                       ret= PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
+                       ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
                                                  BKE_idcode_to_name_plural(GS(id->name)),
                                                  tmp_str,
                                                  RNA_struct_identifier(self->ptr.type));
@@ -881,30 +881,30 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
        PyObject *ret;
        PointerRNA ptr;
        const char *name;
-       const char *type_id= NULL;
-       char type_fmt[64]= "";
+       const char *type_id = NULL;
+       char type_fmt[64] = "";
        int type;
 
        PYRNA_PROP_CHECK_OBJ(self);
 
-       type= RNA_property_type(self->prop);
+       type = RNA_property_type(self->prop);
 
-       if (RNA_enum_id_from_value(property_type_items, type, &type_id)==0) {
+       if (RNA_enum_id_from_value(property_type_items, type, &type_id) == 0) {
                PyErr_SetString(PyExc_RuntimeError, "could not use property type, internal error"); /* should never happen */
                return NULL;
        }
        else {
                /* this should never fail */
-               int len= -1;
-               char *c= type_fmt;
+               int len = -1;
+               char *c = type_fmt;
 
                while ((*c++= tolower(*type_id++))) {} ;
 
-               if (type==PROP_COLLECTION) {
-                       len= pyrna_prop_collection_length(self);
+               if (type == PROP_COLLECTION) {
+                       len = pyrna_prop_collection_length(self);
                }
                else if (RNA_property_array_check(self->prop)) {
-                       len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
+                       len = pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
                }
 
                if (len != -1)
@@ -913,11 +913,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
 
        /* if a pointer, try to print name of pointer target too */
        if (type == PROP_POINTER) {
-               ptr= RNA_property_pointer_get(&self->ptr, self->prop);
-               name= RNA_struct_name_get_alloc(&ptr, NULL, 0, NULL);
+               ptr = RNA_property_pointer_get(&self->ptr, self->prop);
+               name = RNA_struct_name_get_alloc(&ptr, NULL, 0, NULL);
 
                if (name) {
-                       ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
+                       ret = PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
                                                  type_fmt,
                                                  RNA_struct_identifier(self->ptr.type),
                                                  RNA_property_identifier(self->prop),
@@ -943,7 +943,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
 
 static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
 {
-       ID *id= self->ptr.id.data;
+       ID *id = self->ptr.id.data;
        PyObject *tmp_str;
        PyObject *ret;
        const char *path;
@@ -953,18 +953,18 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
        if (id == NULL)
                return pyrna_prop_str(self); /* fallback */
 
-       tmp_str= PyUnicode_FromString(id->name+2);
+       tmp_str = PyUnicode_FromString(id->name + 2);
 
-       path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
+       path = RNA_path_from_ID_to_property(&self->ptr, self->prop);
        if (path) {
-               ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+               ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
                                          BKE_idcode_to_name_plural(GS(id->name)),
                                          tmp_str,
                                          path);
                MEM_freeN((void *)path);
        }
        else { /* cant find, print something sane */
-               ret= PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
+               ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
                                          BKE_idcode_to_name_plural(GS(id->name)),
                                          tmp_str,
                                          RNA_property_identifier(self->prop));
@@ -995,18 +995,18 @@ static long pyrna_prop_hash(BPy_PropertyRNA *self)
 {
        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;
 }
 
@@ -1031,7 +1031,7 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
        if (self->freeptr && self->ptr.data) {
                IDP_FreeProperty(self->ptr.data);
                MEM_freeN(self->ptr.data);
-               self->ptr.data= NULL;
+               self->ptr.data = NULL;
        }
 #endif /* PYRNA_FREE_SUPPORT */
 
@@ -1056,15 +1056,15 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
 static void pyrna_struct_reference_set(BPy_StructRNA *self, PyObject *reference)
 {
        if (self->reference) {
-//             PyObject_GC_UnTrack(self); /* INITIALIZED TRACKED? */
+//             PyObject_GC_UnTrack(self); /* INITIALIZED TRACKED ? */
                pyrna_struct_clear(self);
        }
        /* reference is now NULL */
 
        if (reference) {
-               self->reference= reference;
+               self->reference = reference;
                Py_INCREF(reference);
-//             PyObject_GC_Track(self);  /* INITIALIZED TRACKED? */
+//             PyObject_GC_Track(self);  /* INITIALIZED TRACKED ? */
        }
 }
 #endif /* !USE_PYRNA_STRUCT_REFERENCE */
@@ -1096,14 +1096,14 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
 {
        EnumPropertyItem *item;
        const char *result;
-       int free= FALSE;
+       int free = FALSE;
 
        RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
        if (item) {
-               result= BPy_enum_as_string(item);
+               result = BPy_enum_as_string(item);
        }
        else {
-               result= "";
+               result = "";
        }
 
        if (free)
@@ -1115,10 +1115,10 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
 
 static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *prop, int *val, const char *error_prefix)
 {
-       const char *param= _PyUnicode_AsString(item);
+       const char *param = _PyUnicode_AsString(item);
 
-       if (param==NULL) {
-               const char *enum_str= pyrna_enum_as_string(ptr, prop);
+       if (param == NULL) {
+               const char *enum_str = pyrna_enum_as_string(ptr, prop);
                PyErr_Format(PyExc_TypeError,
                             "%.200s expected a string enum type in (%.200s)",
                             error_prefix, enum_str);
@@ -1131,7 +1131,7 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
                RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
 
                if (!RNA_property_enum_value(BPy_GetContext(), ptr, prop, param, val)) {
-                       const char *enum_str= pyrna_enum_as_string(ptr, prop);
+                       const char *enum_str = pyrna_enum_as_string(ptr, prop);
                        PyErr_Format(PyExc_TypeError,
                                     "%.200s enum \"%.200s\" not found in (%.200s)",
                                     error_prefix, param, enum_str);
@@ -1147,19 +1147,19 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
 int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
 {
        /* set of enum items, concatenate all values with OR */
-       int ret, flag= 0;
+       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;
+       *r_value = 0;
 
        while (_PySet_NextEntry(value, &pos, &key, &hash)) {
-               const char *param= _PyUnicode_AsString(key);
+               const char *param = _PyUnicode_AsString(key);
 
-               if (param==NULL) {
+               if (param == NULL) {
                        PyErr_Format(PyExc_TypeError,
                                     "%.200s expected a string, not %.200s",
                                     error_prefix, Py_TYPE(key)->tp_name);
@@ -1173,7 +1173,7 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_
                flag |= ret;
        }
 
-       *r_value= flag;
+       *r_value = flag;
        return 0;
 }
 
@@ -1181,9 +1181,9 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
 {
        EnumPropertyItem *item;
        int ret;
-       int free= FALSE;
+       int free = FALSE;
 
-       *r_value= 0;
+       *r_value = 0;
 
        if (!PyAnySet_Check(value)) {
                PyErr_Format(PyExc_TypeError,
@@ -1196,17 +1196,17 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
        RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
 
        if (item) {
-               ret= pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix);
+               ret = pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix);
        }
        else {
                if (PySet_GET_SIZE(value)) {
                        PyErr_Format(PyExc_TypeError,
                                     "%.200s: empty enum \"%.200s\" could not have any values assigned",
                                     error_prefix, RNA_property_identifier(prop));
-                       ret= -1;
+                       ret = -1;
                }
                else {
-                       ret= 0;
+                       ret = 0;
                }
        }
 
@@ -1218,14 +1218,14 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
 
 PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value)
 {
-       PyObject *ret= PySet_New(NULL);
+       PyObject *ret = PySet_New(NULL);
        const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
 
        if (RNA_enum_bitflag_identifiers(items, value, identifier)) {
                PyObject *item;
                int index;
-               for (index=0; identifier[index]; index++) {
-                       item= PyUnicode_FromString(identifier[index]);
+               for (index = 0; identifier[index]; index++) {
+                       item = PyUnicode_FromString(identifier[index]);
                        PySet_Add(ret, item);
                        Py_DECREF(item);
                }
@@ -1236,18 +1236,18 @@ PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value)
 
 static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
 {
-       PyObject *item, *ret= NULL;
+       PyObject *item, *ret = NULL;
 
        if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
                const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
 
-               ret= PySet_New(NULL);
+               ret = PySet_New(NULL);
 
                if (RNA_property_enum_bitflag_identifiers(BPy_GetContext(), ptr, prop, val, identifier)) {
                        int index;
 
-                       for (index=0; identifier[index]; index++) {
-                               item= PyUnicode_FromString(identifier[index]);
+                       for (index = 0; identifier[index]; index++) {
+                               item = PyUnicode_FromString(identifier[index]);
                                PySet_Add(ret, item);
                                Py_DECREF(item);
                        }
@@ -1257,20 +1257,20 @@ 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);
+                       ret = PyUnicode_FromString(identifier);
                }
                else {
                        EnumPropertyItem *enum_item;
-                       int free= FALSE;
+                       int free = FALSE;
 
                        /* don't throw error here, can't trust blender 100% to give the
                         * right values, python code should not generate error for that */
                        RNA_property_enum_items(BPy_GetContext(), ptr, prop, &enum_item, NULL, &free);
                        if (enum_item && enum_item->identifier) {
-                               ret= PyUnicode_FromString(enum_item->identifier);
+                               ret = PyUnicode_FromString(enum_item->identifier);
                        }
                        else {
-                               const char *ptr_name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
+                               const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
 
                                /* prefer not fail silently incase of api errors, maybe disable it later */
                                printf("RNA Warning: Current value \"%d\" "
@@ -1292,7 +1292,7 @@ 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)
@@ -1300,7 +1300,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
                        /*
                        PyErr_Format(PyExc_AttributeError,
                                     "RNA Error: Current value \"%d\" matches no enum", val);
-                       ret= NULL;
+                       ret = NULL;
                        */
                }
        }
@@ -1311,7 +1311,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
 PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
 {
        PyObject *ret;
-       const int type= RNA_property_type(prop);
+       const int type = RNA_property_type(prop);
 
        if (RNA_property_array_check(prop)) {
                return pyrna_py_from_array(ptr, prop);
@@ -1320,39 +1320,39 @@ 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:
        {
-               const int subtype= RNA_property_subtype(prop);
+               const int subtype = RNA_property_subtype(prop);
                const char *buf;
                int buf_len;
                char buf_fixed[32];
 
-               buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len);
+               buf = RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len);
 #ifdef USE_STRING_COERCE
                /* only file paths get special treatment, they may contain non utf-8 chars */
                if (subtype == PROP_BYTESTRING) {
-                       ret= PyBytes_FromStringAndSize(buf, buf_len);
+                       ret = PyBytes_FromStringAndSize(buf, buf_len);
                }
                else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
-                       ret= PyC_UnicodeFromByteAndSize(buf, buf_len);
+                       ret = PyC_UnicodeFromByteAndSize(buf, buf_len);
                }
                else {
-                       ret= PyUnicode_FromStringAndSize(buf, buf_len);
+                       ret = PyUnicode_FromStringAndSize(buf, buf_len);
                }
 #else // USE_STRING_COERCE
                if (subtype == PROP_BYTESTRING) {
-                       ret= PyBytes_FromStringAndSize(buf, buf_len);
+                       ret = PyBytes_FromStringAndSize(buf, buf_len);
                }
                else {
-                       ret= PyUnicode_FromStringAndSize(buf, buf_len);
+                       ret = PyUnicode_FromStringAndSize(buf, buf_len);
                }
 #endif // USE_STRING_COERCE
                if (buf_fixed != buf) {
@@ -1362,29 +1362,29 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
        }
        case PROP_ENUM:
        {
-               ret= pyrna_enum_to_py(ptr, prop, RNA_property_enum_get(ptr, prop));
+               ret = pyrna_enum_to_py(ptr, prop, RNA_property_enum_get(ptr, prop));
                break;
        }
        case PROP_POINTER:
        {
                PointerRNA newptr;
-               newptr= RNA_property_pointer_get(ptr, prop);
+               newptr = RNA_property_pointer_get(ptr, prop);
                if (newptr.data) {
-                       ret= pyrna_struct_CreatePyObject(&newptr);
+                       ret = pyrna_struct_CreatePyObject(&newptr);
                }
                else {
-                       ret= Py_None;
+                       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;
        }
 
@@ -1395,40 +1395,40 @@ 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;
+       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);
+               arg_name = RNA_property_identifier(prop);
 
-               if (strcmp(arg_name, "rna_type")==0) continue;
+               if (strcmp(arg_name, "rna_type") == 0) continue;
 
-               if (kw==NULL) {
+               if (kw == NULL) {
                        PyErr_Format(PyExc_TypeError,
                                     "%.200s: no keywords, expected \"%.200s\"",
                                     error_prefix, arg_name ? arg_name : "<UNKNOWN>");
-                       error_val= -1;
+                       error_val = -1;
                        break;
                }
 
-               item= PyDict_GetItemString(kw, arg_name); /* wont set an error */
+               item = PyDict_GetItemString(kw, arg_name); /* wont set an error */
 
                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 {
                        if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) {
-                               error_val= -1;
+                               error_val = -1;
                                break;
                        }
                        totkw--;
@@ -1436,20 +1436,20 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
        }
        RNA_STRUCT_END;
 
-       if (error_val==0 && totkw > 0) { /* some keywords were given that were not used :/ */
+       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);
+                       arg_name = _PyUnicode_AsString(key);
                        if (RNA_struct_find_property(ptr, arg_name) == NULL) break;
-                       arg_name= NULL;
+                       arg_name = NULL;
                }
 
                PyErr_Format(PyExc_TypeError,
                             "%.200s: keyword \"%.200s\" unrecognized",
                             error_prefix, arg_name ? arg_name : "<UNKNOWN>");
-               error_val= -1;
+               error_val = -1;
        }
 
        return error_val;
@@ -1458,9 +1458,9 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
 
 static PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func)
 {
-       BPy_FunctionRNA* pyfunc= (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type);
-       pyfunc->ptr= *ptr;
-       pyfunc->func= func;
+       BPy_FunctionRNA* pyfunc = (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type);
+       pyfunc->ptr = *ptr;
+       pyfunc->func = func;
        return (PyObject *)pyfunc;
 }
 
@@ -1468,7 +1468,7 @@ static PyObject *pyrna_func_to_py(PointerRNA *ptr, 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 */
-       const int type= RNA_property_type(prop);
+       const int type = RNA_property_type(prop);
 
 
        if (RNA_property_array_check(prop)) {
@@ -1489,9 +1489,9 @@ 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,
@@ -1501,7 +1501,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                return -1;
                        }
                        else {
-                               if (data)  *((int*)data)= param;
+                               if (data)  *((int *)data)= param;
                                else       RNA_property_boolean_set(ptr, prop, param);
                        }
                        break;
@@ -1509,7 +1509,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                case PROP_INT:
                {
                        int overflow;
-                       long param= PyLong_AsLongAndOverflow(value, &overflow);
+                       long param = PyLong_AsLongAndOverflow(value, &overflow);
                        if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
                                PyErr_Format(PyExc_ValueError,
                                             "%.200s %.200s.%.200s value not in 'int' range "
@@ -1518,7 +1518,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                             RNA_property_identifier(prop));
                                return -1;
                        }
-                       else if (param==-1 && PyErr_Occurred()) {
+                       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),
@@ -1526,16 +1526,16 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                return -1;
                        }
                        else {
-                               int param_i= (int)param;
+                               int param_i = (int)param;
                                RNA_property_int_clamp(ptr, prop, &param_i);
-                               if (data)  *((int*)data)= param_i;
+                               if (data)  *((int *)data)= param_i;
                                else       RNA_property_int_set(ptr, prop, param_i);
                        }
                        break;
                }
                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",
@@ -1545,23 +1545,23 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                        }
                        else {
                                RNA_property_float_clamp(ptr, prop, (float *)&param);
-                               if (data)   *((float*)data)= param;
+                               if (data)   *((float *)data)= param;
                                else        RNA_property_float_set(ptr, prop, param);
                        }
                        break;
                }
                case PROP_STRING:
                {
-                       const int subtype= RNA_property_subtype(prop);
+                       const int subtype = RNA_property_subtype(prop);
                        const char *param;
 
                        if (subtype == PROP_BYTESTRING) {
 
                                /* Byte String */
 
-                               param= PyBytes_AsString(value);
+                               param = PyBytes_AsString(value);
 
-                               if (param==NULL) {
+                               if (param == NULL) {
                                        if (PyBytes_Check(value)) {
                                                /* there was an error assigning a string type,
                                                 * rather than setting a new error, prefix the existing one
@@ -1582,7 +1582,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                }
                                else {
                                        /* same as unicode */
-                                       if (data)   *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
+                                       if (data)   *((char **)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
                                        else        RNA_property_string_set(ptr, prop, param);
                                }
                        }
@@ -1591,25 +1591,25 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                /* Unicode String */
 
 #ifdef USE_STRING_COERCE
-                               PyObject *value_coerce= NULL;
+                               PyObject *value_coerce = NULL;
                                if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
                                        /* TODO, get size */
-                                       param= PyC_UnicodeAsByte(value, &value_coerce);
+                                       param = PyC_UnicodeAsByte(value, &value_coerce);
                                }
                                else {
-                                       param= _PyUnicode_AsString(value);
+                                       param = _PyUnicode_AsString(value);
 #ifdef WITH_INTERNATIONAL
                                        if (subtype == PROP_TRANSLATE) {
-                                               param= IFACE_(param);
+                                               param = IFACE_(param);
                                        }
 #endif // WITH_INTERNATIONAL
 
                                }
 #else // USE_STRING_COERCE
-                               param= _PyUnicode_AsString(value);
+                               param = _PyUnicode_AsString(value);
 #endif // USE_STRING_COERCE
 
-                               if (param==NULL) {
+                               if (param == NULL) {
                                        if (PyUnicode_Check(value)) {
                                                /* there was an error assigning a string type,
                                                 * rather than setting a new error, prefix the existing one
@@ -1630,7 +1630,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                }
                                else {
                                        /* same as bytes */
-                                       if (data)   *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
+                                       if (data)   *((char **)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
                                        else        RNA_property_string_set(ptr, prop, param);
                                }
 #ifdef USE_STRING_COERCE
@@ -1641,7 +1641,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                }
                case PROP_ENUM:
                {
-                       int val= 0;
+                       int val = 0;
 
                        /* type checkins is done by each function */
                        if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
@@ -1657,17 +1657,17 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                }
                        }
 
-                       if (data)  *((int*)data)= val;
+                       if (data)  *((int *)data)= val;
                        else       RNA_property_enum_set(ptr, prop, val);
 
                        break;
                }
                case PROP_POINTER:
                {
-                       PyObject *value_new= NULL;
+                       PyObject *value_new = NULL;
 
-                       StructRNA *ptr_type= RNA_property_pointer_type(ptr, prop);
-                       int flag= RNA_property_flag(prop);
+                       StructRNA *ptr_type = RNA_property_pointer_type(ptr, 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")
@@ -1675,7 +1675,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                         * layout.prop(self.properties, "filepath")
                         *
                         * we need to do this trick.
-                        * if the prop is not an operator type and the pyobject is an operator, use its properties in place of its self.
+                        * if the prop is not an operator type and the pyobject is an operator,
+                        * use its properties in place of its self.
                         *
                         * this is so bad that its almost a good reason to do away with fake 'self.properties -> self' class mixing
                         * if this causes problems in the future it should be removed.
@@ -1684,24 +1685,25 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                (BPy_StructRNA_Check(value)) &&
                                (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator))
                        ) {
-                               value= PyObject_GetAttrString(value, "properties");
-                               value_new= value;
+                               value = PyObject_GetAttrString(value, "properties");
+                               value_new = value;
                        }
 
 
-                       /* if property is an OperatorProperties pointer and value is a map, forward back to pyrna_pydict_to_props */
+                       /* 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);
                        }
 
                        /* another exception, allow to pass a collection as an RNA property */
-                       if (Py_TYPE(value)==&pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
+                       if (Py_TYPE(value) == &pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
                                PointerRNA c_ptr;
-                               BPy_PropertyRNA *value_prop= (BPy_PropertyRNA *)value;
+                               BPy_PropertyRNA *value_prop = (BPy_PropertyRNA *)value;
                                if (RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
-                                       value= pyrna_struct_CreatePyObject(&c_ptr);
-                                       value_new= value;
+                                       value = pyrna_struct_CreatePyObject(&c_ptr);
+                                       value_new = value;
                                }
                                else {
                                        PyErr_Format(PyExc_TypeError,
@@ -1728,7 +1730,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                             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),
@@ -1736,30 +1740,30 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                Py_XDECREF(value_new); return -1;
                        }
                        else {
-                               BPy_StructRNA *param= (BPy_StructRNA*)value;
-                               int raise_error= FALSE;
+                               BPy_StructRNA *param = (BPy_StructRNA *)value;
+                               int raise_error = FALSE;
                                if (data) {
 
                                        if (flag & PROP_RNAPTR) {
                                                if (value == Py_None)
                                                        memset(data, 0, sizeof(PointerRNA));
                                                else
-                                                       *((PointerRNA*)data)= param->ptr;
+                                                       *((PointerRNA *)data)= param->ptr;
                                        }
                                        else if (value == Py_None) {
-                                               *((void**)data)= NULL;
+                                               *((void **)data)= NULL;
                                        }
                                        else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
-                                               *((void**)data)= param->ptr.data;
+                                               *((void **)data)= param->ptr.data;
                                        }
                                        else {
-                                               raise_error= TRUE;
+                                               raise_error = TRUE;
                                        }
                                }
                                else {
-                                       /* data==NULL, assign to RNA */
+                                       /* data == NULL, assign to RNA */
                                        if (value == Py_None) {
-                                               PointerRNA valueptr= {{NULL}};
+                                               PointerRNA valueptr = {{NULL}};
                                                RNA_property_pointer_set(ptr, prop, valueptr);
                                        }
                                        else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
@@ -1801,7 +1805,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                        ListBase *lb;
                        CollectionPointerLink *link;
 
-                       lb= (data)? (ListBase*)data: NULL;
+                       lb = (data) ? (ListBase *)data : NULL;
 
                        /* convert a sequence of dict's into a collection */
                        if (!PySequence_Check(value)) {
@@ -1812,11 +1816,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                return -1;
                        }
 
-                       seq_len= PySequence_Size(value);
-                       for (i=0; i < seq_len; i++) {
-                               item= PySequence_GetItem(value, i);
+                       seq_len = PySequence_Size(value);
+                       for (i = 0; i < seq_len; i++) {
+                               item = PySequence_GetItem(value, i);
 
-                               if (item==NULL) {
+                               if (item == NULL) {
                                        PyErr_Format(PyExc_TypeError,
                                                     "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
                                                     error_prefix, RNA_struct_identifier(ptr->type),
@@ -1825,7 +1829,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                        return -1;
                                }
 
-                               if (PyDict_Check(item)==0) {
+                               if (PyDict_Check(item) == 0) {
                                        PyErr_Format(PyExc_TypeError,
                                                     "%.200s %.200s.%.200s expected a each sequence "
                                                     "member to be a dict for an RNA collection, not %.200s",
@@ -1836,16 +1840,16 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                }
 
                                if (lb) {
-                                       link= MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
-                                       link->ptr= itemptr;
+                                       link = MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
+                                       link->ptr = itemptr;
                                        BLI_addtail(lb, link);
                                }
                                else
                                        RNA_property_collection_add(ptr, prop, &itemptr);
 
-                               if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) {
-                                       PyObject *msg= PyC_ExceptionBuffer();
-                                       const char *msg_char= _PyUnicode_AsString(msg);
+                               if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection") == -1) {
+                                       PyObject *msg = PyC_ExceptionBuffer();
+                                       const char *msg_char = _PyUnicode_AsString(msg);
 
                                        PyErr_Format(PyExc_TypeError,
                                                     "%.200s %.200s.%.200s error converting a member of a collection "
@@ -1888,17 +1892,17 @@ 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;
-       PointerRNA *ptr= &self->ptr;
-       PropertyRNA *prop= self->prop;
+       int ret = 0;
+       PointerRNA *ptr = &self->ptr;
+       PropertyRNA *prop = self->prop;
 
-       const int totdim= RNA_property_array_dimension(ptr, prop, NULL);
+       const int totdim = RNA_property_array_dimension(ptr, prop, NULL);
 
        if (totdim > 1) {
                /* char error_str[512]; */
                if (pyrna_py_to_array_index(&self->ptr, self->prop, self->arraydim, self->arrayoffset, index, value, "") == -1) {
                        /* error is set */
-                       ret= -1;
+                       ret = -1;
                }
        }
        else {
@@ -1906,11 +1910,11 @@ 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;
+                                       ret = -1;
                                }
                                else {
                                        RNA_property_boolean_set_index(ptr, prop, index, param);
@@ -1919,10 +1923,10 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
                        }
                case PROP_INT:
                        {
-                               int param= PyLong_AsLong(value);
-                               if (param==-1 && PyErr_Occurred()) {
+                               int param = PyLong_AsLong(value);
+                               if (param == -1 && PyErr_Occurred()) {
                                        PyErr_SetString(PyExc_TypeError, "expected an int type");
-                                       ret= -1;
+                                       ret = -1;
                                }
                                else {
                                        RNA_property_int_clamp(ptr, prop, &param);
@@ -1932,10 +1936,10 @@ 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;
+                                       ret = -1;
                                }
                                else {
                                        RNA_property_float_clamp(ptr, prop, &param);
@@ -1945,7 +1949,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;
                }
        }
@@ -1994,7 +1998,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;
 }
@@ -2018,7 +2022,7 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
 static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
 {
        PointerRNA newptr;
-       Py_ssize_t keynum_abs= keynum;
+       Py_ssize_t keynum_abs = keynum;
 
        PYRNA_PROP_CHECK_OBJ(self);
 
@@ -2028,7 +2032,7 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
                return pyrna_struct_CreatePyObject(&newptr);
        }
        else {
-               const int len= RNA_property_collection_length(&self->ptr, self->prop);
+               const int len = RNA_property_collection_length(&self->ptr, self->prop);
                if (keynum_abs >= len) {
                        PyErr_Format(PyExc_IndexError,
                                     "bpy_prop_collection[index]: "
@@ -2048,15 +2052,15 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
 /* values type must have been already checked */
 static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value)
 {
-       Py_ssize_t keynum_abs= keynum;
-       const PointerRNA *ptr= (value == Py_None) ? (&PointerRNA_NULL) : &((BPy_StructRNA *)value)->ptr;
+       Py_ssize_t keynum_abs = keynum;
+       const PointerRNA *ptr = (value == Py_None) ? (&PointerRNA_NULL) : &((BPy_StructRNA *)value)->ptr;
 
        PYRNA_PROP_CHECK_INT(self);
 
        PYRNA_PROP_COLLECTION_ABS_INDEX(-1);
 
        if (RNA_property_collection_assign_int(&self->ptr, self->prop, keynum_abs, ptr) == 0) {
-               const int len= RNA_property_collection_length(&self->ptr, self->prop);
+               const int len = RNA_property_collection_length(&self->ptr, self->prop);
                if (keynum_abs >= len) {
                        PyErr_Format(PyExc_IndexError,
                                     "bpy_prop_collection[index] = value: "
@@ -2080,7 +2084,7 @@ static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int
 
        PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
 
-       len= pyrna_prop_array_length(self);
+       len = pyrna_prop_array_length(self);
 
        if (keynum < 0) keynum += len;
 
@@ -2135,24 +2139,24 @@ int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyOb
                             err_prefix, RNA_struct_identifier(self->ptr.type));
                return -1;
        }
-       else if ((keyname= _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == NULL) {
+       else if ((keyname = _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == NULL) {
                PyErr_Format(PyExc_KeyError,
                             "%s: id must be a string, not %.200s",
                             err_prefix, Py_TYPE(PyTuple_GET_ITEM(key, 0))->tp_name);
                return -1;
        }
        else {
-               PyObject *keylib= PyTuple_GET_ITEM(key, 1);
+               PyObject *keylib = PyTuple_GET_ITEM(key, 1);
                Library *lib;
-               int found= FALSE;
+               int found = FALSE;
 
                if (keylib == Py_None) {
-                       lib= NULL;
+                       lib = NULL;
                }
                else if (PyUnicode_Check(keylib)) {
-                       Main *bmain= self->ptr.data;
-                       const char *keylib_str= _PyUnicode_AsString(keylib);
-                       lib= BLI_findstring(&bmain->library, keylib_str, offsetof(Library, name));
+                       Main *bmain = self->ptr.data;
+                       const char *keylib_str = _PyUnicode_AsString(keylib);
+                       lib = BLI_findstring(&bmain->library, keylib_str, offsetof(Library, name));
                        if (lib == NULL) {
                                if (err_not_found) {
                                        PyErr_Format(PyExc_KeyError,
@@ -2178,11 +2182,11 @@ int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyOb
                 * either way can do direct comparison with id.lib */
 
                RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
-                       ID *id= itemptr.data; /* always an ID */
-                       if (id->lib == lib && (strncmp(keyname, id->name+2, sizeof(id->name)-2) == 0)) {
-                               found= TRUE;
+                       ID *id = itemptr.data; /* always an ID */
+                       if (id->lib == lib && (strncmp(keyname, id->name + 2, sizeof(id->name) - 2) == 0)) {
+                               found = TRUE;
                                if (r_ptr) {
-                                       *r_ptr= itemptr;
+                                       *r_ptr = itemptr;
                                }
                                break;
                        }
@@ -2206,7 +2210,7 @@ static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *s
                                                               const char *err_prefix, const short err_not_found)
 {
        PointerRNA ptr;
-       const int contains= pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key, err_prefix, err_not_found, &ptr);
+       const int contains = pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key, err_prefix, err_not_found, &ptr);
 
        if (contains == 1) {
                return pyrna_struct_CreatePyObject(&ptr);
@@ -2220,21 +2224,21 @@ static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *s
 static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py_ssize_t start, Py_ssize_t stop)
 {
        CollectionPropertyIterator rna_macro_iter;
-       int count= 0;
+       int count = 0;
 
        PyObject *list;
        PyObject *item;
 
        PYRNA_PROP_CHECK_OBJ(self);
 
-       list= PyList_New(0);
+       list = PyList_New(0);
 
        /* first loop up-until the start */
        for (RNA_property_collection_begin(&self->ptr, self->prop, &rna_macro_iter);
             rna_macro_iter.valid;
             RNA_property_collection_next(&rna_macro_iter))
        {
-               /* PointerRNA itemptr= rna_macro_iter.ptr; */
+               /* PointerRNA itemptr = rna_macro_iter.ptr; */
                if (count == start) {
                        break;
                }
@@ -2245,7 +2249,7 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py
        for (; rna_macro_iter.valid;
             RNA_property_collection_next(&rna_macro_iter))
        {
-               item= pyrna_struct_CreatePyObject(&rna_macro_iter.ptr);
+               item = pyrna_struct_CreatePyObject(&rna_macro_iter.ptr);
                PyList_Append(list, item);
                Py_DECREF(item);
 
@@ -2272,14 +2276,14 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 
        PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
 
-       tuple= PyTuple_New(stop - start);
+       tuple = PyTuple_New(stop - start);
 
        /* PYRNA_PROP_CHECK_OBJ(self); isn't 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 {
@@ -2288,11 +2292,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
                        {
                                float values_stack[PYRNA_STACK_ARRAY];
                                float *values;
-                               if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(float) * length); }
-                               else                            { values= values_stack; }
+                               if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(float) * length); }
+                               else                            { values = values_stack; }
                                RNA_property_float_get_array(ptr, prop, values);
 
-                               for (count=start; count<stop; count++)
+                               for (count = start; count < stop; count++)
                                        PyTuple_SET_ITEM(tuple, count-start, PyFloat_FromDouble(values[count]));
 
                                if (values != values_stack) {
@@ -2304,11 +2308,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
                        {
                                int values_stack[PYRNA_STACK_ARRAY];
                                int *values;
-                               if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); }
-                               else                            { values= values_stack; }
+                               if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); }
+                               else                            { values = values_stack; }
 
                                RNA_property_boolean_get_array(ptr, prop, values);
-                               for (count=start; count<stop; count++)
+                               for (count = start; count < stop; count++)
                                        PyTuple_SET_ITEM(tuple, count-start, PyBool_FromLong(values[count]));
 
                                if (values != values_stack) {
@@ -2320,11 +2324,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
                        {
                                int values_stack[PYRNA_STACK_ARRAY];
                                int *values;
-                               if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); }
-                               else                            { values= values_stack; }
+                               if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); }
+                               else                            { values = values_stack; }
 
                                RNA_property_int_get_array(ptr, prop, values);
-                               for (count=start; count<stop; count++)
+                               for (count = start; count < stop; count++)
                                        PyTuple_SET_ITEM(tuple, count-start, PyLong_FromSsize_t(values[count]));
 
                                if (values != values_stack) {
@@ -2337,7 +2341,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 
                        PyErr_SetString(PyExc_TypeError, "not an array type");
                        Py_DECREF(tuple);
-                       tuple= NULL;
+                       tuple = NULL;
                }
        }
        return tuple;
@@ -2351,15 +2355,15 @@ 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;
 
                return pyrna_prop_collection_subscript_int(self, i);
        }
        else if (PySlice_Check(key)) {
-               PySliceObject *key_slice= (PySliceObject *)key;
-               Py_ssize_t step= 1;
+               PySliceObject *key_slice = (PySliceObject *)key;
+               Py_ssize_t step = 1;
 
                if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
                        return NULL;
@@ -2372,7 +2376,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
                        return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
                }
                else {
-                       Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX;
+                       Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
                        /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
                        if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
@@ -2380,7 +2384,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
 
                        if (start < 0 || stop < 0) {
                                /* only get the length for negative values */
-                               Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
+                               Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
                                if (start < 0) start += len;
                                if (stop < 0) start += len;
                        }
@@ -2431,8 +2435,8 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
                             Py_TYPE(value)->tp_name);
                return -1;
        }
-       else if ((prop_srna= RNA_property_pointer_type(&self->ptr, self->prop))) {
-               StructRNA *value_srna= ((BPy_StructRNA *)value)->ptr.type;
+       else if ((prop_srna = RNA_property_pointer_type(&self->ptr, self->prop))) {
+               StructRNA *value_srna = ((BPy_StructRNA *)value)->ptr.type;
                if (RNA_struct_is_a(value_srna, prop_srna) == 0) {
                        PyErr_Format(PyExc_TypeError,
                                     "bpy_prop_collection[key] = value: invalid, "
@@ -2476,7 +2480,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
        else
 #endif
        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 -1;
 
@@ -2484,8 +2488,8 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
        }
 #if 0 /* TODO, fake slice assignment */
        else if (PySlice_Check(key)) {
-               PySliceObject *key_slice= (PySliceObject *)key;
-               Py_ssize_t step= 1;
+               PySliceObject *key_slice = (PySliceObject *)key;
+               Py_ssize_t step = 1;
 
                if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
                        return NULL;
@@ -2498,7 +2502,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
                        return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
                }
                else {
-                       Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX;
+                       Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
                        /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
                        if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start))       return NULL;
@@ -2506,7 +2510,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
 
                        if (start < 0 || stop < 0) {
                                /* only get the length for negative values */
-                               Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
+                               Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
                                if (start < 0) start += len;
                                if (stop < 0) start += len;
                        }
@@ -2538,14 +2542,14 @@ static PyObject *pyrna_prop_array_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())
                        return NULL;
                return pyrna_prop_array_subscript_int(self, PyLong_AsLong(key));
        }
        else if (PySlice_Check(key)) {
-               Py_ssize_t step= 1;
-               PySliceObject *key_slice= (PySliceObject *)key;
+               Py_ssize_t step = 1;
+               PySliceObject *key_slice = (PySliceObject *)key;
 
                if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
                        return NULL;
@@ -2556,11 +2560,11 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
                }
                else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
                        /* note, no significant advantage with optimizing [:] slice as with collections but include here for consistency with collection slice func */
-                       Py_ssize_t len= (Py_ssize_t)pyrna_prop_array_length(self);
+                       Py_ssize_t len = (Py_ssize_t)pyrna_prop_array_length(self);
                        return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
                }
                else {
-                       int len= pyrna_prop_array_length(self);
+                       int len = pyrna_prop_array_length(self);
                        Py_ssize_t start, stop, slicelength;
 
                        if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0)
@@ -2586,23 +2590,23 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
 {
        PyObject *value;
        int count;
-       void *values_alloc= NULL;
-       int ret= 0;
+       void *values_alloc = NULL;
+       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");
+                               "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");
+                               "bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported");
                return -1;
        }
 
@@ -2615,18 +2619,18 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
                        float min, max;
                        RNA_property_float_range(ptr, prop, &min, &max);
 
-                       if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(float) * length); }
-                       else                            { values= values_stack; }
+                       if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(float) * length); }
+                       else                            { values = values_stack; }
                        if (start != 0 || stop != length) /* partial assignment? - need to get the array */
                                RNA_property_float_get_array(ptr, prop, values);
 
-                       for (count=start; count<stop; count++) {
-                               fval= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
+                       for (count = start; count < stop; count++) {
+                               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;
+                       if (PyErr_Occurred()) ret = -1;
                        else                  RNA_property_float_set_array(ptr, prop, values);
                        break;
                }
@@ -2634,16 +2638,16 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
                {
                        int values_stack[PYRNA_STACK_ARRAY];
                        int *values;
-                       if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); }
-                       else                            { values= values_stack; }
+                       if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(int) * length); }
+                       else                            { values = values_stack; }
 
                        if (start != 0 || stop != length) /* partial assignment? - need to get the array */
                                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));
+                       for (count = start; count < stop; count++)
+                               values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
 
-                       if (PyErr_Occurred()) ret= -1;
+                       if (PyErr_Occurred()) ret = -1;
                        else                  RNA_property_boolean_set_array(ptr, prop, values);
                        break;
                }
@@ -2655,25 +2659,25 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
                        int min, max;
                        RNA_property_int_range(ptr, prop, &min, &max);
 
-                       if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); }
-                       else                            { values= values_stack; }
+                       if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(int) * length); }
+                       else                            { values = values_stack; }
 
                        if (start != 0 || stop != length) /* partial assignment? - need to get the array */
                                RNA_property_int_get_array(ptr, prop, values);
 
-                       for (count=start; count<stop; count++) {
-                               ival= PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+                       for (count = start; count < stop; count++) {
+                               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;
+                       if (PyErr_Occurred()) ret = -1;
                        else                  RNA_property_int_set_array(ptr, prop, values);
     &