29#include "RNA_prototypes.hh"
56 if (
shelf->type == &shelf_type) {
57 shelf->type =
nullptr;
91 popup_shelves.
append(new_shelf);
119 shelf_.settings.asset_library_reference,
121 return type_asset_poll(*shelf_.type, asset);
130 if (catalog_tree_.is_empty()) {
133 item.disable_interaction();
143 all_item.set_is_active_fn(
145 all_item.uncollapse_by_default();
147 catalog_tree_.foreach_root_item([&,
this](
176 if (parent_count < 3) {
188 shelf.settings.asset_library_reference);
196 "asset shelf catalog tree view",
197 std::make_unique<AssetCatalogTreeView>(*
library,
shelf));
229 BLI_assert_msg(shelf_type !=
nullptr,
"couldn't find asset shelf type from context");
244 &screen->
id, RNA_AssetLibraryReference, &
shelf->settings.asset_library_reference);
295 pt->
description =
N_(
"Display an asset shelf in a popover panel");
#define ASSET_SHELF_PREVIEW_SIZE_DEFAULT
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
void append(const T &value)
const std::string & str() const
void foreach_child(ItemIterFn callback) const
AssetCatalogPath catalog_path() const
StringRefNull get_name() const
AssetCatalogTreeView(const asset_system::AssetLibrary &library, AssetShelf &shelf)
void build_tree() override
ui::BasicTreeViewItem & build_catalog_items_recursive(ui::TreeViewOrItem &parent_view_item, const asset_system::AssetCatalogTreeItem &catalog_item) const
int count_parents() const
void uncollapse_by_default()
void set_popup_keep_open()
void set_is_active_fn(IsActiveFn is_active_fn)
void set_on_activate_fn(ActivateFn fn)
static void build_tree_view(const bContext &C, AbstractTreeView &tree_view, Layout &layout, bool add_box=true)
ItemT & add_tree_item(Args &&...args)
#define storage(slot, qualifiers)
AssetLibraryReference all_library_reference()
void storage_fetch(const AssetLibraryReference *library_reference, const bContext *C)
asset_system::AssetLibrary * library_get_once_available(const AssetLibraryReference &library_reference)
void asset_reading_region_listen_fn(const wmRegionListenerParams *params)
static void popover_panel_draw(const bContext *C, Panel *panel)
static AssetShelf * get_shelf_for_popup(const bContext &C, AssetShelfType &shelf_type)
AssetShelfType * type_find_from_idname(StringRef idname)
static AssetShelfType * lookup_type_from_idname_in_context(const bContext *C)
bool settings_is_all_catalog_active(const AssetShelfSettings &settings)
AssetShelf * create_shelf_from_type(AssetShelfType &type)
void type_popup_unlink(const AssetShelfType &shelf_type)
void popover_panel_register(ARegionType *region_type)
AssetLibraryReference & settings_ensure_valid_library_ref(AssetShelfSettings &settings)
static int layout_width_units_clamped(const wmWindow *win)
void settings_set_all_catalog_active(AssetShelfSettings &settings)
static bool popover_panel_poll(const bContext *C, PanelType *)
static AssetShelf * lookup_shelf_for_popup(const bContext &C, const AssetShelfType &shelf_type)
AssetShelfType * ensure_shelf_has_type(AssetShelf &shelf)
void build_asset_view(ui::Layout &layout, const AssetLibraryReference &library_ref, const AssetShelf &shelf, const bContext &C)
constexpr int RIGHT_COL_WIDTH_UNITS_DEFAULT
bool settings_is_active_catalog(const AssetShelfSettings &settings, const asset_system::AssetCatalogPath &path)
void send_redraw_notifier(const bContext &C)
bool type_poll_for_popup(const bContext &C, const AssetShelfType *shelf_type)
void ensure_asset_library_fetched(const bContext &C, const AssetShelfType &shelf_type)
constexpr int LEFT_COL_WIDTH_UNITS
void library_selector_draw(const bContext *C, ui::Layout &layout, AssetShelf &shelf)
static void catalog_tree_draw(const bContext &C, ui::Layout &layout, AssetShelf &shelf)
void settings_set_active_catalog(AssetShelfSettings &settings, const asset_system::AssetCatalogPath &path)
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)
@ ITEM_R_TEXT_BUT_FORCE_SEMI_MODAL_ACTIVE
TreeViewItemContainer TreeViewOrItem
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool WM_paneltype_add(PanelType *pt)
wmWindow * CTX_wm_window(const bContext *C)
int WM_window_native_pixel_x(const wmWindow *win)
std::optional< StringRefNull > CTX_data_string_get(const bContext *C, const char *member)
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 BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
bScreen * CTX_wm_screen(const bContext *C)
ListBaseT< PanelType > paneltypes
AssetShelfSettings_DisplayFlag display_flag
char idname[BKE_ST_MAXNAME]
AssetShelfSettings settings
char translation_context[BKE_ST_MAXNAME]
void(*) listener(const wmRegionListenerParams *params)
void(*) draw(const bContext *C, Panel *panel)
bool(*) poll(const bContext *C, PanelType *pt)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
void fixed_size_set(bool fixed_size)
void ui_units_x_set(float width)
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)
Layout & column(bool align)
void context_ptr_set(StringRef name, const PointerRNA *ptr)