27#include "RNA_prototypes.hh"
47 : shelf_(shelf), shelf_settings_(shelf_.settings)
53 return (!shelf_.type->asset_poll || shelf_.type->asset_poll(shelf_.type, &asset));
62 item.disable_interaction();
83 if (parent_count < 2) {
97 char catalog_path_enabled_ =
false;
102 catalog_item_(catalog_item),
103 catalog_path_enabled_(
111 return catalog_path_enabled_ != 0;
116 bool has_enabled =
false;
120 const Item &item =
dynamic_cast<const Item &
>(abstract_item);
155 (
char *)&catalog_path_enabled_,
158 TIP_(
"Toggle catalog visibility in the asset shelf"));
160 tree.update_shelf_settings_from_enabled_catalogs();
176 if (selector_tree_item.is_catalog_path_enabled()) {
191 uiItemO(row,
"", ICON_FILE_REFRESH,
"ASSET_OT_library_refresh");
215 "asset catalog tree view",
216 std::make_unique<AssetCatalogSelectorTree>(*library, *shelf));
229 PanelType *pt = MEM_cnew<PanelType>(__func__);
234 "Select the asset library and the contained catalogs to display in the asset shelf");
bScreen * CTX_wm_screen(const bContext *C)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define STRNCPY(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
blender::ui::AbstractGridView * UI_block_add_view(uiBlock &block, blender::StringRef idname, std::unique_ptr< blender::ui::AbstractGridView > grid_view)
void UI_but_flag_disable(uiBut *but, int flag)
void uiLayoutSetActive(uiLayout *layout, bool active)
uiBut * uiDefButC(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, char *poin, float min, float max, const char *tip)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void UI_but_drawflag_enable(uiBut *but, int flag)
void uiLayoutSetEmboss(uiLayout *layout, eUIEmbossType emboss)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout)
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
constexpr const char * c_str() const
void foreach_child(ItemIterFn callback) const
AssetCatalogPath catalog_path() const
StringRefNull get_name() const
void foreach_root_item(ItemIterFn callback) const
bool is_catalog_path_enabled() const
void build_row(uiLayout &row) override
Item(const asset_system::AssetCatalogTreeItem &catalog_item, AssetShelf &shelf)
bool has_enabled_in_subtree()
asset_system::AssetCatalogPath catalog_path() const
void build_tree() override
Item & build_catalog_items_recursive(ui::TreeViewOrItem &parent_view_item, const asset_system::AssetCatalogTreeItem &catalog_item) const
void update_shelf_settings_from_enabled_catalogs()
AssetCatalogSelectorTree(asset_system::AssetLibrary &library, AssetShelf &shelf)
Abstract base class for defining a customizable tree-view item.
int count_parents() const
AbstractTreeView & get_tree_view() const
void uncollapse_by_default()
void foreach_item(ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
void disable_activatable()
void set_context_menu_title(const std::string &title)
BasicTreeViewItem(StringRef label, BIFIconID icon=ICON_NONE)
static void build_tree_view(AbstractTreeView &tree_view, uiLayout &layout, std::optional< StringRef > search_string={}, bool add_box=true)
ItemT & add_tree_item(Args &&...args)
void foreach_item_recursive(ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
asset_system::AssetLibrary * library_get_once_available(const AssetLibraryReference &library_reference)
void asset_reading_region_listen_fn(const wmRegionListenerParams *params)
static void catalog_selector_panel_draw(const bContext *C, Panel *panel)
void settings_clear_enabled_catalogs(AssetShelf &shelf)
void library_selector_draw(const bContext *C, uiLayout *layout, AssetShelf &shelf)
void catalog_selector_panel_register(ARegionType *region_type)
AssetShelf * active_shelf_from_context(const bContext *C)
bool settings_is_catalog_path_enabled(const AssetShelf &shelf, const asset_system::AssetCatalogPath &path)
void send_redraw_notifier(const bContext &C)
void settings_set_catalog_path_enabled(AssetShelf &shelf, const asset_system::AssetCatalogPath &path)
asset_system::AssetCatalogTree build_filtered_catalog_tree(const asset_system::AssetLibrary &library, const AssetLibraryReference &library_ref, blender::FunctionRef< bool(const asset_system::AssetRepresentation &)> is_asset_visible_fn)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
AssetLibraryReference asset_library_reference
AssetShelfSettings settings
void(* draw)(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
void(* listener)(const wmRegionListenerParams *params)
char translation_context[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
bool WM_paneltype_add(PanelType *pt)
PanelType * WM_paneltype_find(const char *idname, bool quiet)