diff options
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index b536e91bca8..8370aea4c99 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2600,7 +2600,7 @@ PyDoc_STRVAR(BPy_EnumProperty_doc, ".. function:: EnumProperty(items, " "name=\"\", " "description=\"\", " - "default=\"\", " + "default=None, " "options={'ANIMATABLE'}, " "update=None, " "get=None, " @@ -2625,6 +2625,8 @@ BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC " :arg default: The default value for this enum, a string from the identifiers used in *items*.\n" " If the *ENUM_FLAG* option is used this must be a set of such string identifiers instead.\n" +" WARNING: It shall not be specified (or specified to its default *None* value) for dynamic enums\n" +" (i.e. if a callback function is given as *items* parameter).\n" " :type default: string or set\n" BPY_PROPDEF_OPTIONS_ENUM_DOC BPY_PROPDEF_UPDATE_DOC @@ -2676,6 +2678,12 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } + if (def == Py_None) { + /* This allows to get same behavior when explicitely passing None as default value, + * and not defining a default value at all! */ + def = NULL; + } + /* items can be a list or a callable */ if (PyFunction_Check(items)) { /* don't use PyCallable_Check because we need the function code for errors */ PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items); |