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 (!shelf_.type->asset_poll || shelf_.type->asset_poll(shelf_.type, &asset));
133 item.disable_interaction();
142 all_item.set_is_active_fn(
144 all_item.uncollapse_by_default();
146 catalog_tree_.foreach_root_item([&,
this](
175 if (parent_count < 3) {
187 shelf.settings.asset_library_reference);
195 "asset shelf catalog tree view",
196 std::make_unique<AssetCatalogTreeView>(*library,
shelf));
228 BLI_assert_msg(shelf_type !=
nullptr,
"couldn't find asset shelf type from context");
241 &screen->
id, &RNA_AssetLibraryReference, &
shelf->settings.asset_library_reference);
255 sub->
prop(&shelf_ptr,
292 pt->
description =
N_(
"Display an asset shelf in a popover panel");
bScreen * CTX_wm_screen(const bContext *C)
wmWindow * CTX_wm_window(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(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define STRNCPY_UTF8(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)
@ UI_ITEM_R_TEXT_BUT_FORCE_SEMI_MODAL_ACTIVE
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, uiLayout &layout, bool add_box=true)
ItemT & add_tree_item(Args &&...args)
void * MEM_callocN(size_t len, const char *str)
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)
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 *)
static AssetShelf * lookup_shelf_for_popup(const bContext &C, const AssetShelfType &shelf_type)
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)
void ensure_asset_library_fetched(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)
void build_asset_view(uiLayout &layout, const AssetLibraryReference &library_ref, const AssetShelf &shelf, const bContext &C)
static void catalog_tree_draw(const bContext &C, uiLayout &layout, AssetShelf &shelf)
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
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
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]
void fixed_size_set(bool fixed_size)
uiLayout & column(bool align)
void context_ptr_set(blender::StringRef name, const PointerRNA *ptr)
void ui_units_x_set(float width)
uiLayout & row(bool align)
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)
int WM_window_native_pixel_x(const wmWindow *win)