diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-23 04:02:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-23 04:02:53 +0300 |
commit | 2f6a158d21ae0ca5dba0c67e4e199cd995e4ce15 (patch) | |
tree | ee604d518c3acae03622d32d4b8221279de36ef8 /source/blender/python/intern/bpy_rna.c | |
parent | 8dd14e1eed6f65af3a19a5cae8202c8f701e94ed (diff) |
when python calls an operator, return a set from the operator flag, this matches the set that python operators themselves return. eg.
{'MODAL'} or... {'FINISHED'}
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 8784d8b723b..49de1b3e944 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -424,6 +424,24 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr return 1; } +PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value) +{ + PyObject *ret= PySet_New(NULL); + const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1]; + + if(RNA_enum_bitflag_identifiers(items, value, identifier)) { + PyObject *item; + int index; + for(index=0; identifier[index]; index++) { + item= PyUnicode_FromString(identifier[index]); + PySet_Add(ret, item); + Py_DECREF(item); + } + } + + return ret; +} + static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) { PyObject *item, *ret= NULL; |