[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40976] trunk/blender/source/blender/ python: formatting edits & remove debug print.

Campbell Barton ideasman42 at gmail.com
Thu Oct 13 03:29:13 CEST 2011


Revision: 40976
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40976
Author:   campbellbarton
Date:     2011-10-13 01:29:08 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
formatting edits & remove debug print.

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/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_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_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_traceback.c
    trunk/blender/source/blender/python/intern/bpy_util.c
    trunk/blender/source/blender/python/intern/gpu.c
    trunk/blender/source/blender/python/mathutils/mathutils.c
    trunk/blender/source/blender/python/mathutils/mathutils_Color.c
    trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
    trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
    trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
    trunk/blender/source/blender/python/mathutils/mathutils_geometry.c

Modified: trunk/blender/source/blender/python/generic/IDProp.c
===================================================================
--- trunk/blender/source/blender/python/generic/IDProp.c	2011-10-13 00:52:09 UTC (rev 40975)
+++ trunk/blender/source/blender/python/generic/IDProp.c	2011-10-13 01:29:08 UTC (rev 40976)
@@ -254,7 +254,7 @@
 
 	idprop= IDP_GetPropertyFromGroup(self->prop, name);
 
-	if(idprop==NULL) {
+	if (idprop==NULL) {
 		PyErr_SetString(PyExc_KeyError, "key not in subgroup dict");
 		return NULL;
 	}
@@ -273,20 +273,20 @@
 	for (i=0; i < len; i++) {
 		item = PySequence_GetItem(seq, i);
 		if (PyFloat_Check(item)) {
-			if(type == IDP_IDPARRAY) { /* mixed dict/int */
+			if (type == IDP_IDPARRAY) { /* mixed dict/int */
 				Py_DECREF(item);
 				return -1;
 			}
 			type= IDP_DOUBLE;
 		}
 		else if (PyLong_Check(item)) {
-			if(type == IDP_IDPARRAY) { /* mixed dict/int */
+			if (type == IDP_IDPARRAY) { /* mixed dict/int */
 				Py_DECREF(item);
 				return -1;
 			}
 		}
 		else if (PyMapping_Check(item)) {
-			if(i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */
+			if (i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */
 				Py_DECREF(item);
 				return -1;
 			}
@@ -309,7 +309,7 @@
 	IDProperty *prop = NULL;
 	IDPropertyTemplate val = {0};
 
-	if(strlen(name) >= sizeof(group->name))
+	if (strlen(name) >= sizeof(group->name))
 		return "the length of IDProperty names is limited to 31 characters";
 
 	if (PyFloat_Check(ob)) {
@@ -335,7 +335,7 @@
 		PyObject *item;
 		int i;
 
-		if((val.array.type= idp_sequence_type(ob)) == -1)
+		if ((val.array.type= idp_sequence_type(ob)) == -1)
 			return "only floats, ints and dicts are allowed in ID property arrays";
 
 		/*validate sequence and derive type.
@@ -369,7 +369,7 @@
 				error= BPy_IDProperty_Map_ValidateAndCreate("", prop, item);
 				Py_DECREF(item);
 
-				if(error)
+				if (error)
 					return error;
 			}
 			break;
@@ -415,7 +415,7 @@
 	}
 	else return "invalid property value";
 
-	if(group->type==IDP_IDPARRAY) {
+	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);
@@ -598,7 +598,7 @@
 
 	idprop= IDP_GetPropertyFromGroup(self->prop, name);
 
-	if(idprop) {
+	if (idprop) {
 		pyform = BPy_IDGroup_MapDataToPy(idprop);
 
 		if (!pyform) {
@@ -1050,7 +1050,7 @@
 		case IDP_FLOAT:
 		{
 			float *array= (float*)IDP_Array(prop);
-			for(count = begin; count < end; count++) {
+			for (count = begin; count < end; count++) {
 				PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
 			}
 			break;
@@ -1058,7 +1058,7 @@
 		case IDP_DOUBLE:
 		{
 			double *array= (double*)IDP_Array(prop);
-			for(count = begin; count < end; count++) {
+			for (count = begin; count < end; count++) {
 				PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
 			}
 			break;
@@ -1066,7 +1066,7 @@
 		case IDP_INT:
 		{
 			int *array= (int*)IDP_Array(prop);
-			for(count = begin; count < end; count++) {
+			for (count = begin; count < end; count++) {
 				PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count]));
 			}
 			break;
@@ -1094,7 +1094,7 @@
 	alloc_len= size * elem_size;
 
 	vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
-	if(PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
+	if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
 		MEM_freeN(vec);
 		return -1;
 	}

Modified: trunk/blender/source/blender/python/generic/bgl.c
===================================================================
--- trunk/blender/source/blender/python/generic/bgl.c	2011-10-13 00:52:09 UTC (rev 40975)
+++ trunk/blender/source/blender/python/generic/bgl.c	2011-10-13 01:29:08 UTC (rev 40976)
@@ -95,7 +95,7 @@
 {
 	PyObject *list;
 
-	if(self->ndimensions > 1) {
+	if (self->ndimensions > 1) {
 		int i, len= self->dimensions[0];
 		list= PyList_New(len);
 
@@ -213,7 +213,7 @@
 static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
 	arg_def##nargs arg_list; \
 	ret_def_##ret; \
-	if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
+	if (!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
 	ret_set_##ret gl##funcname (arg_var##nargs arg_list);\
 	ret_ret_##ret; \
 }
@@ -222,7 +222,7 @@
 static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
 	arg_def##nargs arg_list; \
 	ret_def_##ret; \
-	if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
+	if (!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
 	ret_set_##ret glu##funcname (arg_var##nargs arg_list);\
 	ret_ret_##ret; \
 }
@@ -289,7 +289,7 @@
 	int type;
 	Py_ssize_t i, ndimensions = 0;
 
-	if(kwds && PyDict_Size(kwds)) {
+	if (kwds && PyDict_Size(kwds)) {
 		PyErr_SetString(PyExc_TypeError,
 		                "bgl.Buffer(): takes no keyword args");
 		return NULL;
@@ -307,7 +307,7 @@
 
 	if (PyLong_Check(length_ob)) {
 		ndimensions= 1;
-		if(((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
+		if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
 			PyErr_SetString(PyExc_AttributeError,
 			                "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
 			return NULL;
@@ -332,7 +332,7 @@
 			else dimensions[i]= PyLong_AsLong(ob);
 			Py_DECREF(ob);
 
-			if(dimensions[i] < 1) {
+			if (dimensions[i] < 1) {
 				PyErr_SetString(PyExc_AttributeError,
 				                "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
 				return NULL;
@@ -490,7 +490,7 @@
 	
 	for (count= begin; count < end; count++) {
 		item= PySequence_GetItem(seq, count - begin);
-		if(item) {
+		if (item) {
 			err= Buffer_ass_item(self, count, item);
 			Py_DECREF(item);
 		}
@@ -1293,7 +1293,7 @@
 	submodule= PyModule_Create(&BGL_module_def);
 	dict= PyModule_GetDict(submodule);
 	
-	if(PyType_Ready(&BGL_bufferType) < 0)
+	if (PyType_Ready(&BGL_bufferType) < 0)
 		return NULL; /* should never happen */
 
 

Modified: trunk/blender/source/blender/python/generic/bpy_internal_import.c
===================================================================
--- trunk/blender/source/blender/python/generic/bpy_internal_import.c	2011-10-13 00:52:09 UTC (rev 40975)
+++ trunk/blender/source/blender/python/generic/bpy_internal_import.c	2011-10-13 01:29:08 UTC (rev 40976)
@@ -62,7 +62,7 @@
 	/* move reload here
 	 * XXX, use import hooks */
 	mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
-	if(mod) {
+	if (mod) {
 		PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
 		Py_DECREF(mod);
 	}
@@ -74,7 +74,7 @@
 
 static void free_compiled_text(Text *text)
 {
-	if(text->compiled) {
+	if (text->compiled) {
 		Py_DECREF((PyObject *)text->compiled);
 	}
 	text->compiled= NULL;
@@ -102,7 +102,7 @@
 	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);
 
@@ -110,7 +110,7 @@
 		text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
 		MEM_freeN(buf);
 
-		if(PyErr_Occurred()) {
+		if (PyErr_Occurred()) {
 			PyErr_Print();
 			PyErr_Clear();
 			PySys_SetObject("last_traceback", NULL);
@@ -135,7 +135,7 @@
 	
 	*found= 0;
 
-	if(!maggie) {
+	if (!maggie) {
 		printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
 		return NULL;
 	}
@@ -147,7 +147,7 @@
 
 	text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
 
-	if(!text)
+	if (!text)
 		return NULL;
 	else
 		*found= 1;
@@ -169,7 +169,7 @@
 //XXX	Main *maggie= bpy_import_main ? bpy_import_main:G.main;
 	Main *maggie= bpy_import_main;
 	
-	if(!maggie) {
+	if (!maggie) {
 		printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
 		return NULL;
 	}
@@ -177,24 +177,24 @@
 	*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);
 
 	/* uh-oh.... didn't find it */
-	if(!text)
+	if (!text)
 		return NULL;
 	else
 		*found= 1;
 
 	/* if previously compiled, free the object */
 	/* (can't see how could be NULL, but check just in case) */ 
-	if(text->compiled){
+	if (text->compiled) {
 		Py_DECREF((PyObject *)text->compiled);
 	}
 
@@ -204,7 +204,7 @@
 	MEM_freeN(buf);
 
 	/* if compile failed.... return this error */
-	if(PyErr_Occurred()) {
+	if (PyErr_Occurred()) {
 		PyErr_Print();
 		PyErr_Clear();
 		PySys_SetObject("last_traceback", NULL);
@@ -229,14 +229,14 @@
 	//PyObject_Print(args, stderr, 0);
 	static const char *kwlist[]= {"name", "globals", "locals", "fromlist", "level", NULL};
 	
-	if(!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist,
+	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 */
 	newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
 	
-	if(newmodule)
+	if (newmodule)
 		return newmodule;
 	
 	PyErr_Fetch(&exception, &err, &tb);	/* get the python error incase we cant import as blender text either */
@@ -244,7 +244,7 @@
 	/* importing from existing modules failed, see if we have this module as blender text */
 	newmodule= bpy_text_import_name(name, &found);
 	
-	if(newmodule) {/* found module as blender text, ignore above exception */
+	if (newmodule) {/* found module as blender text, ignore above exception */
 		PyErr_Clear();
 		Py_XDECREF(exception);
 		Py_XDECREF(err);
@@ -278,14 +278,14 @@
 
 	/* try reimporting from file */
 	newmodule= PyImport_ReloadModule(module);
-	if(newmodule)
+	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);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list