[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35624] trunk/blender/source/blender/ python: C, style changes (mostly white space edits), no functional change.
Campbell Barton
ideasman42 at gmail.com
Sat Mar 19 12:12:48 CET 2011
Revision: 35624
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35624
Author: campbellbarton
Date: 2011-03-19 11:12:48 +0000 (Sat, 19 Mar 2011)
Log Message:
-----------
C, style changes (mostly white space edits), no functional change.
Modified Paths:
--------------
trunk/blender/source/blender/python/generic/IDProp.c
trunk/blender/source/blender/python/generic/bgl.c
trunk/blender/source/blender/python/generic/bpy_internal_import.c
trunk/blender/source/blender/python/generic/mathutils.c
trunk/blender/source/blender/python/generic/mathutils_Color.c
trunk/blender/source/blender/python/generic/mathutils_Euler.c
trunk/blender/source/blender/python/generic/mathutils_Matrix.c
trunk/blender/source/blender/python/generic/mathutils_Quaternion.c
trunk/blender/source/blender/python/generic/mathutils_Vector.c
trunk/blender/source/blender/python/generic/mathutils_geometry.c
trunk/blender/source/blender/python/generic/noise_py_api.c
trunk/blender/source/blender/python/generic/py_capi_utils.c
trunk/blender/source/blender/python/intern/bpy.c
trunk/blender/source/blender/python/intern/bpy_app.c
trunk/blender/source/blender/python/intern/bpy_driver.c
trunk/blender/source/blender/python/intern/bpy_interface.c
trunk/blender/source/blender/python/intern/bpy_library.c
trunk/blender/source/blender/python/intern/bpy_operator.c
trunk/blender/source/blender/python/intern/bpy_operator_wrap.c
trunk/blender/source/blender/python/intern/bpy_props.c
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/blender/python/intern/bpy_rna_anim.c
trunk/blender/source/blender/python/intern/bpy_rna_array.c
trunk/blender/source/blender/python/intern/bpy_rna_callback.c
trunk/blender/source/blender/python/intern/bpy_traceback.c
trunk/blender/source/blender/python/intern/bpy_util.c
Modified: trunk/blender/source/blender/python/generic/IDProp.c
===================================================================
--- trunk/blender/source/blender/python/generic/IDProp.c 2011-03-19 10:26:15 UTC (rev 35623)
+++ trunk/blender/source/blender/python/generic/IDProp.c 2011-03-19 11:12:48 UTC (rev 35624)
@@ -316,10 +316,12 @@
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 @@
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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;
}
Modified: trunk/blender/source/blender/python/generic/bgl.c
===================================================================
--- trunk/blender/source/blender/python/generic/bgl.c 2011-03-19 10:26:15 UTC (rev 35623)
+++ trunk/blender/source/blender/python/generic/bgl.c 2011-03-19 11:12:48 UTC (rev 35624)
@@ -170,7 +170,8 @@
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 @@
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 @@
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;
}
Modified: trunk/blender/source/blender/python/generic/bpy_internal_import.c
===================================================================
--- trunk/blender/source/blender/python/generic/bpy_internal_import.c 2011-03-19 10:26:15 UTC (rev 35623)
+++ trunk/blender/source/blender/python/generic/bpy_internal_import.c 2011-03-19 11:12:48 UTC (rev 35624)
@@ -58,7 +58,7 @@
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 @@
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 @@
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 @@
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 @@
* 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 @@
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 @@
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_reload(PyObject *UNUSED(self), PyObject * module)
{
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list