25#include "RNA_prototypes.hh"
52 if (shelf->type == &shelf_type) {
53 shelf->type =
nullptr;
76 popup_shelves.
append(new_shelf);
95 return (!shelf_.type->asset_poll || shelf_.type->asset_poll(shelf_.type, &asset));
107 item.disable_interaction();
116 all_item.set_is_active_fn(
118 all_item.uncollapse_by_default();
149 if (parent_count < 3) {
169 "asset shelf catalog tree view",
170 std::make_unique<AssetCatalogTreeView>(*library, shelf));
202 BLI_assert_msg(shelf_type !=
nullptr,
"couldn't find asset shelf type from context");
265 PanelType *pt = MEM_cnew<PanelType>(__func__);
269 pt->
description =
N_(
"Display an asset shelf in a popover panel");
bScreen * CTX_wm_screen(const bContext *C)
ARegion * CTX_wm_region_popup(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
std::optional< blender::StringRefNull > CTX_data_string_get(const bContext *C, const char *member)
#define ASSET_SHELF_PREVIEW_SIZE_DEFAULT
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define STRNCPY(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
blender::ui::AbstractGridView * UI_block_add_view(uiBlock &block, blender::StringRef idname, std::unique_ptr< blender::ui::AbstractGridView > grid_view)
void uiLayoutSetFixedSize(uiLayout *layout, bool fixed_size)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiLayoutSetUnitsX(uiLayout *layout, float unit)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_TEXT_BUT_FORCE_SEMI_MODAL_ACTIVE
void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *ptr)
void append(const T &value)
const std::string & str() const
void foreach_child(ItemIterFn callback) const
AssetCatalogPath catalog_path() const
StringRefNull get_name() const
void foreach_root_item(ItemIterFn callback) 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(AbstractTreeView &tree_view, uiLayout &layout, std::optional< StringRef > search_string={}, bool add_box=true)
ItemT & add_tree_item(Args &&...args)
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(const StringRef idname)
static AssetShelfType * lookup_type_from_idname_in_context(const bContext *C)
void build_asset_view(uiLayout &layout, const AssetLibraryReference &library_ref, const AssetShelf &shelf, const bContext &C, const ARegion ®ion)
bool settings_is_all_catalog_active(const AssetShelfSettings &settings)
AssetShelf * create_shelf_from_type(AssetShelfType &type)
static void catalog_tree_draw(uiLayout &layout, AssetShelf &shelf)
void type_popup_unlink(const AssetShelfType &shelf_type)
void popover_panel_register(ARegionType *region_type)
void library_selector_draw(const bContext *C, uiLayout *layout, AssetShelf &shelf)
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 *)
AssetShelfType * ensure_shelf_has_type(AssetShelf &shelf)
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)
constexpr int LEFT_COL_WIDTH_UNITS
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, 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
char idname[BKE_ST_MAXNAME]
AssetShelfSettings settings
void(* draw)(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
bool(* poll)(const bContext *C, PanelType *pt)
void(* listener)(const wmRegionListenerParams *params)
char translation_context[BKE_ST_MAXNAME]
blender::float2 offset_units_xy
char label[BKE_ST_MAXNAME]
bool WM_paneltype_add(PanelType *pt)
PanelType * WM_paneltype_find(const char *idname, bool quiet)
int WM_window_native_pixel_x(const wmWindow *win)