from bpy.types import FILEBROWSER_HT_header, ASSETBROWSER_MT_editor_menus from .core.asset_library_utils import get_active_library def draw_assetbrowser_header(self, context): lib = get_active_library() if not lib: FILEBROWSER_HT_header._draw_asset_browser_buttons(self, context) return space_data = context.space_data params = context.space_data.params row = self.layout.row(align=True) row.separator() row.operator("assetlibrary.bundle", icon='UV_SYNC_SELECT', text='').name = lib.name #op #op.clean = False #op.only_recent = True lib.plugin.draw_header(row) if context.selected_files and context.active_file: row.separator() row.label(text=context.active_file.name) row.separator_spacer() sub = row.row() sub.ui_units_x = 10 sub.prop(params, "filter_search", text="", icon='VIEWZOOM') row.separator_spacer() row.prop_with_popover( params, "display_type", panel="ASSETBROWSER_PT_display", text="", icon_only=True, ) row.operator( "screen.region_toggle", text="", icon='PREFERENCES', depress=is_option_region_visible(context, space_data) ).region_type = 'TOOL_PROPS' def draw_assetbrowser_header(self, context): if not get_active_library(): return self.layout.separator() box = self.layout.box() row = box.row() row.separator(factor=0.5) row.label(text='Asset Library') row.separator(factor=0.5) # classes = (, # # ASSETLIB_PT_pose_library_editing, # # ASSETLIB_PT_pose_library_usage, # # ASSETLIB_MT_context_menu, # # ASSETLIB_PT_libraries # ) classes = [] def register() -> None: for cls in classes: bpy.utils.register_class(cls) ASSETBROWSER_MT_editor_menus.append(draw_assetbrowser_header) def unregister() -> None: for cls in reversed(classes): bpy.utils.unregister_class(cls) ASSETBROWSER_MT_editor_menus.remove(draw_assetbrowser_header)