diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 4abdbca10b8..02c32c5d3b8 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -117,9 +117,11 @@ static void rna_uiItemR( uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon); } -static void rna_uiItemMenuEnumR( +static void rna_uiItemR_with_popover( uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, - const char *text_ctxt, bool translate, int icon) + const char *text_ctxt, bool translate, int icon, + bool icon_only, + const char *panel_type) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -127,17 +129,22 @@ static void rna_uiItemMenuEnumR( RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } + if (RNA_property_type(prop) != PROP_ENUM) { + RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname); + return; + } + 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); - uiItemMenuEnumR_prop(layout, ptr, prop, name, icon); + uiItemFullR_with_popover(layout, ptr, prop, -1, 0, flag, name, icon, panel_type); } -static void rna_uiItemPopoverPanelEnumR( +static void rna_uiItemMenuEnumR( 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) + const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -145,17 +152,10 @@ static void rna_uiItemPopoverPanelEnumR( RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } - if (RNA_property_type(prop) != PROP_ENUM) { - RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname); - return; - } - 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); + uiItemMenuEnumR_prop(layout, ptr, prop, name, icon); } static void rna_uiItemTabsEnumR( @@ -664,7 +664,7 @@ void RNA_api_ui_layout(StructRNA *srna) api_ui_item_rna_common(func); api_ui_item_common(func); - func = RNA_def_function(srna, "prop_popover_enum", "rna_uiItemPopoverPanelEnumR"); + func = RNA_def_function(srna, "prop_with_popover", "rna_uiItemR_with_popover"); 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"); |