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/editors/interface/interface_template_list.cc | |
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/editors/interface/interface_template_list.cc')
-rw-r--r-- | source/blender/editors/interface/interface_template_list.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_template_list.cc b/source/blender/editors/interface/interface_template_list.cc index 0ab45ea0f81..8246759ad36 100644 --- a/source/blender/editors/interface/interface_template_list.cc +++ b/source/blender/editors/interface/interface_template_list.cc @@ -944,10 +944,16 @@ static void ui_template_list_layout_draw(bContext *C, /* For scrollbar. */ row = uiLayoutRow(glob, false); + const bool show_names = (flags & UI_TEMPLATE_LIST_NO_NAMES) == 0; + /* TODO ED_fileselect_init_layout(). Share somehow? */ float size_x = (96.0f / 20.0f) * UI_UNIT_X; float size_y = (96.0f / 20.0f) * UI_UNIT_Y; + if (!show_names) { + size_y -= UI_UNIT_Y; + } + const int cols_per_row = MAX2((uiLayoutGetWidth(box) - V2D_SCROLL_WIDTH) / size_x, 1); uiLayout *grid = uiLayoutGridFlow(row, true, cols_per_row, true, true, true); @@ -1033,7 +1039,8 @@ static void ui_template_list_layout_draw(bContext *C, break; } - if (glob) { + const bool add_filters_but = (flags & UI_TEMPLATE_LIST_NO_FILTER_OPTIONS) == 0; + if (glob && add_filters_but) { const bool add_grip_but = (flags & UI_TEMPLATE_LIST_NO_GRIP) == 0; /* About #UI_BTYPE_GRIP drag-resize: |