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:
authorJeroen Bakker <j.bakker@atmind.nl>2018-06-12 09:43:09 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2018-06-12 09:45:38 +0300
commit3937e8fbc3bb6ec7bdd3caad26e4e8a504ee5100 (patch)
treec6191ad2d7e8af72097c68e620a0e70941e4a120 /source/blender
parenta2027c6587d62fcbd1ac372a0a92a2ec91ef8659 (diff)
UI: non editable template_icon_views are rendered as label
This is also a way to render an large preview icon without the selection control. This is used by the studiolights in the userprefs that only displays the preview of the light.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_templates.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 9978726fa74..45069ada92f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2266,13 +2266,20 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname,
value = RNA_property_enum_get(ptr, prop);
RNA_enum_icon_from_value(items, value, &icon);
- cb_args = MEM_callocN(sizeof(IconViewMenuArgs), __func__);
- cb_args->ptr = *ptr;
- cb_args->prop = prop;
- cb_args->show_labels = show_labels;
- cb_args->icon_scale = icon_scale;
+
+ if (RNA_property_editable(ptr, prop)) {
+ cb_args = MEM_callocN(sizeof(IconViewMenuArgs), __func__);
+ cb_args->ptr = *ptr;
+ cb_args->prop = prop;
+ cb_args->show_labels = show_labels;
+ cb_args->icon_scale = icon_scale;
+
+ but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb_args, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, "");
+ }
+ else {
+ but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, ICON_X, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, NULL, 0.0, 0.0, 0.0, 0.0, "");
+ }
- but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb_args, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, "");
ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW);