24#include "RNA_prototypes.hh"
58 import_settings.
method = import_method;
91 asset->ensure_previewable();
101 show_names ?
asset->get_name().c_str() :
"",
123 const char *propname)
133 [&name_filter, list_data, &filter_settings](
141 return name_filter(itemptr, name, index);
145 [list_data](
const PointerRNA & ,
int index) -> std::string {
149 return asset->get_name();
185 const char *assets_propname)
198 RNA_warning(
"Expected a collection property for AssetHandle items");
222 const char *asset_library_propname,
224 const char *assets_propname,
226 const char *active_propname,
228 const int display_flags,
229 const char *activate_opname,
231 const char *drag_opname,
234 if (!list_id || !list_id[0]) {
235 RNA_warning(
"Asset view needs a valid identifier");
242 asset_library_propname);
251 row->
op(
"ASSET_OT_library_refresh",
"", ICON_FILE_REFRESH);
261 "AssetViewListData");
303 if (activate_opname) {
305 list, activate_opname, r_activate_op_properties !=
nullptr);
306 if (r_activate_op_properties &&
ptr) {
307 *r_activate_op_properties = *
ptr;
312 list, drag_opname, r_drag_op_properties !=
nullptr);
313 if (r_drag_op_properties &&
ptr) {
314 *r_drag_op_properties = *
ptr;
Main runtime representation of an asset.
bScreen * CTX_wm_screen(const bContext *C)
char * STRNCPY(char(&dst)[N], const char *src)
@ ASSET_IMPORT_APPEND_REUSE
@ UILST_LAYOUT_BIG_PREVIEW_GRID
void ED_region_tag_redraw(ARegion *region)
Read Guarded memory(de)allocation.
#define RNA_warning(format,...)
@ UI_LIST_ITEM_NEVER_SHOW
void UI_list_filter_and_sort_items(uiList *ui_list, const bContext *C, uiListItemFilterFn item_filter_fn, PointerRNA *dataptr, const char *propname, uiListItemGetNameFn get_name_fn=nullptr)
uiBut * uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< blender::StringRef > tip)
PointerRNA * UI_list_custom_drag_operator_set(uiList *ui_list, blender::StringRefNull opname, bool create_properties)
int UI_preview_tile_size_y(const int size_px=96)
uiList * uiTemplateList_ex(uiLayout *layout, const bContext *C, const char *listtype_name, const char *list_id, PointerRNA *dataptr, blender::StringRefNull propname, PointerRNA *active_dataptr, blender::StringRefNull active_propname, const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns, enum uiTemplateListFlags flags, void *customdata)
void UI_but_dragflag_enable(uiBut *but, int flag)
void UI_but_drag_set_asset(uiBut *but, const blender::asset_system::AssetRepresentation *asset, const AssetImportSettings &import_settings, int icon, int preview_icon)
PointerRNA * UI_list_custom_activate_operator_set(uiList *ui_list, blender::StringRefNull opname, bool create_properties)
int UI_preview_tile_size_x(const int size_px=96)
void UI_but_drag_set_id(uiBut *but, ID *id)
int UI_preview_tile_size_y_no_label(const int size_px=96)
@ UI_TEMPLATE_ASSET_DRAW_NO_NAMES
@ UI_TEMPLATE_ASSET_DRAW_NO_LIBRARY
@ UI_TEMPLATE_ASSET_DRAW_NO_FILTER
@ UI_TEMPLATE_LIST_NO_NAMES
@ UI_TEMPLATE_LIST_NO_FILTER_OPTIONS
@ UI_TEMPLATE_LIST_NO_GRIP
void uiLayoutSetContextPointer(uiLayout *layout, blender::StringRef name, PointerRNA *ptr)
void uiLayoutSetScaleY(uiLayout *layout, float scale)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
void uiLayoutSetScaleX(uiLayout *layout, float scale)
void ui_def_but_icon(uiBut *but, const int icon, const int flag)
static void asset_view_item_but_drag_set(uiBut *but, AssetHandle *asset_handle)
static void asset_view_draw_item(uiList *ui_list, const bContext *, uiLayout *layout, PointerRNA *, PointerRNA *, int, PointerRNA *, const char *, int index, int)
static void asset_view_listener(uiList *, wmRegionListenerParams *params)
uiListType * UI_UL_asset_view()
static void asset_view_filter_items(uiList *ui_list, const bContext *C, PointerRNA *dataptr, const char *propname)
static void populate_asset_collection(const AssetLibraryReference &asset_library_ref, PointerRNA &assets_dataptr, const char *assets_propname)
void uiTemplateAssetView(uiLayout *layout, const bContext *C, const char *list_id, PointerRNA *asset_library_dataptr, const char *asset_library_propname, PointerRNA *assets_dataptr, const char *assets_propname, PointerRNA *active_dataptr, const char *active_propname, const asset::AssetFilterSettings *filter_settings, const int display_flags, const char *activate_opname, PointerRNA *r_activate_op_properties, const char *drag_opname, PointerRNA *r_drag_op_properties)
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void storage_fetch(const AssetLibraryReference *library_reference, const bContext *C)
void storage_tag_main_data_dirty()
int size(const AssetLibraryReference *library_reference)
bool listen(const wmNotifier *notifier)
asset_system::AssetRepresentation * asset_get_by_index(const AssetLibraryReference &library_reference, int asset_index)
AssetHandle asset_handle_get_by_index(const AssetLibraryReference *library_reference, int asset_index)
void iterate(const AssetLibraryReference &library_reference, AssetListIndexIterFn fn)
AssetLibraryReference library_reference_from_enum_value(int value)
asset_system::AssetRepresentation * handle_get_representation(const AssetHandle *asset)
bool filter_matches_asset(const AssetFilterSettings *filter, const blender::asset_system::AssetRepresentation &asset)
BIFIconID asset_preview_or_icon(const asset_system::AssetRepresentation &asset)
BIFIconID asset_preview_icon_id(const asset_system::AssetRepresentation &asset)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
const struct FileDirEntry * file_data
bool use_instance_collections
eAssetImportMethod method
asset::AssetFilterSettings filter_settings
AssetLibraryReference asset_library_ref
blender::ui::EmbossType emboss
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, wmOperatorCallContext context, eUI_Item_Flag flag)
uiLayout & column(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)
struct wmOperatorType * custom_drag_optype
char idname[BKE_ST_MAXNAME]
uiListFilterItemsFunc filter_items
uiListDrawItemFunc draw_item