[Bf-blender-cvs] [a5bbfd9fcaa] master: UI: add icon_only option to prop_popover_enum

Campbell Barton noreply at git.blender.org
Mon Mar 25 09:32:34 CET 2019


Commit: a5bbfd9fcaaf8f314ba96bade208ca0c66091ac1
Author: Campbell Barton
Date:   Mon Mar 25 19:21:55 2019 +1100
Branches: master
https://developer.blender.org/rBa5bbfd9fcaaf8f314ba96bade208ca0c66091ac1

UI: add icon_only option to prop_popover_enum

===================================================================

M	source/blender/makesrna/intern/rna_ui_api.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index afcff93738a..4abdbca10b8 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -136,6 +136,7 @@ static void rna_uiItemMenuEnumR(
 static void rna_uiItemPopoverPanelEnumR(
         uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
         const char *text_ctxt, bool translate, int icon,
+        bool icon_only,
         const char *panel_type)
 {
 	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -150,6 +151,8 @@ static void rna_uiItemPopoverPanelEnumR(
 	}
 	int flag = 0;
 
+	flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
+
 	/* Get translated name (label). */
 	name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
 	uiItemFullR_with_popover(layout, ptr, prop, -1, 0, flag, name, icon, panel_type);
@@ -664,6 +667,7 @@ void RNA_api_ui_layout(StructRNA *srna)
 	func = RNA_def_function(srna, "prop_popover_enum", "rna_uiItemPopoverPanelEnumR");
 	api_ui_item_rna_common(func);
 	api_ui_item_common(func);
+	RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
 	parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
 	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);



More information about the Bf-blender-cvs mailing list