[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42876] trunk/blender/source/blender/ python: formatting edits only to use more consisted style

Campbell Barton ideasman42 at gmail.com
Mon Dec 26 13:26:21 CET 2011


Revision: 42876
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42876
Author:   campbellbarton
Date:     2011-12-26 12:26:11 +0000 (Mon, 26 Dec 2011)
Log Message:
-----------
formatting edits only to use more consisted style

Modified Paths:
--------------
    trunk/blender/source/blender/python/generic/bpy_internal_import.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_app_handlers.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_interface_atexit.c
    trunk/blender/source/blender/python/intern/bpy_intern_string.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/bpy_internal_import.c
===================================================================
--- trunk/blender/source/blender/python/generic/bpy_internal_import.c	2011-12-26 00:42:35 UTC (rev 42875)
+++ trunk/blender/source/blender/python/generic/bpy_internal_import.c	2011-12-26 12:26:11 UTC (rev 42876)
@@ -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 @@
 	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 @@
 	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 @@
 
 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 @@
 		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 @@
 		}
 	}
 
-	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 @@
 	}
 
 	/* 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 @@
 	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 @@
 	}
 
 	/* 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 @@
 {
 	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 @@
 	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 @@
 		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_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 @@
 		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 @@
 	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"};

Modified: trunk/blender/source/blender/python/intern/bpy.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy.c	2011-12-26 00:42:35 UTC (rev 42875)
+++ trunk/blender/source/blender/python/intern/bpy.c	2011-12-26 12:26:11 UTC (rev 42876)
@@ -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 @@
 );
 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 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 @@
 );

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list