diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:10:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:10:42 +0300 |
commit | 58d6cbba6da31db8dc8a2b42d528b9a353081904 (patch) | |
tree | 04b57a2f809c6f08d84a082edf061f3ece631860 /source/blender/python/intern/bpy_props.c | |
parent | 94549adec4b6857fb6ec4cf77606da51ff7c26b7 (diff) | |
parent | 295d0c52a26730edc6d4ed1276e4051cce006be5 (diff) |
Merge branch 'master' into temp-ghash-setopstemp-ghash-setops
Diffstat (limited to 'source/blender/python/intern/bpy_props.c')
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 8370aea4c99..b0fae243182 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -68,7 +68,8 @@ static EnumPropertyItem property_flag_items[] = { {0, NULL, 0, NULL, NULL}}; #define BPY_PROPDEF_OPTIONS_DOC \ -" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE', 'PROPORTIONAL'].\n" \ +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE', 'PROPORTIONAL'," \ + "'TEXTEDIT_UPDATE'].\n" \ " :type options: set\n" \ static EnumPropertyItem property_flag_enum_items[] = { @@ -1480,15 +1481,26 @@ static EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA * EnumPropertyItem *eitems = NULL; int err = 0; - bpy_context_set(C, &gilstate); + if (C) { + bpy_context_set(C, &gilstate); + } + else { + gilstate = PyGILState_Ensure(); + } args = PyTuple_New(2); self = pyrna_struct_as_instance(ptr); PyTuple_SET_ITEM(args, 0, self); /* now get the context */ - PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module); - Py_INCREF(bpy_context_module); + if (C) { + PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module); + Py_INCREF(bpy_context_module); + } + else { + PyTuple_SET_ITEM(args, 1, Py_None); + Py_INCREF(Py_None); + } items = PyObject_CallObject(py_func, args); @@ -1529,8 +1541,13 @@ static EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA * eitems = DummyRNA_NULL_items; } + if (C) { + bpy_context_clear(C, &gilstate); + } + else { + PyGILState_Release(gilstate); + } - bpy_context_clear(C, &gilstate); return eitems; } @@ -2617,7 +2634,7 @@ PyDoc_STRVAR(BPy_EnumProperty_doc, " Note the item is optional.\n" " For dynamic values a callback can be passed which returns a list in\n" " the same format as the static list.\n" -" This function must take 2 arguments (self, context)\n" +" This function must take 2 arguments (self, context), **context may be None**.\n" " WARNING: There is a known bug with using a callback,\n" " Python must keep a reference to the strings returned or Blender will crash.\n" " :type items: sequence of string tuples or a function\n" @@ -2965,9 +2982,10 @@ static struct PyMethodDef props_methods[] = { static struct PyModuleDef props_module = { PyModuleDef_HEAD_INIT, "bpy.props", - "This module defines properties to extend blenders internal data, the result of these functions" - " is used to assign properties to classes registered with blender and can't be used directly.\n" - ".. warning:: All parameters to these functions must be passed as keywords.", + "This module defines properties to extend Blender's internal data. The result of these functions" + " is used to assign properties to classes registered with Blender and can't be used directly.\n" + "\n" + ".. warning:: All parameters to these functions must be passed as keywords.\n", -1, /* multiple "initialization" just copies the module dict. */ props_methods, NULL, NULL, NULL, NULL |