values that had units set would not be coerced into Mathutils types by the python...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 10 Dec 2009 09:38:58 +0000 (09:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 10 Dec 2009 09:38:58 +0000 (09:38 +0000)
 eg. scene.cursor_location wasnt a vector

source/blender/makesrna/RNA_types.h
source/blender/python/intern/bpy_rna.c

index 18fb2700bbf0879c7f15bd499c336a3597ffe225..e771b495b960059780ed54603a0596ddca114ee6 100644 (file)
@@ -84,8 +84,9 @@ typedef enum PropertyUnit {
        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
 
index 92bd686114d29d5f2a034b2e2fbe9cdb60366774..7427fc73d94d6379d5cb1955932eb45c13442bd6 100644 (file)
@@ -158,7 +158,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
        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: