Skip to content
Snippets Groups Projects
ui_panels.py 38.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • def header_search_draw(self, context):
    
        '''Top bar menu in 3d view'''
    
        preferences = bpy.context.preferences.addons['blenderkit'].preferences
        if preferences.search_in_header:
            layout = self.layout
            s = bpy.context.scene
            ui_props = s.blenderkitUI
            if ui_props.asset_type == 'MODEL':
                props = s.blenderkit_models
            if ui_props.asset_type == 'MATERIAL':
                props = s.blenderkit_mat
            if ui_props.asset_type == 'BRUSH':
                props = s.blenderkit_brush
    
            if context.space_data.show_region_tool_header == True:
                layout.separator_spacer()
            layout.prop(ui_props, "asset_type", text='', icon='URL')
            layout.prop(props, "search_keywords", text="", icon='VIEWZOOM')
            draw_assetbar_show_hide(layout, props)
    
    
    
    # We can store multiple preview collections here,
    # however in this example we only store "main"
    preview_collections = {}
    
    Vilem Duha's avatar
    Vilem Duha committed
    classess = (
        SetCategoryOperator,
    
    
    Vilém Duha's avatar
    Vilém Duha committed
        VIEW3D_PT_blenderkit_profile,
        VIEW3D_PT_blenderkit_login,
    
    Vilem Duha's avatar
    Vilem Duha committed
        VIEW3D_PT_blenderkit_unified,
        VIEW3D_PT_blenderkit_model_properties,
        VIEW3D_PT_blenderkit_downloads,
    
        OBJECT_MT_blenderkit_asset_menu,
        UrlPopupDialog
    
    Vilem Duha's avatar
    Vilem Duha committed
    )
    
    
    def register_ui_panels():
        for c in classess:
            bpy.utils.register_class(c)
    
        bpy.types.VIEW3D_MT_editor_menus.append(header_search_draw)
    
    Vilem Duha's avatar
    Vilem Duha committed
    
    
    def unregister_ui_panels():
        for c in classess:
            bpy.utils.unregister_class(c)
    
        bpy.types.VIEW3D_MT_editor_menus.remove(header_search_draw)