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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index e40db8842af..84673029eb9 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -140,6 +140,25 @@ static void rna_uiItemMenuEnumR(
uiItemMenuEnumR_prop(layout, ptr, prop, name, icon);
}
+static void rna_uiItemTabsEnumR(
+ uiLayout *layout, bContext *C,
+ struct PointerRNA *ptr, const char *propname,
+ bool icon_only)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ 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;
+ }
+
+ uiItemTabsEnumR_prop(layout, C, ptr, prop, icon_only);
+}
+
static void rna_uiItemEnumR_string(
uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
const char *name, const char *text_ctxt, bool translate, int icon)
@@ -617,6 +636,11 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_rna_common(func);
api_ui_item_common(func);
+ func = RNA_def_function(srna, "prop_tabs_enum", "rna_uiItemTabsEnumR");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
+
func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");