diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-19 14:12:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-19 14:12:48 +0300 |
commit | cadc1218c8c8932464eacf0d6a75330e8ac45266 (patch) | |
tree | 41761e87faedb7bcd1d0c86237df690ff4f3b5af /source/blender/python/generic | |
parent | ff1656175ac6a408bef1b77abd91406cdf895c93 (diff) |
C, style changes (mostly white space edits), no functional change.
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r-- | source/blender/python/generic/IDProp.c | 33 | ||||
-rw-r--r-- | source/blender/python/generic/bgl.c | 18 | ||||
-rw-r--r-- | source/blender/python/generic/bpy_internal_import.c | 134 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils.c | 22 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_Color.c | 11 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_Euler.c | 11 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_Matrix.c | 48 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_Quaternion.c | 23 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_Vector.c | 55 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_geometry.c | 14 | ||||
-rw-r--r-- | source/blender/python/generic/noise_py_api.c | 4 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 6 |
12 files changed, 211 insertions, 168 deletions
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 58b3f972a67..36dc6fca503 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -316,10 +316,12 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g if (PyFloat_Check(ob)) { val.d = PyFloat_AsDouble(ob); prop = IDP_New(IDP_DOUBLE, val, name); - } else if (PyLong_Check(ob)) { + } + else if (PyLong_Check(ob)) { val.i = (int) PyLong_AsSsize_t(ob); prop = IDP_New(IDP_INT, val, name); - } else if (PyUnicode_Check(ob)) { + } + else if (PyUnicode_Check(ob)) { #ifdef USE_STRING_COERCE PyObject *value_coerce= NULL; val.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce); @@ -329,7 +331,8 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g val.str = _PyUnicode_AsString(ob); prop = IDP_New(IDP_STRING, val, name); #endif - } else if (PySequence_Check(ob)) { + } + else if (PySequence_Check(ob)) { PyObject *item; int i; @@ -372,7 +375,8 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g } break; } - } else if (PyMapping_Check(ob)) { + } + else if (PyMapping_Check(ob)) { PyObject *keys, *vals, *key, *pval; int i, len; /*yay! we get into recursive stuff now!*/ @@ -409,13 +413,15 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g } Py_XDECREF(keys); Py_XDECREF(vals); - } else return "invalid property value"; + } + else return "invalid property value"; if(group->type==IDP_IDPARRAY) { IDP_AppendArray(group, prop); // IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory MEM_freeN(prop); - } else { + } + else { IDP_ReplaceInGroup(group, prop); } @@ -436,7 +442,8 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val) IDP_FreeProperty(pkey); MEM_freeN(pkey); return 0; - } else { + } + else { PyErr_SetString(PyExc_KeyError, "property not found in group"); return -1; } @@ -507,10 +514,12 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) if (prop->subtype == IDP_FLOAT) { PyList_SET_ITEM(seq, i, PyFloat_FromDouble(((float*)prop->data.pointer)[i])); - } else if (prop->subtype == IDP_DOUBLE) { + } + else if (prop->subtype == IDP_DOUBLE) { PyList_SET_ITEM(seq, i, PyFloat_FromDouble(((double*)prop->data.pointer)[i])); - } else { + } + else { PyList_SET_ITEM(seq, i, PyLong_FromLong(((int*)prop->data.pointer)[i])); } @@ -1092,10 +1101,12 @@ static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self) PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(cur->name)); PyTuple_SET_ITEM(ret, 1, BPy_IDGroup_WrapData(self->group->id, cur)); return ret; - } else { + } + else { return PyUnicode_FromString(cur->name); } - } else { + } + else { PyErr_SetString(PyExc_StopIteration, "iterator at end"); return NULL; } diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index e47ea1a53b7..2c15755a642 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -170,7 +170,8 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf if (initbuffer) { memcpy(buffer->buf.asvoid, initbuffer, length*size); - } else { + } + else { memset(buffer->buf.asvoid, 0, length*size); /* for (i= 0; i<length; i++) { @@ -280,7 +281,8 @@ static PyObject *Buffer_item(PyObject *self, int i) case GL_FLOAT: return PyFloat_FromDouble(buf->buf.asfloat[i]); case GL_DOUBLE: return Py_BuildValue("d", buf->buf.asdouble[i]); } - } else { + } + else { Buffer *newbuf; int j, length, size; @@ -350,17 +352,21 @@ static int Buffer_ass_item(PyObject *self, int i, PyObject *v) if (buf->type==GL_BYTE) { if (!PyArg_Parse(v, "b:Coordinates must be ints", &buf->buf.asbyte[i])) return -1; - } else if (buf->type==GL_SHORT) { + } + else if (buf->type==GL_SHORT) { if (!PyArg_Parse(v, "h:Coordinates must be ints", &buf->buf.asshort[i])) return -1; - } else if (buf->type==GL_INT) { + } + else if (buf->type==GL_INT) { if (!PyArg_Parse(v, "i:Coordinates must be ints", &buf->buf.asint[i])) return -1; - } else if (buf->type==GL_FLOAT) { + } + else if (buf->type==GL_FLOAT) { if (!PyArg_Parse(v, "f:Coordinates must be floats", &buf->buf.asfloat[i])) return -1; - } else if (buf->type==GL_DOUBLE) { + } + else if (buf->type==GL_DOUBLE) { if (!PyArg_Parse(v, "d:Coordinates must be floats", &buf->buf.asdouble[i])) return -1; } diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index e0af6e085eb..f4d88b33a48 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -58,7 +58,7 @@ static Main *bpy_import_main= NULL; static void free_compiled_text(Text *text) { if(text->compiled) { - Py_DECREF(( PyObject * )text->compiled); + Py_DECREF((PyObject *)text->compiled); } text->compiled= NULL; } @@ -81,23 +81,23 @@ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text) PyObject *bpy_text_import(Text *text) { - char *buf = NULL; + char *buf= NULL; char modulename[24]; int len; - if( !text->compiled ) { + if(!text->compiled) { char fn_dummy[256]; bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text); - buf = txt_to_buf( text ); - text->compiled = Py_CompileString( buf, fn_dummy, Py_file_input ); - MEM_freeN( buf ); + buf= txt_to_buf(text); + text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input); + MEM_freeN(buf); - if( PyErr_Occurred( ) ) { - PyErr_Print( ); - PyErr_Clear( ); + if(PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); PySys_SetObject("last_traceback", NULL); - free_compiled_text( text ); + free_compiled_text(text); return NULL; } } @@ -108,11 +108,11 @@ PyObject *bpy_text_import(Text *text) return PyImport_ExecCodeModule(modulename, text->compiled); } -PyObject *bpy_text_import_name( char *name, int *found ) +PyObject *bpy_text_import_name(char *name, int *found) { Text *text; char txtname[22]; /* 21+NULL */ - int namelen = strlen( name ); + int namelen= strlen(name); //XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main; Main *maggie= bpy_import_main; @@ -125,15 +125,15 @@ PyObject *bpy_text_import_name( char *name, int *found ) if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */ - memcpy( txtname, name, namelen ); - memcpy( &txtname[namelen], ".py", 4 ); + memcpy(txtname, name, namelen); + memcpy(&txtname[namelen], ".py", 4); text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2); - if( !text ) + if(!text) return NULL; else - *found = 1; + *found= 1; return bpy_text_import(text); } @@ -143,12 +143,12 @@ PyObject *bpy_text_import_name( char *name, int *found ) * find in-memory module and recompile */ -PyObject *bpy_text_reimport( PyObject *module, int *found ) +PyObject *bpy_text_reimport(PyObject *module, int *found) { Text *text; const char *name; char *filepath; - char *buf = NULL; + char *buf= NULL; //XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main; Main *maggie= bpy_import_main; @@ -170,50 +170,50 @@ PyObject *bpy_text_reimport( PyObject *module, int *found ) text= BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2); /* uh-oh.... didn't find it */ - if( !text ) + if(!text) return NULL; else - *found = 1; + *found= 1; /* if previously compiled, free the object */ /* (can't see how could be NULL, but check just in case) */ - if( text->compiled ){ - Py_DECREF( (PyObject *)text->compiled ); + if(text->compiled){ + Py_DECREF((PyObject *)text->compiled); } /* compile the buffer */ - buf = txt_to_buf( text ); - text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input ); - MEM_freeN( buf ); + buf= txt_to_buf(text); + text->compiled= Py_CompileString(buf, text->id.name+2, Py_file_input); + MEM_freeN(buf); /* if compile failed.... return this error */ - if( PyErr_Occurred( ) ) { - PyErr_Print( ); - PyErr_Clear( ); + if(PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); PySys_SetObject("last_traceback", NULL); - free_compiled_text( text ); + free_compiled_text(text); return NULL; } /* make into a module */ - return PyImport_ExecCodeModule( (char *)name, text->compiled ); + return PyImport_ExecCodeModule((char *)name, text->compiled); } -static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw) +static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw) { PyObject *exception, *err, *tb; char *name; int found= 0; - PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; + PyObject *globals= NULL, *locals= NULL, *fromlist= NULL; int level= -1; /* relative imports */ PyObject *newmodule; //PyObject_Print(args, stderr, 0); - static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL}; + static const char *kwlist[]= {"name", "globals", "locals", "fromlist", "level", NULL}; - if( !PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, - &name, &globals, &locals, &fromlist, &level) ) + if(!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, + &name, &globals, &locals, &fromlist, &level)) return NULL; /* import existing builtin modules or modules that have been imported already */ @@ -222,28 +222,28 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObjec if(newmodule) return newmodule; - PyErr_Fetch( &exception, &err, &tb ); /* get the python error incase we cant import as blender text either */ + PyErr_Fetch(&exception, &err, &tb); /* get the python error incase we cant import as blender text either */ /* importing from existing modules failed, see if we have this module as blender text */ - newmodule = bpy_text_import_name( name, &found ); + newmodule= bpy_text_import_name(name, &found); - if( newmodule ) {/* found module as blender text, ignore above exception */ - PyErr_Clear( ); - Py_XDECREF( exception ); - Py_XDECREF( err ); - Py_XDECREF( tb ); - /* printf( "imported from text buffer...\n" ); */ + if(newmodule) {/* found module as blender text, ignore above exception */ + PyErr_Clear(); + Py_XDECREF(exception); + Py_XDECREF(err); + Py_XDECREF(tb); + /* printf("imported from text buffer...\n"); */ } else if (found==1) { /* blender text module failed to execute but was found, use its error message */ - Py_XDECREF( exception ); - Py_XDECREF( err ); - Py_XDECREF( tb ); + Py_XDECREF(exception); + Py_XDECREF(err); + Py_XDECREF(tb); return NULL; } else { /* no blender text was found that could import the module * rause the original error from PyImport_ImportModuleEx */ - PyErr_Restore( exception, err, tb ); + PyErr_Restore(exception, err, tb); } return newmodule; } @@ -256,42 +256,42 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObjec static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module) { PyObject *exception, *err, *tb; - PyObject *newmodule = NULL; + PyObject *newmodule= NULL; int found= 0; /* try reimporting from file */ - newmodule = PyImport_ReloadModule( module ); - if( newmodule ) + newmodule= PyImport_ReloadModule(module); + if(newmodule) return newmodule; /* no file, try importing from memory */ - PyErr_Fetch( &exception, &err, &tb ); /*restore for probable later use */ - - newmodule = bpy_text_reimport( module, &found ); - if( newmodule ) {/* found module as blender text, ignore above exception */ - PyErr_Clear( ); - Py_XDECREF( exception ); - Py_XDECREF( err ); - Py_XDECREF( tb ); - /* printf( "imported from text buffer...\n" ); */ + PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */ + + newmodule= bpy_text_reimport(module, &found); + if(newmodule) {/* found module as blender text, ignore above exception */ + PyErr_Clear(); + Py_XDECREF(exception); + Py_XDECREF(err); + Py_XDECREF(tb); + /* printf("imported from text buffer...\n"); */ } else if (found==1) { /* blender text module failed to execute but was found, use its error message */ - Py_XDECREF( exception ); - Py_XDECREF( err ); - Py_XDECREF( tb ); + Py_XDECREF(exception); + Py_XDECREF(err); + Py_XDECREF(tb); return NULL; } else { /* no blender text was found that could import the module * rause the original error from PyImport_ImportModuleEx */ - PyErr_Restore( exception, err, tb ); + PyErr_Restore(exception, err, tb); } return newmodule; } -PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"}; -PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"}; +PyMethodDef bpy_import_meth= {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"}; +PyMethodDef bpy_reload_meth= {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"}; /* Clear user modules. @@ -327,7 +327,7 @@ void bpy_text_clear_modules(int clear_all) /* looping over the dict */ PyObject *key, *value; - int pos = 0; + int pos= 0; /* new list */ PyObject *list; @@ -344,7 +344,7 @@ void bpy_text_clear_modules(int clear_all) fname= PyModule_GetFilename(value); if(fname) { if (clear_all || ((strstr(fname, SEPSTR))==0)) { /* no path ? */ - file_extension = strstr(fname, ".py"); + file_extension= strstr(fname, ".py"); if(file_extension && (*(file_extension + 3) == '\0' || *(file_extension + 4) == '\0')) { /* .py or pyc extension? */ /* now we can be fairly sure its a python import from the blendfile */ PyList_Append(list, key); /* free'd with the list */ diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index 1319c670093..7cb1728f817 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -315,28 +315,28 @@ PyMODINIT_FUNC BPyInit_mathutils(void) PyObject *submodule; PyObject *item; - if( PyType_Ready( &vector_Type ) < 0 ) + if(PyType_Ready(&vector_Type) < 0) return NULL; - if( PyType_Ready( &matrix_Type ) < 0 ) + if(PyType_Ready(&matrix_Type) < 0) return NULL; - if( PyType_Ready( &euler_Type ) < 0 ) + if(PyType_Ready(&euler_Type) < 0) return NULL; - if( PyType_Ready( &quaternion_Type ) < 0 ) + if(PyType_Ready(&quaternion_Type) < 0) return NULL; - if( PyType_Ready( &color_Type ) < 0 ) + if(PyType_Ready(&color_Type) < 0) return NULL; submodule = PyModule_Create(&M_Mathutils_module_def); /* each type has its own new() function */ - PyModule_AddObject( submodule, "Vector", (PyObject *)&vector_Type ); - PyModule_AddObject( submodule, "Matrix", (PyObject *)&matrix_Type ); - PyModule_AddObject( submodule, "Euler", (PyObject *)&euler_Type ); - PyModule_AddObject( submodule, "Quaternion", (PyObject *)&quaternion_Type ); - PyModule_AddObject( submodule, "Color", (PyObject *)&color_Type ); + PyModule_AddObject(submodule, "Vector", (PyObject *)&vector_Type); + PyModule_AddObject(submodule, "Matrix", (PyObject *)&matrix_Type); + PyModule_AddObject(submodule, "Euler", (PyObject *)&euler_Type); + PyModule_AddObject(submodule, "Quaternion", (PyObject *)&quaternion_Type); + PyModule_AddObject(submodule, "Color", (PyObject *)&color_Type); /* submodule */ - PyModule_AddObject( submodule, "geometry", (item=BPyInit_mathutils_geometry())); + PyModule_AddObject(submodule, "geometry", (item=BPyInit_mathutils_geometry())); /* XXX, python doesnt do imports with this usefully yet * 'from mathutils.geometry import PolyFill' * ...fails without this. */ diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/generic/mathutils_Color.c index aa5d6e1b817..2b68828ea0a 100644 --- a/source/blender/python/generic/mathutils_Color.c +++ b/source/blender/python/generic/mathutils_Color.c @@ -243,7 +243,7 @@ static int Color_ass_slice(ColorObject * self, int begin, int end, PyObject * se CLAMP(begin, 0, COLOR_SIZE); if (end<0) end= (COLOR_SIZE + 1) + end; CLAMP(end, 0, COLOR_SIZE); - begin = MIN2(begin,end); + begin = MIN2(begin, end); if((size=mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1) return -1; @@ -270,7 +270,8 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item) if (i < 0) i += COLOR_SIZE; return Color_item(self, i); - } else if (PySlice_Check(item)) { + } + else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0) @@ -343,7 +344,7 @@ static PyMappingMethods Color_AsMapping = { }; /* color channel, vector.r/g/b */ -static PyObject *Color_getChannel( ColorObject * self, void *type ) +static PyObject *Color_getChannel(ColorObject * self, void *type) { return Color_item(self, GET_INT_FROM_POINTER(type)); } @@ -354,7 +355,7 @@ static int Color_setChannel(ColorObject * self, PyObject * value, void * type) } /* color channel (HSV), color.h/s/v */ -static PyObject *Color_getChannelHSV( ColorObject * self, void *type ) +static PyObject *Color_getChannelHSV(ColorObject * self, void *type) { float hsv[3]; int i= GET_INT_FROM_POINTER(type); @@ -445,7 +446,7 @@ static PyGetSetDef Color_getseters[] = { {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL}, - {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/generic/mathutils_Euler.c index 13a93260267..d8dd4e5fbb3 100644 --- a/source/blender/python/generic/mathutils_Euler.c +++ b/source/blender/python/generic/mathutils_Euler.c @@ -199,7 +199,7 @@ static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args) const char *axis; if(!PyArg_ParseTuple(args, "sf:rotate", &axis, &angle)){ - PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x,y,z)"); + PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x, y, z)"); return NULL; } if(!(ELEM3(*axis, 'X', 'Y', 'Z') && axis[1]=='\0')){ @@ -428,7 +428,7 @@ static int Euler_ass_slice(EulerObject * self, int begin, int end, PyObject * se CLAMP(begin, 0, EULER_SIZE); if (end<0) end= (EULER_SIZE + 1) + end; CLAMP(end, 0, EULER_SIZE); - begin = MIN2(begin,end); + begin = MIN2(begin, end); if((size=mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1) return -1; @@ -455,7 +455,8 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item) if (i < 0) i += EULER_SIZE; return Euler_item(self, i); - } else if (PySlice_Check(item)) { + } + else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0) @@ -531,7 +532,7 @@ static PyMappingMethods Euler_AsMapping = { /* * euler axis, euler.x/y/z */ -static PyObject *Euler_getAxis(EulerObject *self, void *type ) +static PyObject *Euler_getAxis(EulerObject *self, void *type) { return Euler_item(self, GET_INT_FROM_POINTER(type)); } @@ -574,7 +575,7 @@ static PyGetSetDef Euler_getseters[] = { {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL}, - {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index 8ff38205819..c048058f63c 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -114,7 +114,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = { /* matrix vector callbacks, this is so you can do matrix[i][j] = val */ //----------------------------------mathutils.Matrix() ----------------- -//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. +//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. //create a new matrix type static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { @@ -185,7 +185,7 @@ static void matrix_3x3_as_4x4(float mat[16]) /*-----------------------CLASS-METHODS----------------------------*/ -//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. +//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. static char C_Matrix_Rotation_doc[] = ".. classmethod:: Rotation(angle, size, axis)\n" "\n" @@ -257,21 +257,24 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) mat[1] = (float) sin (angle); mat[2] = -((float) sin(angle)); mat[3] = (float) cos(angle); - } else if(strcmp(axis, "X") == 0) { + } + else if(strcmp(axis, "X") == 0) { //rotation around X mat[0] = 1.0f; mat[4] = (float) cos(angle); mat[5] = (float) sin(angle); mat[7] = -((float) sin(angle)); mat[8] = (float) cos(angle); - } else if(strcmp(axis, "Y") == 0) { + } + else if(strcmp(axis, "Y") == 0) { //rotation around Y mat[0] = (float) cos(angle); mat[2] = -((float) sin(angle)); mat[4] = 1.0f; mat[6] = (float) sin(angle); mat[8] = (float) cos(angle); - } else if(strcmp(axis, "Z") == 0) { + } + else if(strcmp(axis, "Z") == 0) { //rotation around Z mat[0] = (float) cos(angle); mat[1] = (float) sin(angle); @@ -316,7 +319,7 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value) return newMatrixObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls); } //----------------------------------mathutils.Matrix.Scale() ------------- -//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. +//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. static char C_Matrix_Scale_doc[] = ".. classmethod:: Scale(factor, size, axis)\n" "\n" @@ -399,7 +402,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } //----------------------------------mathutils.Matrix.OrthoProjection() --- -//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. +//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. static char C_Matrix_OrthoProjection_doc[] = ".. classmethod:: OrthoProjection(axis, size)\n" "\n" @@ -610,7 +613,8 @@ static float matrix_determinant_internal(MatrixObject *self) if(self->row_size == 2) { return determinant_m2(self->matrix[0][0], self->matrix[0][1], self->matrix[1][0], self->matrix[1][1]); - } else if(self->row_size == 3) { + } + else if(self->row_size == 3) { return determinant_m3(self->matrix[0][0], self->matrix[0][1], self->matrix[0][2], self->matrix[1][0], self->matrix[1][1], self->matrix[1][2], @@ -644,9 +648,10 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self) return NULL; } if(self->col_size == 3){ - mat3_to_quat( quat,(float (*)[3])self->contigPtr); - }else{ - mat4_to_quat( quat,(float (*)[4])self->contigPtr); + mat3_to_quat(quat, (float (*)[3])self->contigPtr); + } + else { + mat4_to_quat(quat, (float (*)[4])self->contigPtr); } return newQuaternionObject(quat, Py_NEW, NULL); @@ -691,10 +696,12 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) /*must be 3-4 cols, 3-4 rows, square matrix*/ if(self->col_size ==3 && self->row_size ==3) { mat= (float (*)[3])self->contigPtr; - }else if (self->col_size ==4 && self->row_size ==4) { + } + else if (self->col_size ==4 && self->row_size ==4) { copy_m3_m4(tmat, (float (*)[4])self->contigPtr); mat= tmat; - }else { + } + else { PyErr_SetString(PyExc_AttributeError, "Matrix.to_euler(): inappropriate matrix size - expects 3x3 or 4x4 matrix"); return NULL; } @@ -707,7 +714,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) } if(eul_compat) { - if(order == 1) mat3_to_compatible_eul( eul, eul_compatf, mat); + if(order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat); else mat3_to_compatible_eulO(eul, eul_compatf, order, mat); } else { @@ -751,7 +758,8 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) index = (4 * (self->row_size + (blank_rows - 1))) + x; if (index == 10 || index == 15){ self->contigPtr[index] = 1.0f; - }else{ + } + else { self->contigPtr[index] = 0.0f; } } @@ -759,7 +767,7 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) for(x = 1; x <= self->row_size; x++){ first_row_elem = (self->col_size * (self->row_size - x)); curr_pos = (first_row_elem + (self->col_size -1)); - new_pos = (4 * (self->row_size - x )) + (curr_pos - first_row_elem); + new_pos = (4 * (self->row_size - x)) + (curr_pos - first_row_elem); for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){ self->contigPtr[new_pos + blank_columns] = 0.0f; } @@ -1346,7 +1354,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) CLAMP(begin, 0, self->row_size); CLAMP(end, 0, self->row_size); - begin= MIN2(begin,end); + begin= MIN2(begin, end); tuple= PyTuple_New(end - begin); for(count= begin; count < end; count++) { @@ -1368,7 +1376,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va CLAMP(begin, 0, self->row_size); CLAMP(end, 0, self->row_size); - begin = MIN2(begin,end); + begin = MIN2(begin, end); /* non list/tuple cases */ if(!(value_fast=PySequence_Fast(value, "matrix[begin:end] = value"))) { @@ -1712,7 +1720,7 @@ static PyGetSetDef Matrix_getseters[] = { {(char *)"is_negative", (getter)Matrix_getIsNegative, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL}, {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner",(getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL}, - {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------METHOD DEFINITIONS ----------------------*/ @@ -1873,7 +1881,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign } } } - else if (rowSize == colSize ) { /*or if no arguments are passed return identity matrix for square matrices */ + else if (rowSize == colSize) { /*or if no arguments are passed return identity matrix for square matrices */ PyObject *ret_dummy= Matrix_identity(self); Py_DECREF(ret_dummy); } diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/generic/mathutils_Quaternion.c index c5fb7e61e6d..75d79d5afac 100644 --- a/source/blender/python/generic/mathutils_Quaternion.c +++ b/source/blender/python/generic/mathutils_Quaternion.c @@ -136,7 +136,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self) if(BaseMath_ReadCallback(self) == -1) return NULL; - quat_to_mat3( (float (*)[3]) mat,self->quat); + quat_to_mat3((float (*)[3])mat, self->quat); return newMatrixObject(mat, 3, 3, Py_NEW, NULL); } @@ -283,7 +283,7 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value) } //----------------------------Quaternion.normalize()---------------- -//normalize the axis of rotation of [theta,vector] +//normalize the axis of rotation of [theta, vector] static char Quaternion_normalize_doc[] = ".. function:: normalize()\n" "\n" @@ -562,7 +562,7 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb CLAMP(begin, 0, QUAT_SIZE); if (end<0) end= (QUAT_SIZE + 1) + end; CLAMP(end, 0, QUAT_SIZE); - begin = MIN2(begin,end); + begin = MIN2(begin, end); if((size=mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1) return -1; @@ -721,7 +721,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) mul_qt_qtqt(quat, quat1->quat, quat2->quat); return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1)); } - /* the only case this can happen (for a supported type is "FLOAT*QUAT" ) */ + /* the only case this can happen (for a supported type is "FLOAT*QUAT") */ else if(quat2) { /* FLOAT*QUAT */ if(((scalar= PyFloat_AsDouble(q1)) == -1.0 && PyErr_Occurred())==0) { return quat_mul_float(quat2, scalar); @@ -811,12 +811,12 @@ static PyNumberMethods Quaternion_NumMethods = { NULL, /* nb_index */ }; -static PyObject *Quaternion_getAxis( QuaternionObject *self, void *type ) +static PyObject *Quaternion_getAxis(QuaternionObject *self, void *type) { return Quaternion_item(self, GET_INT_FROM_POINTER(type)); } -static int Quaternion_setAxis( QuaternionObject *self, PyObject *value, void *type ) +static int Quaternion_setAxis(QuaternionObject *self, PyObject *value, void *type) { return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value); } @@ -864,7 +864,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN angle= fmod(angle + M_PI*2, M_PI*4) - M_PI*2; /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */ - if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && + if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && EXPP_FloatsAreEqual(axis[1], 0.0f, 10) && EXPP_FloatsAreEqual(axis[2], 0.0f, 10) ) { @@ -894,7 +894,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos quat_to_axis_angle(axis, &angle, tquat); /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */ - if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && + if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && EXPP_FloatsAreEqual(axis[1], 0.0f, 10) && EXPP_FloatsAreEqual(axis[2], 0.0f, 10) ) { @@ -1022,7 +1022,7 @@ static PyGetSetDef Quaternion_getseters[] = { {(char *)"axis",(getter)Quaternion_getAxisVec, (setter)Quaternion_setAxisVec, (char *)"quaternion axis as a vector.\n\n:type: :class:`Vector`", NULL}, {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL}, - {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; //------------------PY_OBECT DEFINITION-------------------------- @@ -1103,12 +1103,13 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type) self->quat = PyMem_Malloc(QUAT_SIZE * sizeof(float)); if(!quat) { //new empty unit_qt(self->quat); - }else{ + } + else { QUATCOPY(self->quat, quat); } self->wrapped = Py_NEW; } - else{ + else { PyErr_SetString(PyExc_RuntimeError, "Quaternion(): invalid type"); return NULL; } diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c index ccb81603b3c..0ea380d1ee6 100644 --- a/source/blender/python/generic/mathutils_Vector.c +++ b/source/blender/python/generic/mathutils_Vector.c @@ -228,10 +228,12 @@ static PyObject *Vector_resize_4d(VectorObject *self) PyErr_SetString(PyExc_MemoryError, "vector.resize_4d(): problem allocating pointer space"); return NULL; } + if(self->size == 2){ self->vec[2] = 0.0f; self->vec[3] = 1.0f; - }else if(self->size == 3){ + } + else if(self->size == 3){ self->vec[3] = 1.0f; } self->size = 4; @@ -354,13 +356,13 @@ static char Vector_to_track_quat_doc[] = " :return: rotation from the vector and the track and up axis.\n" " :rtype: :class:`Quaternion`\n" ; -static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args ) +static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) { float vec[3], quat[4]; const char *strack, *sup; short track = 2, up = 1; - if(!PyArg_ParseTuple( args, "|ss:to_track_quat", &strack, &sup)) + if(!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup)) return NULL; if (self->size != 3) { @@ -451,7 +453,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args ) */ negate_v3_v3(vec, self->vec); - vec_to_quat( quat,vec, track, up); + vec_to_quat(quat, vec, track, up); return newQuaternionObject(quat, Py_NEW, NULL); } @@ -873,7 +875,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, CLAMP(begin, 0, self->size); CLAMP(end, 0, self->size); - begin = MIN2(begin,end); + begin = MIN2(begin, end); size = (end - begin); if(mathutils_array_parse(vec, size, size, seq, "vector[begin:end] = [...]") == -1) @@ -1066,7 +1068,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2) /* make sure v1 is always the vector */ - if (vec1 && vec2 ) { + if (vec1 && vec2) { int i; double dot = 0.0f; @@ -1170,7 +1172,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) } (void)BaseMath_WriteCallback(vec); - Py_INCREF( v1 ); + Py_INCREF(v1); return v1; } @@ -1231,7 +1233,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2) (void)BaseMath_WriteCallback(vec1); - Py_INCREF( v1 ); + Py_INCREF(v1); return v1; } @@ -1272,12 +1274,13 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa VectorObject *vecA = NULL, *vecB = NULL; int result = 0; float epsilon = .000001f; - double lenA,lenB; + double lenA, lenB; if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)){ if (comparison_type == Py_NE){ Py_RETURN_TRUE; - }else{ + } + else { Py_RETURN_FALSE; } } @@ -1290,7 +1293,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa if (vecA->size != vecB->size){ if (comparison_type == Py_NE){ Py_RETURN_TRUE; - }else{ + } + else { Py_RETURN_FALSE; } } @@ -1299,16 +1303,17 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa case Py_LT: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if( lenA < lenB ){ + if(lenA < lenB){ result = 1; } break; case Py_LE: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if( lenA < lenB ){ + if(lenA < lenB){ result = 1; - }else{ + } + else { result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB)); } break; @@ -1321,16 +1326,17 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa case Py_GT: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if( lenA > lenB ){ + if(lenA > lenB){ result = 1; } break; case Py_GE: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if( lenA > lenB ){ + if(lenA > lenB){ result = 1; - }else{ + } + else { result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB)); } break; @@ -1340,7 +1346,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa } if (result == 1){ Py_RETURN_TRUE; - }else{ + } + else { Py_RETURN_FALSE; } } @@ -1369,7 +1376,8 @@ static PyObject *Vector_subscript(VectorObject* self, PyObject* item) if (i < 0) i += self->size; return Vector_item(self, i); - } else if (PySlice_Check(item)) { + } + else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0) @@ -2001,7 +2009,7 @@ static PyGetSetDef Vector_getseters[] = { {(char *)"wwwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3071 {(char *)"wwwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3583 {(char *)"wwww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4095 - {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /* Python script used to make swizzle array */ @@ -2061,7 +2069,8 @@ static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObj if(mat->colSize == 4 && vec_size != 3){ PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same"); return -1; - }else{ + } + else { vec_cpy[3] = 1.0f; } } @@ -2156,12 +2165,12 @@ PyTypeObject vector_Type = { /* Methods to implement standard operations */ - ( destructor ) BaseMathObject_dealloc,/* destructor tp_dealloc; */ + (destructor) BaseMathObject_dealloc,/* destructor tp_dealloc; */ NULL, /* printfunc tp_print; */ NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ NULL, /* cmpfunc tp_compare; */ - ( reprfunc ) Vector_repr, /* reprfunc tp_repr; */ + (reprfunc)Vector_repr, /* reprfunc tp_repr; */ /* Method suites for standard classes */ diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c index 03501ae817d..a0991e00d07 100644 --- a/source/blender/python/generic/mathutils_geometry.c +++ b/source/blender/python/generic/mathutils_geometry.c @@ -48,7 +48,7 @@ #include "BKE_curve.h" -#define SWAP_FLOAT(a,b,tmp) tmp=a; a=b; b=tmp +#define SWAP_FLOAT(a, b, tmp) tmp=a; a=b; b=tmp #define eps 0.000001 @@ -446,7 +446,8 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject * index++; } freedisplist(&dispbase); - } else { + } + else { /* no points, do this so scripts dont barf */ freedisplist(&dispbase); /* possible some dl was allocated */ tri_list= PyList_New(0); @@ -489,7 +490,8 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj if(isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) { return newVectorObject(vi, 2, Py_NEW, NULL); - } else { + } + else { Py_RETURN_NONE; } } @@ -537,7 +539,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec else { l2[2]=0.0; VECCOPY2D(l2, line_2->vec) } /* do the calculation */ - lambda= closest_to_line_v3(pt_out,pt_in, l1, l2); + lambda= closest_to_line_v3(pt_out, pt_in, l1, l2); ret= PyTuple_New(2); PyTuple_SET_ITEM(ret, 0, newVectorObject(pt_out, 3, Py_NEW, NULL)); @@ -684,7 +686,7 @@ static char M_Geometry_box_pack_2d_doc[] = "\n" " Returns the normal of the 3D tri or quad.\n" "\n" -" :arg boxes: list of boxes, each box is a list where the first 4 items are [x,y, width, height, ...] other items are ignored.\n" +" :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, width, height, ...] other items are ignored.\n" " :type boxes: list\n" " :return: the width and height of the packed bounding box\n" " :rtype: tuple, pair of floats\n" @@ -697,7 +699,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis PyObject *ret; if(!PyList_Check(boxlist)) { - PyErr_SetString(PyExc_TypeError, "expected a list of boxes [[x,y,w,h], ... ]"); + PyErr_SetString(PyExc_TypeError, "expected a list of boxes [[x, y, w, h], ... ]"); return NULL; } diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index b4ad761a305..dbae0fb13bc 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -212,8 +212,10 @@ static void randuvec(float v[3]) r = (float)sqrt(r); v[0] = (float)(r * cos(a)); v[1] = (float)(r * sin(a)); - } else + } + else { v[2] = 1.f; + } } static PyObject *Noise_random(PyObject *UNUSED(self)) diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 113a553c6f5..fd44e09003e 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -150,9 +150,11 @@ PyObject *PyC_ExceptionBuffer(void) if(! (string_io_mod= PyImport_ImportModule("io")) ) { goto error_cleanup; - } else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) { + } + else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) { goto error_cleanup; - } else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) { + } + else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) { goto error_cleanup; } |