[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33567] trunk/blender/source/blender: - internal py/rna ifdef's USE_MATHUTILS was mixed up,

Campbell Barton ideasman42 at gmail.com
Thu Dec 9 07:08:35 CET 2010


Revision: 33567
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33567
Author:   campbellbarton
Date:     2010-12-09 07:08:19 +0100 (Thu, 09 Dec 2010)

Log Message:
-----------
- internal py/rna ifdef's USE_MATHUTILS was mixed up,
- updated tooltip for vertex group mirror.

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

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2010-12-09 04:36:58 UTC (rev 33566)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2010-12-09 06:08:19 UTC (rev 33567)
@@ -1836,7 +1836,7 @@
 	/* identifiers */
 	ot->name= "Mirror Vertex Group";
 	ot->idname= "OBJECT_OT_vertex_group_mirror";
-	ot->description= "Mirror weights, and flip vertex group names, copying when only one side is selected";
+	ot->description= "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, flipping when both sides are selected otherwise copy from unselected";
 
 	/* api callbacks */
 	ot->poll= vertex_group_poll_edit;
@@ -1847,7 +1847,7 @@
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "mirror_weights", TRUE, "Mirror Weights", "Mirror weights.");
-	RNA_def_boolean(ot->srna, "flip_group_names", TRUE, "Flip Groups", "Flip vertex group names while mirroring.");
+	RNA_def_boolean(ot->srna, "flip_group_names", TRUE, "Flip Groups", "Flip vertex group names.");
 
 }
 

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2010-12-09 04:36:58 UTC (rev 33566)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2010-12-09 06:08:19 UTC (rev 33567)
@@ -50,24 +50,13 @@
 #include "DNA_anim_types.h"
 #include "ED_keyframing.h"
 
+#include "../generic/IDProp.h" /* for IDprop lookups */
+#include "../generic/py_capi_utils.h"
+
 #define USE_PEDANTIC_WRITE
 #define USE_MATHUTILS
 #define USE_STRING_COERCE
 
-#ifdef USE_MATHUTILS
-#include "../generic/mathutils.h" /* so we can have mathutils callbacks */
-#include "../generic/IDProp.h" /* for IDprop lookups */
-#include "../generic/py_capi_utils.h"
-
-static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix);
-static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
-static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
-static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
-static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
-static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item);
-
-/* bpyrna vector/euler/quat callbacks */
-static int mathutils_rna_array_cb_index= -1; /* index for our callbacks */
 #ifdef USE_PEDANTIC_WRITE
 static short rna_disallow_writes= FALSE;
 
@@ -92,8 +81,22 @@
 	return FALSE;
 }
 
-#endif
+#endif // USE_PEDANTIC_WRITE
 
+static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
+static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix);
+static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item);
+
+#ifdef USE_MATHUTILS
+#include "../generic/mathutils.h" /* so we can have mathutils callbacks */
+
+static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
+static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
+
+/* bpyrna vector/euler/quat callbacks */
+static int mathutils_rna_array_cb_index= -1; /* index for our callbacks */
+
 /* subtype not used much yet */
 #define MATHUTILS_CB_SUBTYPE_EUL 0
 #define MATHUTILS_CB_SUBTYPE_VEC 1
@@ -135,7 +138,7 @@
 	if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
 		return 0;
 	}
-#endif
+#endif // USE_PEDANTIC_WRITE
 
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
 		PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
@@ -193,7 +196,7 @@
 	if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
 		return 0;
 	}
-#endif
+#endif // USE_PEDANTIC_WRITE
 	
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
 		PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
@@ -244,7 +247,7 @@
 	if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
 		return 0;
 	}
-#endif
+#endif // USE_PEDANTIC_WRITE
 
 	if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
 		PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
@@ -268,19 +271,23 @@
 	NULL
 };
 
-/* 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)
+static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback)
 {
-	if(RNA_enum_value_from_id(item, identifier, value) == 0) {
-		char *enum_str= BPy_enum_as_string(item);
-		PyErr_Format(PyExc_TypeError, "%s: '%.200s' not found in (%s)", error_prefix, identifier, enum_str);
-		MEM_freeN(enum_str);
-		return -1;
+	/* attempt to get order */
+	if(*prop_eul_order==NULL)
+		*prop_eul_order= RNA_struct_find_property(ptr, "rotation_mode");
+
+	if(*prop_eul_order) {
+		short order= RNA_property_enum_get(ptr, *prop_eul_order);
+		if (order >= ROT_MODE_XYZ && order <= ROT_MODE_ZYX) /* could be quat or axisangle */
+			return order;
 	}
 
-	return 0;
+	return order_fallback;
 }
 
+#endif // USE_MATHUTILS
+
 #define PROP_ALL_VECTOR_SUBTYPES PROP_TRANSLATION: case PROP_DIRECTION: case PROP_VELOCITY: case PROP_ACCELERATION: case PROP_XYZ: case PROP_XYZ_LENGTH
 
 PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
@@ -401,27 +408,25 @@
 			ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the Mathutils PyObject */
 		}
 	}
+#else // USE_MATHUTILS
+	(void)ptr;
+	(void)prop;
+#endif // USE_MATHUTILS
 
-#endif
-
 	return ret;
 }
 
-#endif
-
-static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback)
+/* 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)
 {
-	/* attempt to get order */
-	if(*prop_eul_order==NULL)
-		*prop_eul_order= RNA_struct_find_property(ptr, "rotation_mode");
-
-	if(*prop_eul_order) {
-		short order= RNA_property_enum_get(ptr, *prop_eul_order);
-		if (order >= ROT_MODE_XYZ && order <= ROT_MODE_ZYX) /* could be quat or axisangle */
-			return order;
+	if(RNA_enum_value_from_id(item, identifier, value) == 0) {
+		char *enum_str= BPy_enum_as_string(item);
+		PyErr_Format(PyExc_TypeError, "%s: '%.200s' not found in (%s)", error_prefix, identifier, enum_str);
+		MEM_freeN(enum_str);
+		return -1;
 	}
 
-	return order_fallback;
+	return 0;
 }
 
 static int pyrna_struct_compare( BPy_StructRNA * a, BPy_StructRNA * b )
@@ -853,9 +858,9 @@
 		else {
 			ret= PyUnicode_FromString(buf);
 		}
-#else
+#else // USE_STRING_COERCE
 		ret= PyUnicode_FromString(buf);
-#endif
+#endif // USE_STRING_COERCE
 		MEM_freeN(buf);
 		break;
 	}
@@ -990,7 +995,7 @@
 			if(!BaseMath_ReadCallback(mat))
 				return -1;
 		} else /* continue... */
-#endif
+#endif // USE_MATHUTILS
 		if (!PySequence_Check(value)) {
 			PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment to %.200s.%.200s expected a sequence instead of %.200s instance", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
 			return -1;
@@ -1072,9 +1077,9 @@
 			else {
 				param= _PyUnicode_AsString(value);
 			}
-#else
+#else // USE_STRING_COERCE
 			param= _PyUnicode_AsString(value);
-#endif
+#endif // USE_STRING_COERCE
 
 			if (param==NULL) {
 				PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a string type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
@@ -1086,7 +1091,7 @@
 			}
 #ifdef USE_STRING_COERCE
 			Py_XDECREF(value_coerce);
-#endif
+#endif // USE_STRING_COERCE
 			break;
 		}
 		case PROP_ENUM:
@@ -1951,7 +1956,7 @@
 	if(rna_disallow_writes && rna_id_write_error(&self->ptr, key)) {
 		return -1;
 	}
-#endif
+#endif // USE_STRING_COERCE
 
 	if(group==NULL) {
 		PyErr_SetString(PyExc_TypeError, "bpy_struct[key] = val: id properties not supported for this type");
@@ -2781,7 +2786,7 @@
 	if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
 		return -1;
 	}
-#endif
+#endif // USE_STRING_COERCE
 
 	if(name == NULL) {
 		PyErr_SetString(PyExc_AttributeError, "bpy_struct: __setattr__ must be a string");
@@ -2900,7 +2905,7 @@
 	if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
 		return -1;
 	}
-#endif
+#endif // USE_STRING_COERCE
 
 	if(name == NULL) {
 		PyErr_SetString(PyExc_AttributeError, "bpy_prop: __setattr__ must be a string");
@@ -3566,6 +3571,7 @@
 			break;
 		case PROP_FLOAT:
 			switch(RNA_property_subtype(prop)) {
+#ifdef USE_MATHUTILS
 				case PROP_ALL_VECTOR_SUBTYPES:
 					ret= newVectorObject(data, len, Py_NEW, NULL);
 					break;
@@ -3579,6 +3585,7 @@
 						break;
 					}
 					/* pass through */
+#endif
 				default:
 					ret = PyTuple_New(len);
 					for(a=0; a<len; a++)





More information about the Bf-blender-cvs mailing list