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:
authorBastien Montagne <montagne29@wanadoo.fr>2014-11-16 17:45:00 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2014-11-16 17:55:55 +0300
commit97e2d62c79fc30eacdbcb7d0464ed6d1726833a5 (patch)
tree14b92e49dce3f507e8cab073ec1de2f25396d717 /source/blender/python/intern/bpy_props.c
parent902ba7b25c9532ae4497ce65ae1a5f4b3268a5e9 (diff)
Fix T42581: Add 'icon_value' feature to UI Py/RNA's operator button and items of enums.
Rather straightforward, allows for 'DATA' icons (like mat or tex 'previews') to be used as icon for operator button or items of an enum. Patch by Simon LuĊĦenc, with minor cleanup by self.
Diffstat (limited to 'source/blender/python/intern/bpy_props.c')
-rw-r--r--source/blender/python/intern/bpy_props.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 0bffe2cb11f..b0232a4211c 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1374,7 +1374,8 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
(tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
/* TODO, number isn't ensured to be unique from the script author */
(item_size != 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1) &&
- (item_size != 5 || ((tmp_icon = _PyUnicode_AsString(PyTuple_GET_ITEM(item, 3))) &&
+ (item_size != 5 || ((py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.icon) != -1 ||
+ (tmp_icon = _PyUnicode_AsString(PyTuple_GET_ITEM(item, 3)))) &&
py_long_as_int(PyTuple_GET_ITEM(item, 4), &tmp.value) != -1)))
{
if (is_enum_flag) {
@@ -2610,8 +2611,8 @@ PyDoc_STRVAR(BPy_EnumProperty_doc,
" [(identifier, name, description, icon, number), ...] where the identifier is used\n"
" for python access and other values are used for the interface.\n"
" The three first elements of the tuples are mandatory.\n"
-" The forth one is either the (unique!) number id of the item or, if followed by a fith element \n"
-" (which must be the numid), an icon string identifier.\n"
+" The forth one is either the (unique!) number id of the item or, if followed by a fith element\n"
+" (which must be the numid), an icon string identifier or integer icon value (e.g. returned by icon()...).\n"
" 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"