30#include "RNA_prototypes.hh"
51 : shelf_(
shelf), shelf_settings_(shelf_.settings)
55 shelf_settings_.asset_library_reference,
57 return type_asset_poll(*shelf_.type, asset);
63 if (catalog_tree_.is_empty()) {
66 item.disable_interaction();
71 catalog_tree_.foreach_root_item(
88 if (parent_count < 2) {
102 char catalog_path_enabled_ =
false;
107 catalog_item_(catalog_item),
108 catalog_path_enabled_(
116 return catalog_path_enabled_ != 0;
121 bool has_enabled =
false;
125 const Item &item =
dynamic_cast<const Item &
>(abstract_item);
137 return catalog_item_.catalog_path();
149 subrow.
label(catalog_item_.get_name(), ICON_NONE);
159 &catalog_path_enabled_,
162 TIP_(
"Toggle catalog visibility in the asset shelf"));
163 button_func_set(toggle_but, [&tree](
bContext &
C) {
180 if (selector_tree_item.is_catalog_path_enabled()) {
194 row.
prop(&shelf_ptr,
"asset_library_reference",
UI_ITEM_NONE,
"", ICON_NONE);
196 PointerRNA ptr = row.
op(
"ASSET_OT_library_refresh",
"", ICON_FILE_REFRESH);
215 shelf->settings.asset_library_reference);
223 "asset catalog tree view",
224 std::make_unique<AssetCatalogSelectorTree>(*
library, *
shelf));
242 "Select the asset library and the contained catalogs to display in the asset shelf");
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
void foreach_child(ItemIterFn callback) const
bool is_catalog_path_enabled() const
void build_row(ui::Layout &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, Layout &layout, 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)
AssetLibraryReference & settings_ensure_valid_library_ref(AssetShelfSettings &settings)
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)
void library_selector_draw(const bContext *C, ui::Layout &layout, AssetShelf &shelf)
asset_system::AssetCatalogTree build_filtered_catalog_tree(const asset_system::AssetLibrary &library, const AssetLibraryReference &library_ref, FunctionRef< bool(const asset_system::AssetRepresentation &)> is_asset_visible_fn)
TreeViewItemContainer TreeViewOrItem
void block_layout_set_current(Block *block, Layout *layout)
bool WM_paneltype_add(PanelType *pt)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
PanelType * WM_paneltype_find(const StringRef idname, bool quiet)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
bScreen * CTX_wm_screen(const bContext *C)
ListBaseT< PanelType > paneltypes
char translation_context[BKE_ST_MAXNAME]
void(*) listener(const wmRegionListenerParams *params)
void(*) draw(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
void operator_context_set(wm::OpCallContext opcontext)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void active_set(bool active)
void emboss_set(EmbossType emboss)