29#include "RNA_prototypes.hh"
50 : shelf_(
shelf), shelf_settings_(shelf_.settings)
54 shelf_settings_.asset_library_reference,
56 return (!shelf_.type->asset_poll || shelf_.type->asset_poll(shelf_.type, &asset));
62 if (catalog_tree_.is_empty()) {
65 item.disable_interaction();
69 catalog_tree_.foreach_root_item(
86 if (parent_count < 2) {
100 char catalog_path_enabled_ =
false;
105 catalog_item_(catalog_item),
106 catalog_path_enabled_(
114 return catalog_path_enabled_ != 0;
119 bool has_enabled =
false;
123 const Item &item =
dynamic_cast<const Item &
>(abstract_item);
135 return catalog_item_.catalog_path();
147 subrow->
label(catalog_item_.get_name(), ICON_NONE);
158 &catalog_path_enabled_,
161 TIP_(
"Toggle catalog visibility in the asset shelf"));
163 tree.update_shelf_settings_from_enabled_catalogs();
179 if (selector_tree_item.is_catalog_path_enabled()) {
193 row->
prop(&shelf_ptr,
"asset_library_reference",
UI_ITEM_NONE,
"", ICON_NONE);
195 row->
op(
"ASSET_OT_library_refresh",
"", ICON_FILE_REFRESH);
211 shelf->settings.asset_library_reference);
219 "asset catalog tree view",
220 std::make_unique<AssetCatalogSelectorTree>(*library, *
shelf));
238 "Select the asset library and the contained catalogs to display in the asset shelf");
bScreen * CTX_wm_screen(const bContext *C)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define STRNCPY_UTF8(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 UI_but_drawflag_enable(uiBut *but, int flag)
uiBut * uiDefButC(uiBlock *block, ButType type, int retval, blender::StringRef str, int x, int y, short width, short height, char *poin, float min, float max, std::optional< blender::StringRef > tip)
void foreach_child(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(const bContext &C, AbstractTreeView &tree_view, uiLayout &layout, bool add_box=true)
ItemT & add_tree_item(Args &&...args)
void foreach_item_recursive(ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
void * MEM_callocN(size_t len, const char *str)
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)
TreeViewItemContainer TreeViewOrItem
void block_layout_set_current(uiBlock *block, uiLayout *layout)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
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]
void operator_context_set(blender::wm::OpCallContext opcontext)
void label(blender::StringRef name, int icon)
void active_set(bool active)
uiLayout & row(bool align)
void emboss_set(blender::ui::EmbossType emboss)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
bool WM_paneltype_add(PanelType *pt)
PanelType * WM_paneltype_find(const StringRef idname, bool quiet)