diff options
author | Dalai Felinto <dalai@blender.org> | 2021-09-13 19:40:21 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2021-09-13 20:51:46 +0300 |
commit | 3ff60bcad8cccd6c2f82ea44527f4e6ef619f0be (patch) | |
tree | ac74f69d5ccfea263a962e622ff80fc7dd6380bf /source/blender/makesrna/intern/rna_ui_api.c | |
parent | 9fe6854a939169756895be680774ed1f66f206e7 (diff) |
Asset Template: Extra UI options
This allow users to show/hide:
* Library name / refresh.
* Assets names.
* Filter.
To set them in Python use:
display_options={'NO_NAMES', 'NO_FILTER', 'NO_LIBRARY'}
With contributions by Julian Eisel.
Differential Revision: https://developer.blender.org/D12476
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index e06cc39a88b..f96b3fc5eee 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -622,6 +622,7 @@ static void rna_uiTemplateAssetView(uiLayout *layout, PointerRNA *active_dataptr, const char *active_propname, int filter_id_types, + int display_flags, const char *activate_opname, PointerRNA *r_activate_op_properties, const char *drag_opname, @@ -630,6 +631,7 @@ static void rna_uiTemplateAssetView(uiLayout *layout, AssetFilterSettings filter_settings = { .id_types = filter_id_types ? filter_id_types : FILTER_ID_ALL, }; + uiTemplateAssetView(layout, C, list_id, @@ -640,6 +642,7 @@ static void rna_uiTemplateAssetView(uiLayout *layout, active_dataptr, active_propname, &filter_settings, + display_flags, activate_opname, r_activate_op_properties, drag_opname, @@ -878,6 +881,25 @@ void RNA_api_ui_layout(StructRNA *srna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem asset_view_template_options[] = { + {UI_TEMPLATE_ASSET_DRAW_NO_NAMES, + "NO_NAMES", + 0, + "", + "Do not display the name of each asset underneath preview images"}, + {UI_TEMPLATE_ASSET_DRAW_NO_FILTER, + "NO_FILTER", + 0, + "", + "Do not display buttons for filtering the available assets"}, + {UI_TEMPLATE_ASSET_DRAW_NO_LIBRARY, + "NO_LIBRARY", + 0, + "", + "Do not display buttons to choose or refresh an asset library"}, + {0, NULL, 0, NULL, NULL}, + }; + static float node_socket_color_default[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* simple layout specifiers */ @@ -1839,6 +1861,12 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_enum_items(parm, DummyRNA_NULL_items); RNA_def_property_enum_funcs(parm, NULL, NULL, "rna_uiTemplateAssetView_filter_id_types_itemf"); RNA_def_property_flag(parm, PROP_ENUM_FLAG); + RNA_def_enum_flag(func, + "display_options", + asset_view_template_options, + 0, + "", + "Displaying options for the asset view"); RNA_def_string(func, "activate_operator", NULL, |