[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35318] trunk/blender/source/blender/ python/intern/bpy_rna.c: formatting edits.

Campbell Barton ideasman42 at gmail.com
Thu Mar 3 06:42:16 CET 2011


Revision: 35318
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35318
Author:   campbellbarton
Date:     2011-03-03 05:42:16 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
formatting edits. (no functional changes)

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2011-03-03 05:09:07 UTC (rev 35317)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2011-03-03 05:42:16 UTC (rev 35318)
@@ -226,7 +226,7 @@
 	fprintf(stdout, "id_release_weakref: '%s', %d items\n", id->name, BLI_ghash_size(weakinfo_hash));
 	#endif
 
-	while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter) ) {
+	while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) {
 		PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
 		PyObject *item= PyWeakref_GET_OBJECT(weakref);
 		if(item != Py_None) {
@@ -670,7 +670,7 @@
 	return ret;
 }
 
-/* same as RNA_enum_value_from_id but raises an exception  */
+/* same as RNA_enum_value_from_id but raises an exception */
 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) {
@@ -690,7 +690,7 @@
 
 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)
@@ -764,12 +764,12 @@
 	/* print name if available */
 	name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
 	if(name) {
-		ret= PyUnicode_FromFormat( "<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), name);
+		ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), name);
 		MEM_freeN((void *)name);
 		return ret;
 	}
 
-	return PyUnicode_FromFormat( "<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
+	return PyUnicode_FromFormat("<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
 }
 
 static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
@@ -779,18 +779,18 @@
 		return pyrna_struct_str(self); /* fallback */
 
 	if(RNA_struct_is_ID(self->ptr.type)) {
-		return PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
+		return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
 	}
 	else {
 		PyObject *ret;
 		const char *path;
 		path= RNA_path_from_ID_to_struct(&self->ptr);
 		if(path) {
-			ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
+			ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
 			MEM_freeN((void *)path);
 		}
 		else { /* cant find, print something sane */
-			ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type));
+			ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type));
 		}
 
 		return ret;
@@ -819,7 +819,7 @@
 		int len = -1;
 		char *c= type_fmt;
 
-		while ( (*c++= tolower(*type_id++)) ) {} ;
+		while ((*c++= tolower(*type_id++))) {} ;
 
 		if(type==PROP_COLLECTION) {
 			len= pyrna_prop_collection_length(self);
@@ -837,7 +837,7 @@
 		name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
 
 		if(name) {
-			ret= PyUnicode_FromFormat( "<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
+			ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
 			MEM_freeN((void *)name);
 			return ret;
 		}
@@ -845,11 +845,11 @@
 	if(RNA_property_type(self->prop) == PROP_COLLECTION) {
 		PointerRNA r_ptr;
 		if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
-			return PyUnicode_FromFormat( "<bpy_%.200s, %.200s>", type_fmt, RNA_struct_identifier(r_ptr.type));
+			return PyUnicode_FromFormat("<bpy_%.200s, %.200s>", type_fmt, RNA_struct_identifier(r_ptr.type));
 		}
 	}
 
-	return PyUnicode_FromFormat( "<bpy_%.200s, %.200s.%.200s>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+	return PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
 }
 
 static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
@@ -865,11 +865,11 @@
 
 	path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
 	if(path) {
-		ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
+		ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
 		MEM_freeN((void *)path);
 	}
 	else { /* cant find, print something sane */
-		ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop));
+		ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop));
 	}
 
 	return ret;
@@ -910,8 +910,8 @@
 	}
 
 #ifdef USE_WEAKREFS
-    if (self->in_weakreflist != NULL) {
-        PyObject_ClearWeakRefs((PyObject *)self);
+	if (self->in_weakreflist != NULL) {
+		PyObject_ClearWeakRefs((PyObject *)self);
 	}
 #endif
 
@@ -923,8 +923,8 @@
 static void pyrna_prop_dealloc(BPy_PropertyRNA *self)
 {
 #ifdef USE_WEAKREFS
-    if (self->in_weakreflist != NULL) {
-        PyObject_ClearWeakRefs((PyObject *)self);
+	if (self->in_weakreflist != NULL) {
+		PyObject_ClearWeakRefs((PyObject *)self);
 	}
 #endif
 	/* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */
@@ -934,8 +934,8 @@
 static void pyrna_prop_array_dealloc(BPy_PropertyRNA *self)
 {
 #ifdef USE_WEAKREFS
-    if (self->in_weakreflist != NULL) {
-        PyObject_ClearWeakRefs((PyObject *)self);
+	if (self->in_weakreflist != NULL) {
+		PyObject_ClearWeakRefs((PyObject *)self);
 	}
 #endif
 	/* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */
@@ -975,8 +975,8 @@
 	} else {
 		/* hack so that dynamic enums used for operator properties will be able to be built (i.e. context will be supplied to itemf)
 		 * and thus running defining operator buttons for such operators in UI will work */
-		RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT); 
-		
+		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);
 			PyErr_Format(PyExc_TypeError, "%.200s enum \"%.200s\" not found in (%.200s)", error_prefix, param, enum_str);
@@ -1104,7 +1104,7 @@
 				/* prefer not fail silently incase of api errors, maybe disable it later */
 				printf("RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'\n", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop));
 
-#if 0           // gives python decoding errors while generating docs :(
+#if 0			// gives python decoding errors while generating docs :(
 				char error_str[256];
 				snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop));
 				PyErr_Warn(PyExc_RuntimeWarning, error_str);
@@ -1139,13 +1139,13 @@
 	/* 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:
 	{
@@ -1308,9 +1308,9 @@
 			 * 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, "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
@@ -1616,9 +1616,9 @@
 		switch (RNA_property_type(prop)) {
 		case PROP_BOOLEAN:
 			{
-				int param = PyLong_AsLong( value );
+				int param = PyLong_AsLong(value);
 
-				if( param < 0 || param > 1) {
+				if(param < 0 || param > 1) {
 					PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1");
 					ret = -1;
 				} else {
@@ -2127,7 +2127,7 @@
 	PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self)
 
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
-		PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(self->prop), RNA_struct_identifier(self->ptr.type) );
+		PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only", RNA_property_identifier(self->prop), RNA_struct_identifier(self->ptr.type));
 		ret= -1;
 	}
 
@@ -2174,15 +2174,15 @@
 
 /* for slice only */
 static PyMappingMethods pyrna_prop_array_as_mapping = {
-	( lenfunc ) pyrna_prop_array_length,	/* mp_length */
-	( binaryfunc ) pyrna_prop_array_subscript,	/* mp_subscript */
-	( objobjargproc ) pyrna_prop_array_ass_subscript,	/* mp_ass_subscript */
+	(lenfunc) pyrna_prop_array_length,	/* mp_length */
+	(binaryfunc) pyrna_prop_array_subscript,	/* mp_subscript */
+	(objobjargproc) pyrna_prop_array_ass_subscript,	/* mp_ass_subscript */
 };
 
 static PyMappingMethods pyrna_prop_collection_as_mapping = {
-	( lenfunc ) pyrna_prop_collection_length,	/* mp_length */
-	( binaryfunc ) pyrna_prop_collection_subscript,	/* mp_subscript */
-	( objobjargproc ) NULL,	/* mp_ass_subscript */

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list