diff options
-rwxr-xr-x | release/scripts/IDPropBrowser.py | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 14 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Types.c | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/IDProp.py | 12 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Types.py | 2 |
5 files changed, 21 insertions, 14 deletions
diff --git a/release/scripts/IDPropBrowser.py b/release/scripts/IDPropBrowser.py index bbe644984c1..c3c46e41914 100755 --- a/release/scripts/IDPropBrowser.py +++ b/release/scripts/IDPropBrowser.py @@ -20,6 +20,7 @@ etc. from Blender import * from Blender.BGL import * +from Blender.Types import IDGroupType, IDArrayType import Blender def IsInRectWH(mx, my, x, y, wid, hgt): diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 1323af16b8a..485c493fba2 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -932,7 +932,7 @@ extern PyTypeObject IDGroup_Iter_Type; void M_Blender_Init(void) { PyObject *module; - PyObject *dict, *smode, *SpaceHandlers, *UnpackModes, *PropertyTypes; + PyObject *dict, *smode, *SpaceHandlers, *UnpackModes; /* G.scene should only aver be NULL if blender is executed in background mode, not loading a blend file and executing a python script eg. @@ -965,18 +965,6 @@ void M_Blender_Init(void) PyModule_AddObject(module, "SpaceHandlers", SpaceHandlers); } - PropertyTypes = PyConstant_New(); - if (PropertyTypes) { - BPy_constant *d = (BPy_constant*)PropertyTypes; - PyConstant_Insert(d,"STRING",PyInt_FromLong(IDP_STRING)); - PyConstant_Insert(d,"INT",PyInt_FromLong(IDP_INT)); - PyConstant_Insert(d,"FLOAT",PyInt_FromLong(IDP_FLOAT)); - PyConstant_Insert(d,"ARRAY",PyInt_FromLong(IDP_ARRAY)); - PyConstant_Insert(d,"GROUP",PyInt_FromLong(IDP_GROUP)); - - PyModule_AddObject(module, "PropertyTypes", PropertyTypes); - } - if (G.background) smode = PyString_FromString("background"); else diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index de34d6a3ca4..c714df8ab0a 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -36,6 +36,7 @@ is only need here now */ +extern PyTypeObject IDGroup_Type, IDArray_Type; extern PyTypeObject Action_Type, Armature_Type; extern PyTypeObject Pose_Type; extern PyTypeObject BezTriple_Type, Bone_Type, Button_Type; @@ -249,6 +250,9 @@ PyObject *Types_Init( void ) ( PyObject * ) &ThemeSpace_Type); PyDict_SetItemString( dict, "ThemeUI_Type", ( PyObject * ) &ThemeUI_Type); - + PyDict_SetItemString( dict, "IDGroupType", + ( PyObject * ) &IDGroup_Type); + PyDict_SetItemString( dict, "IDArrayType", + ( PyObject * ) &IDArray_Type); return submodule; } diff --git a/source/blender/python/api2_2x/doc/IDProp.py b/source/blender/python/api2_2x/doc/IDProp.py index aa5cca9ebb3..593e4080645 100644 --- a/source/blender/python/api2_2x/doc/IDProp.py +++ b/source/blender/python/api2_2x/doc/IDProp.py @@ -24,6 +24,18 @@ class IDGroup: del group['property'] + To get the type of a property, use the type() operator, for example:: + + if type(group['bleh']) == str: pass + + To tell if the property is a group or array type, import the Blender.Types module and test + against IDGroupType and IDArrayType, like so:: + + from Blender.Types import IDGroupType, IDArrayType. + + if type(group['bleghr']) == IDGroupType: + (do something) + @ivar name: The name of the property @type name: string """ diff --git a/source/blender/python/api2_2x/doc/Types.py b/source/blender/python/api2_2x/doc/Types.py index abed1bb0ca2..a08226e46ee 100644 --- a/source/blender/python/api2_2x/doc/Types.py +++ b/source/blender/python/api2_2x/doc/Types.py @@ -65,4 +65,6 @@ objects. @var rgbTupleType: Blender rgbTuple. A (red, green, blue) triplet. @var TextureType: Blender Texture. @var MTexType: Blender MTex. Links materials to a texture. +@var IDGroupType: Blender IDProperty Group type. +@var IDArrayType: Blender IDProperty Array type. """ |