From bc37ef55eaa6e407a71286e69a4115853aaf628d Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 14 Feb 2023 11:32:34 +0100 Subject: [PATCH] Asset Brwoser: Add import settings popover, move import method into it Replaces the current import method menu in the middle of the Asset Browser header with a "Import Settings" popover. The import method is located there now, because it doesn't need to be as prominent as it used to be, especially with #104686. We can also add further settings to it, such as a collection instance option. Part of #104686. --- .../startup/bl_ui/space_filebrowser.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 85313b14341..80dcf66db1c 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -23,7 +23,7 @@ class FILEBROWSER_HT_header(Header): layout.separator_spacer() if params.asset_library_ref != 'LOCAL': - layout.prop(params, "import_type", text="") + layout.popover("ASSETBROWSER_PT_import_settings", text="Import Settings") layout.separator_spacer() @@ -700,6 +700,23 @@ class ASSETBROWSER_MT_catalog(AssetBrowserMenu, Menu): layout.operator("asset.catalog_new").parent_path = "" +class ASSETBROWSER_PT_import_settings(asset_utils.AssetBrowserPanel, Panel): + bl_idname = "ASSETBROWSER_PT_import_settings" + bl_region_type = 'HEADER' + bl_label = "Import Settings" + bl_options = {'HIDE_HEADER'} + bl_ui_units_x = 12 + + def draw(self, context): + layout = self.layout + params = context.space_data.params + + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + layout.prop(params, "import_type", text="Import Method") + + class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): bl_region_type = 'TOOL_PROPS' bl_label = "Asset Metadata" @@ -852,6 +869,7 @@ classes = ( ASSETBROWSER_MT_view, ASSETBROWSER_MT_select, ASSETBROWSER_MT_catalog, + ASSETBROWSER_PT_import_settings, ASSETBROWSER_MT_metadata_preview_menu, ASSETBROWSER_PT_metadata, ASSETBROWSER_PT_metadata_preview, -- 2.30.2