diff options
author | Julian Eisel <julian@blender.org> | 2021-10-23 00:56:05 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-23 00:56:05 +0300 |
commit | cfc64261c12e90bf3219cb377d4fe7c008407850 (patch) | |
tree | 34f9c727d12991d50b1560ac2a2081f56a2ac4fe /release | |
parent | c51eac24fea8e010a8fed84f5f8787521067fb42 (diff) |
Asset Browser: Filter options for specific ID types
Adds a filter popup to the header that allows specifiying which data-block
types to show. The menu automatically reflects all supported ID types, so it
shows a checkbox for materials, worlds and actions currently by default, and
all ID types with the "Extended Asset Browser" experimental feature enabled.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_filebrowser.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 420481eec13..62a9343f644 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -54,6 +54,12 @@ class FILEBROWSER_HT_header(Header): layout.prop(params, "filter_search", text="", icon='VIEWZOOM') + layout.popover( + panel="ASSETBROWSER_PT_filter", + text="", + icon='FILTER' + ) + layout.operator( "screen.region_toggle", text="", @@ -592,6 +598,28 @@ class ASSETBROWSER_PT_display(asset_utils.AssetBrowserPanel, Panel): col.prop(params, "show_details_datetime", text="Date") +class ASSETBROWSER_PT_filter(asset_utils.AssetBrowserPanel, Panel): + bl_region_type = 'HEADER' + bl_category = "Filter" + bl_label = "Filter" + + def draw(self, context): + layout = self.layout + space = context.space_data + params = space.params + use_extended_browser = context.preferences.experimental.use_extended_asset_browser + + if params.use_filter_blendid: + col = layout.column(align=True) + + filter_id = params.filter_asset_id + for identifier in dir(filter_id): + if identifier.startswith("filter_") or (identifier.startswith("experimental_filter_") and use_extended_browser): + row = col.row() + row.label(icon=filter_id.bl_rna.properties[identifier].icon) + row.prop(filter_id, identifier, toggle=False) + + class AssetBrowserMenu: @classmethod def poll(cls, context): @@ -794,6 +822,7 @@ classes = ( FILEBROWSER_MT_select, FILEBROWSER_MT_context_menu, ASSETBROWSER_PT_display, + ASSETBROWSER_PT_filter, ASSETBROWSER_MT_editor_menus, ASSETBROWSER_MT_view, ASSETBROWSER_MT_select, |