[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25276] trunk/blender/source/blender: values that had units set would not be coerced into Mathutils types by the python api .

Campbell Barton ideasman42 at gmail.com
Thu Dec 10 10:39:00 CET 2009


Revision: 25276
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25276
Author:   campbellbarton
Date:     2009-12-10 10:38:58 +0100 (Thu, 10 Dec 2009)

Log Message:
-----------
values that had units set would not be coerced into Mathutils types by the python api.
 eg. scene.cursor_location wasnt a vector

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

Modified: trunk/blender/source/blender/makesrna/RNA_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_types.h	2009-12-10 09:25:30 UTC (rev 25275)
+++ trunk/blender/source/blender/makesrna/RNA_types.h	2009-12-10 09:38:58 UTC (rev 25276)
@@ -84,8 +84,9 @@
 	PROP_UNIT_ACCELERATION = (8<<16)	/* m/(s^2) */
 } PropertyUnit;
 
-#define RNA_SUBTYPE_UNIT(subtype) (subtype & 0x00FF0000)
-#define RNA_SUBTYPE_UNIT_VALUE(subtype) (subtype>>16)
+#define RNA_SUBTYPE_UNIT(subtype) ((subtype) & 0x00FF0000)
+#define RNA_SUBTYPE_VALUE(subtype) ((subtype) & ~0x00FF0000)
+#define RNA_SUBTYPE_UNIT_VALUE(subtype) ((subtype)>>16)
 
 #define RNA_ENUM_BITFLAG_SIZE 32
 

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2009-12-10 09:25:30 UTC (rev 25275)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2009-12-10 09:38:58 UTC (rev 25276)
@@ -158,7 +158,7 @@
 	if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) {
 		ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the Mathutils PyObject */
 
-		switch(RNA_property_subtype(prop)) {
+		switch(RNA_SUBTYPE_VALUE(RNA_property_subtype(prop))) {
 		case PROP_TRANSLATION:
 		case PROP_DIRECTION:
 		case PROP_VELOCITY:





More information about the Bf-blender-cvs mailing list