diff options
author | Joseph Eagar <joeedh@gmail.com> | 2006-12-17 02:54:45 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2006-12-17 02:54:45 +0300 |
commit | 3a84791b530ab2fdb5b0e9eccc7b77ac131e93a0 (patch) | |
tree | 81b8345fb837bd351d8bf748c7fef6c05d53dcf1 /source/blender/python/api2_2x/Blender.c | |
parent | 47ee194922e8fc071dcb74a703d542c73d47ffff (diff) |
=IDProperties Python update=
Updated id properties interface as per
discussed in python meeting. Basically,
id properties are now entirely accessed
through the dict-like interface if IDGroupType.
Also, tp_getsetters are used throughout the code
now.
Using the dict interface allowed for a major cleanup
of the wrapping code. The biggest change is that ID
properties are no longer wrapped in a structure with
.type .name and .data members; instead when you get
properties from the group it returns the direct value.
Ints, strings and floats return simple python types,
while arrays and groups return special wrappers though.
This means to detect the type of an ID property, you
have to use type(). For string and int types this is
easy; for group and array types (which of course have
their own wrappers) you use type() with Blender.IDGroupType
or Blender.IDArrayType.
Update of epydocs plus a temporary gui script will be
forthcoming; the gui script will be removed before release
as of course by then we'll have a built-in gui for id
properties.
Diffstat (limited to 'source/blender/python/api2_2x/Blender.c')
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 8bd0f08469d..23f3d7eaab5 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -907,6 +907,10 @@ static PyObject *Blender_UnpackModesDict( void ) /*****************************************************************************/ /* Function: initBlender */ /*****************************************************************************/ +extern PyTypeObject IDArray_Type; +extern PyTypeObject IDGroup_Type; +extern PyTypeObject IDGroup_Iter_Type; + void M_Blender_Init(void) { PyObject *module; @@ -971,6 +975,9 @@ void M_Blender_Init(void) EXPP_dict_set_item_str(dict, "event", PyString_FromString("")); EXPP_dict_set_item_str(dict, "mode", smode); + PyDict_SetItemString(dict, "IDGroupType", &IDGroup_Type); + PyDict_SetItemString(dict, "IDArrayType", &IDArray_Type); + PyDict_SetItemString(dict, "Armature", Armature_Init()); PyDict_SetItemString(dict, "BezTriple", BezTriple_Init()); PyDict_SetItemString(dict, "BGL", BGL_Init()); |