Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-08-05 16:10:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-05 16:10:44 +0300
commit916e51a4078b452774b2696d1daeb7286ab3f085 (patch)
tree11e0981d7bbde1553248f8f75ec23d2d01022a9b /source/blender/python
parentfa1d47069288bde694d4c3e7284c7f0249d4f632 (diff)
PyRNA: support separators in enum-items lists
Resolves T68260
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_props.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 50c61dd0061..70bfa76e344 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1505,6 +1505,10 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
/* calculate combine string length */
totbuf += id_str_size + name_str_size + desc_str_size + 3; /* 3 is for '\0's */
}
+ else if (item == Py_None) {
+ /* Only set since the rest is cleared. */
+ items[i].identifier = "";
+ }
else {
MEM_freeN(items);
PyErr_SetString(PyExc_TypeError,
@@ -2979,6 +2983,8 @@ PyDoc_STRVAR(
" When an item only contains 4 items they define ``(identifier, name, description, "
"number)``.\n"
"\n"
+ " Separators may be added using None instead of a tuple."
+ "\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)``, **context may be None**.\n"