WIP: Rewrite asset browser as separate editor #104978

Closed
Julian Eisel wants to merge 68 commits from asset-browser-grid-view into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
7 changed files with 131 additions and 137 deletions
Showing only changes of commit f5f95f5a03 - Show all commits

View File

@ -12,6 +12,7 @@
extern "C" {
#endif
struct AssetCatalogFilterSettings;
struct AssetLibraryReference;
struct ID;
struct bContext;
@ -51,8 +52,8 @@ void ED_assetlist_storage_id_remap(struct ID *id_old, struct ID *id_new);
*/
void ED_assetlist_storage_exit(void);
AssetHandle ED_assetlist_asset_get_by_index(const AssetLibraryReference *library_reference,
int asset_index);
AssetHandle *ED_assetlist_asset_get_by_index(const AssetLibraryReference *library_reference,
int asset_index);
struct PreviewImage *ED_assetlist_asset_preview_request(
const struct AssetLibraryReference *library_reference, AssetHandle *asset_handle);

View File

@ -29,16 +29,13 @@ class AssetLibrary;
blender::asset_system::AssetLibrary *ED_assetlist_library_get_once_available(
const AssetLibraryReference &library_reference);
AssetHandle *ED_assetlist_asset_get_from_index(const AssetLibraryReference *library_reference,
int index);
/* Can return false to stop iterating. */
using AssetListIterFn = blender::FunctionRef<bool(AssetHandle)>;
using AssetListIterFn = blender::FunctionRef<bool(AssetHandle &)>;
/**
* Iterate the currently loaded assets for the referenced asset library, calling \a fn for each
* asset. This may be executed while the asset list is loading asynchronously. Assets will then be
* included as they get done loading.
*
*
* \warning Never keep the asset handle passed to \a fn outside of \a fn's scope. While iterating,
* the file data wrapped by the asset handle can be freed, since the file cache has a maximum size.
*/

View File

@ -95,7 +95,7 @@ class AssetList : NonCopyable {
void setCatalogFilterSettings(const AssetCatalogFilterSettings &settings);
void clear(bContext *C);
AssetHandle asset_get_by_index(int index) const;
AssetHandle *asset_get_by_index(int index) const;
bool needsRefetch() const;
bool isLoaded() const;
@ -225,9 +225,13 @@ void AssetList::clear(bContext *C)
WM_main_add_notifier(NC_ASSET | ND_ASSET_LIST, nullptr);
}
AssetHandle AssetList::asset_get_by_index(int index) const
AssetHandle *AssetList::asset_get_by_index(int index) const
{
return {filelist_file(filelist_, index)};
FileDirEntry *file = filelist_file(filelist_, index);
if (!file) {
return nullptr;
}
return &asset_handle_from_file(*file);
}
/**
@ -459,8 +463,8 @@ asset_system::AssetLibrary *ED_assetlist_library_get_once_available(
return list->asset_library();
}
AssetHandle ED_assetlist_asset_get_by_index(const AssetLibraryReference *library_reference,
int asset_index)
AssetHandle *ED_assetlist_asset_get_by_index(const AssetLibraryReference *library_reference,
int asset_index)
{
const AssetList *list = AssetListStorage::lookup_list(*library_reference);
return list->asset_get_by_index(asset_index);
@ -507,29 +511,6 @@ ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle)
return filelist_geticon_image_ex(asset_handle->file_data);
}
AssetHandle *ED_assetlist_asset_get_from_index(const AssetLibraryReference *library_reference,
const int index)
{
AssetList *list = AssetListStorage::lookup_list(*library_reference);
if (!list) {
return nullptr;
}
AssetHandle *asset = nullptr;
int i = 0;
list->iterate([&](AssetHandle &iter_asset) {
if (i == index) {
asset = &iter_asset;
return false;
}
i++;
return true;
});
return asset;
}
AssetLibrary *ED_assetlist_library_get(const AssetLibraryReference *library_reference)
{
AssetList *list = AssetListStorage::lookup_list(*library_reference);

View File

@ -80,7 +80,8 @@ static void asset_view_draw_item(uiList *ui_list,
{
AssetViewListData *list_data = (AssetViewListData *)ui_list->dyn_data->customdata;
AssetHandle asset_handle = ED_assetlist_asset_get_by_index(&list_data->asset_library_ref, index);
AssetHandle asset_handle = *ED_assetlist_asset_get_by_index(&list_data->asset_library_ref,
index);
PointerRNA file_ptr;
RNA_pointer_create(&list_data->screen->id,
@ -93,26 +94,29 @@ static void asset_view_draw_item(uiList *ui_list,
const bool show_names = list_data->show_names;
const int size_x = UI_preview_tile_size_x();
const int size_y = show_names ? UI_preview_tile_size_y() : UI_preview_tile_size_y_no_label();
uiBut *but = uiDefIconTextBut(block,
UI_BTYPE_PREVIEW_TILE,
0,
ED_assetlist_asset_preview_icon_id_request(&list_data->asset_library_ref, asset_handle),
show_names ? ED_asset_handle_get_name(&asset_handle) : "",
0,
0,
size_x,
size_y,
nullptr,
0,
0,
0,
0,
"");
ui_def_but_icon(but,ED_assetlist_asset_preview_icon_id_request(&list_data->asset_library_ref, asset_handle),
/* NOLINTNEXTLINE: bugprone-suspicious-enum-usage */
UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
uiBut *but = uiDefIconTextBut(
block,
UI_BTYPE_PREVIEW_TILE,
0,
ED_assetlist_asset_preview_icon_id_request(&list_data->asset_library_ref, &asset_handle),
show_names ? ED_asset_handle_get_name(&asset_handle) : "",
0,
0,
size_x,
size_y,
nullptr,
0,
0,
0,
0,
"");
ui_def_but_icon(
but,
ED_assetlist_asset_preview_icon_id_request(&list_data->asset_library_ref, &asset_handle),
/* NOLINTNEXTLINE: bugprone-suspicious-enum-usage */
UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
if (!ui_list->dyn_data->custom_drag_optype) {
asset_view_item_but_drag_set(but, &asset_handle);
asset_view_item_but_drag_set(but, list_data, &asset_handle);
}
}
@ -131,8 +135,8 @@ static void asset_view_filter_items(uiList *ui_list,
C,
[&name_filter, list_data, &filter_settings](
const PointerRNA &itemptr, blender::StringRefNull name, int index) {
AssetHandle asset = ED_assetlist_asset_get_by_index(&list_data->asset_library_ref, index);
if (!ED_asset_filter_matches_asset(&filter_settings, &asset)) {
AssetHandle *asset = ED_assetlist_asset_get_by_index(&list_data->asset_library_ref, index);
if (!ED_asset_filter_matches_asset(&filter_settings, asset)) {
return UI_LIST_ITEM_NEVER_SHOW;
}
return name_filter(itemptr, name, index);
@ -140,8 +144,8 @@ static void asset_view_filter_items(uiList *ui_list,
dataptr,
propname,
[list_data](const PointerRNA & /*itemptr*/, int index) -> std::string {
AssetHandle asset = ED_assetlist_asset_get_by_index(&list_data->asset_library_ref, index);
return ED_asset_handle_get_name(&asset);
AssetHandle *asset = ED_assetlist_asset_get_by_index(&list_data->asset_library_ref, index);
return ED_asset_handle_get_name(asset);
});
}

View File

@ -54,7 +54,7 @@ class AssetCatalogTreeView : public ui::AbstractTreeView {
wmMsgBus *msg_bus_;
friend class AssetCatalogTreeViewItem;
friend class AssetCatalogDropController;
friend class AssetCatalogDropTarget;
friend class AssetCatalogTreeViewAllItem;
public:
@ -102,7 +102,7 @@ class AssetCatalogTreeViewItem : public ui::BasicTreeViewItem {
/** Add drag support for catalog items. */
std::unique_ptr<ui::AbstractViewItemDragController> create_drag_controller() const override;
/** Add dropping support for catalog items. */
std::unique_ptr<ui::AbstractViewItemDropController> create_drop_controller() const override;
std::unique_ptr<ui::AbstractViewItemDropTarget> create_drop_target() override;
};
class AssetCatalogDragController : public ui::AbstractViewItemDragController {
@ -117,20 +117,22 @@ class AssetCatalogDragController : public ui::AbstractViewItemDragController {
void on_drag_start() override;
};
class AssetCatalogDropController : public ui::AbstractViewItemDropController {
class AssetCatalogDropTarget : public ui::AbstractViewItemDropTarget {
AssetCatalogTreeItem &catalog_item_;
public:
AssetCatalogDropController(AssetCatalogTreeView &tree_view, AssetCatalogTreeItem &catalog_item);
AssetCatalogDropTarget(AssetCatalogTreeView &tree_view, AssetCatalogTreeItem &catalog_item);
bool can_drop(const wmDrag &drag, const char **r_disabled_hint) const override;
std::string drop_tooltip(const wmDrag &drag) const override;
bool on_drop(struct bContext *C, const wmDrag &drag) override;
bool on_drop(struct bContext *C, const wmDrag &drag) const override;
::AssetLibrary &get_asset_library() const;
static AssetCatalog *get_drag_catalog(const wmDrag &drag, const ::AssetLibrary &asset_library);
static bool has_droppable_asset(const wmDrag &drag, const char **r_disabled_hint);
static bool can_modify_catalogs(const ::AssetLibrary &asset_library,
const char **r_disabled_hint);
static bool drop_assets_into_catalog(struct bContext *C,
AssetCatalogTreeView &tree_view,
const wmDrag &drag,
@ -156,29 +158,29 @@ class AssetCatalogTreeViewAllItem : public ui::BasicTreeViewItem {
void build_row(uiLayout &row) override;
struct DropController : public ui::AbstractViewItemDropController {
DropController(AssetCatalogTreeView &tree_view);
struct DropTarget : public ui::AbstractViewItemDropTarget {
DropTarget(AssetCatalogTreeView &tree_view);
bool can_drop(const wmDrag &drag, const char **r_disabled_hint) const override;
std::string drop_tooltip(const wmDrag &drag) const override;
bool on_drop(struct bContext *C, const wmDrag &drag) override;
bool on_drop(struct bContext *C, const wmDrag &drag) const override;
};
std::unique_ptr<ui::AbstractViewItemDropController> create_drop_controller() const override;
std::unique_ptr<ui::AbstractViewItemDropTarget> create_drop_target() override;
};
class AssetCatalogTreeViewUnassignedItem : public ui::BasicTreeViewItem {
using BasicTreeViewItem::BasicTreeViewItem;
struct DropController : public ui::AbstractViewItemDropController {
DropController(AssetCatalogTreeView &tree_view);
struct DropTarget : public ui::AbstractViewItemDropTarget {
DropTarget(AssetCatalogTreeView &tree_view);
bool can_drop(const wmDrag &drag, const char **r_disabled_hint) const override;
std::string drop_tooltip(const wmDrag &drag) const override;
bool on_drop(struct bContext *C, const wmDrag &drag) override;
bool on_drop(struct bContext *C, const wmDrag &drag) const override;
};
std::unique_ptr<ui::AbstractViewItemDropController> create_drop_controller() const override;
std::unique_ptr<ui::AbstractViewItemDropTarget> create_drop_target() override;
};
/* ---------------------------------------------------------------------- */
@ -371,7 +373,9 @@ void AssetCatalogTreeViewItem::build_context_menu(bContext &C, uiLayout &column)
bool AssetCatalogTreeViewItem::supports_renaming() const
{
return true;
const AssetCatalogTreeView &tree_view = static_cast<const AssetCatalogTreeView &>(
get_tree_view());
return !ED_asset_catalogs_read_only(*tree_view.asset_library_);
}
bool AssetCatalogTreeViewItem::rename(StringRefNull new_name)
@ -385,10 +389,9 @@ bool AssetCatalogTreeViewItem::rename(StringRefNull new_name)
return true;
}
std::unique_ptr<ui::AbstractViewItemDropController> AssetCatalogTreeViewItem::
create_drop_controller() const
std::unique_ptr<ui::AbstractViewItemDropTarget> AssetCatalogTreeViewItem::create_drop_target()
{
return std::make_unique<AssetCatalogDropController>(
return std::make_unique<AssetCatalogDropTarget>(
static_cast<AssetCatalogTreeView &>(get_tree_view()), catalog_item_);
}
@ -401,16 +404,21 @@ std::unique_ptr<ui::AbstractViewItemDragController> AssetCatalogTreeViewItem::
/* ---------------------------------------------------------------------- */
AssetCatalogDropController::AssetCatalogDropController(AssetCatalogTreeView &tree_view,
AssetCatalogTreeItem &catalog_item)
: ui::AbstractViewItemDropController(tree_view), catalog_item_(catalog_item)
AssetCatalogDropTarget::AssetCatalogDropTarget(AssetCatalogTreeView &tree_view,
AssetCatalogTreeItem &catalog_item)
: ui::AbstractViewItemDropTarget(tree_view), catalog_item_(catalog_item)
{
}
bool AssetCatalogDropController::can_drop(const wmDrag &drag, const char **r_disabled_hint) const
bool AssetCatalogDropTarget::can_drop(const wmDrag &drag, const char **r_disabled_hint) const
{
if (drag.type == WM_DRAG_ASSET_CATALOG) {
const AssetCatalog *drag_catalog = get_drag_catalog(drag, get_asset_library());
const ::AssetLibrary &library = get_asset_library();
if (!can_modify_catalogs(library, r_disabled_hint)) {
return false;
}
const AssetCatalog *drag_catalog = get_drag_catalog(drag, library);
/* NOTE: Technically it's not an issue to allow this (the catalog will just receive a new
* path and the catalog system will generate missing parents from the path). But it does
* appear broken to users, so disabling entirely. */
@ -430,7 +438,7 @@ bool AssetCatalogDropController::can_drop(const wmDrag &drag, const char **r_dis
return false;
}
std::string AssetCatalogDropController::drop_tooltip(const wmDrag &drag) const
std::string AssetCatalogDropTarget::drop_tooltip(const wmDrag &drag) const
{
if (drag.type == WM_DRAG_ASSET_CATALOG) {
return drop_tooltip_asset_catalog(drag);
@ -438,7 +446,7 @@ std::string AssetCatalogDropController::drop_tooltip(const wmDrag &drag) const
return drop_tooltip_asset_list(drag);
}
std::string AssetCatalogDropController::drop_tooltip_asset_catalog(const wmDrag &drag) const
std::string AssetCatalogDropTarget::drop_tooltip_asset_catalog(const wmDrag &drag) const
{
BLI_assert(drag.type == WM_DRAG_ASSET_CATALOG);
const AssetCatalog *src_catalog = get_drag_catalog(drag, get_asset_library());
@ -447,7 +455,7 @@ std::string AssetCatalogDropController::drop_tooltip_asset_catalog(const wmDrag
TIP_("into") + " '" + catalog_item_.get_name() + "'";
}
std::string AssetCatalogDropController::drop_tooltip_asset_list(const wmDrag &drag) const
std::string AssetCatalogDropTarget::drop_tooltip_asset_list(const wmDrag &drag) const
{
BLI_assert(drag.type == WM_DRAG_ASSET_LIST);
@ -470,7 +478,7 @@ std::string AssetCatalogDropController::drop_tooltip_asset_list(const wmDrag &dr
return basic_tip;
}
bool AssetCatalogDropController::on_drop(struct bContext *C, const wmDrag &drag)
bool AssetCatalogDropTarget::on_drop(struct bContext *C, const wmDrag &drag) const
{
if (drag.type == WM_DRAG_ASSET_CATALOG) {
return drop_asset_catalog_into_catalog(
@ -483,7 +491,7 @@ bool AssetCatalogDropController::on_drop(struct bContext *C, const wmDrag &drag)
catalog_item_.get_simple_name());
}
bool AssetCatalogDropController::drop_asset_catalog_into_catalog(
bool AssetCatalogDropTarget::drop_asset_catalog_into_catalog(
const wmDrag &drag,
AssetCatalogTreeView &tree_view,
const std::optional<CatalogID> drop_catalog_id)
@ -498,11 +506,11 @@ bool AssetCatalogDropController::drop_asset_catalog_into_catalog(
return true;
}
bool AssetCatalogDropController::drop_assets_into_catalog(struct bContext *C,
AssetCatalogTreeView &tree_view,
const wmDrag &drag,
CatalogID catalog_id,
StringRefNull simple_name)
bool AssetCatalogDropTarget::drop_assets_into_catalog(struct bContext *C,
AssetCatalogTreeView &tree_view,
const wmDrag &drag,
CatalogID catalog_id,
StringRefNull simple_name)
{
BLI_assert(drag.type == WM_DRAG_ASSET_LIST);
const ListBase *asset_drags = WM_drag_asset_list_get(&drag);
@ -535,8 +543,8 @@ bool AssetCatalogDropController::drop_assets_into_catalog(struct bContext *C,
return true;
}
AssetCatalog *AssetCatalogDropController::get_drag_catalog(const wmDrag &drag,
const ::AssetLibrary &asset_library)
AssetCatalog *AssetCatalogDropTarget::get_drag_catalog(const wmDrag &drag,
const ::AssetLibrary &asset_library)
{
if (drag.type != WM_DRAG_ASSET_CATALOG) {
return nullptr;
@ -548,8 +556,7 @@ AssetCatalog *AssetCatalogDropController::get_drag_catalog(const wmDrag &drag,
return catalog_service->find_catalog(catalog_drag->drag_catalog_id);
}
bool AssetCatalogDropController::has_droppable_asset(const wmDrag &drag,
const char **r_disabled_hint)
bool AssetCatalogDropTarget::has_droppable_asset(const wmDrag &drag, const char **r_disabled_hint)
{
const ListBase *asset_drags = WM_drag_asset_list_get(&drag);
@ -565,7 +572,17 @@ bool AssetCatalogDropController::has_droppable_asset(const wmDrag &drag,
return false;
}
::AssetLibrary &AssetCatalogDropController::get_asset_library() const
bool AssetCatalogDropTarget::can_modify_catalogs(const ::AssetLibrary &library,
const char **r_disabled_hint)
{
if (ED_asset_catalogs_read_only(library)) {
*r_disabled_hint = "Catalogs cannot be edited in this asset library";
return false;
}
return true;
}
::AssetLibrary &AssetCatalogDropTarget::get_asset_library() const
{
return *get_view<AssetCatalogTreeView>().asset_library_;
}
@ -614,27 +631,29 @@ void AssetCatalogTreeViewAllItem::build_row(uiLayout &row)
RNA_string_set(props, "parent_path", nullptr);
}
std::unique_ptr<ui::AbstractViewItemDropController> AssetCatalogTreeViewAllItem::
create_drop_controller() const
std::unique_ptr<ui::AbstractViewItemDropTarget> AssetCatalogTreeViewAllItem::create_drop_target()
{
return std::make_unique<AssetCatalogTreeViewAllItem::DropController>(
return std::make_unique<AssetCatalogTreeViewAllItem::DropTarget>(
static_cast<AssetCatalogTreeView &>(get_tree_view()));
}
AssetCatalogTreeViewAllItem::DropController::DropController(AssetCatalogTreeView &tree_view)
: ui::AbstractViewItemDropController(tree_view)
AssetCatalogTreeViewAllItem::DropTarget::DropTarget(AssetCatalogTreeView &tree_view)
: ui::AbstractViewItemDropTarget(tree_view)
{
}
bool AssetCatalogTreeViewAllItem::DropController::can_drop(const wmDrag &drag,
const char **r_disabled_hint) const
bool AssetCatalogTreeViewAllItem::DropTarget::can_drop(const wmDrag &drag,
const char **r_disabled_hint) const
{
if (drag.type != WM_DRAG_ASSET_CATALOG) {
return false;
}
::AssetLibrary &library = *get_view<AssetCatalogTreeView>().asset_library_;
if (!AssetCatalogDropTarget::can_modify_catalogs(library, r_disabled_hint)) {
return false;
}
const AssetCatalog *drag_catalog = AssetCatalogDropController::get_drag_catalog(
drag, *get_view<AssetCatalogTreeView>().asset_library_);
const AssetCatalog *drag_catalog = AssetCatalogDropTarget::get_drag_catalog(drag, library);
if (drag_catalog->path.parent() == "") {
*r_disabled_hint = "Catalog is already placed at the highest level";
return false;
@ -643,21 +662,21 @@ bool AssetCatalogTreeViewAllItem::DropController::can_drop(const wmDrag &drag,
return true;
}
std::string AssetCatalogTreeViewAllItem::DropController::drop_tooltip(const wmDrag &drag) const
std::string AssetCatalogTreeViewAllItem::DropTarget::drop_tooltip(const wmDrag &drag) const
{
BLI_assert(drag.type == WM_DRAG_ASSET_CATALOG);
const AssetCatalog *drag_catalog = AssetCatalogDropController::get_drag_catalog(
const AssetCatalog *drag_catalog = AssetCatalogDropTarget::get_drag_catalog(
drag, *get_view<AssetCatalogTreeView>().asset_library_);
return std::string(TIP_("Move Catalog")) + " '" + drag_catalog->path.name() + "' " +
TIP_("to the top level of the tree");
}
bool AssetCatalogTreeViewAllItem::DropController::on_drop(struct bContext * /*C*/,
const wmDrag &drag)
bool AssetCatalogTreeViewAllItem::DropTarget::on_drop(struct bContext * /*C*/,
const wmDrag &drag) const
{
BLI_assert(drag.type == WM_DRAG_ASSET_CATALOG);
return AssetCatalogDropController::drop_asset_catalog_into_catalog(
return AssetCatalogDropTarget::drop_asset_catalog_into_catalog(
drag,
get_view<AssetCatalogTreeView>(),
/* No value to drop into the root level. */
@ -666,29 +685,28 @@ bool AssetCatalogTreeViewAllItem::DropController::on_drop(struct bContext * /*C*
/* ---------------------------------------------------------------------- */
std::unique_ptr<ui::AbstractViewItemDropController> AssetCatalogTreeViewUnassignedItem::
create_drop_controller() const
std::unique_ptr<ui::AbstractViewItemDropTarget> AssetCatalogTreeViewUnassignedItem::
create_drop_target()
{
return std::make_unique<AssetCatalogTreeViewUnassignedItem::DropController>(
return std::make_unique<AssetCatalogTreeViewUnassignedItem::DropTarget>(
static_cast<AssetCatalogTreeView &>(get_tree_view()));
}
AssetCatalogTreeViewUnassignedItem::DropController::DropController(AssetCatalogTreeView &tree_view)
: ui::AbstractViewItemDropController(tree_view)
AssetCatalogTreeViewUnassignedItem::DropTarget::DropTarget(AssetCatalogTreeView &tree_view)
: ui::AbstractViewItemDropTarget(tree_view)
{
}
bool AssetCatalogTreeViewUnassignedItem::DropController::can_drop(
const wmDrag &drag, const char **r_disabled_hint) const
bool AssetCatalogTreeViewUnassignedItem::DropTarget::can_drop(const wmDrag &drag,
const char **r_disabled_hint) const
{
if (drag.type != WM_DRAG_ASSET_LIST) {
return false;
}
return AssetCatalogDropController::has_droppable_asset(drag, r_disabled_hint);
return AssetCatalogDropTarget::has_droppable_asset(drag, r_disabled_hint);
}
std::string AssetCatalogTreeViewUnassignedItem::DropController::drop_tooltip(
const wmDrag &drag) const
std::string AssetCatalogTreeViewUnassignedItem::DropTarget::drop_tooltip(const wmDrag &drag) const
{
const ListBase *asset_drags = WM_drag_asset_list_get(&drag);
const bool is_multiple_assets = !BLI_listbase_is_single(asset_drags);
@ -697,11 +715,11 @@ std::string AssetCatalogTreeViewUnassignedItem::DropController::drop_tooltip(
TIP_("Move asset out of any catalog");
}
bool AssetCatalogTreeViewUnassignedItem::DropController::on_drop(struct bContext *C,
const wmDrag &drag)
bool AssetCatalogTreeViewUnassignedItem::DropTarget::on_drop(struct bContext *C,
const wmDrag &drag) const
{
/* Assign to nil catalog ID. */
return AssetCatalogDropController::drop_assets_into_catalog(
return AssetCatalogDropTarget::drop_assets_into_catalog(
C, get_view<AssetCatalogTreeView>(), drag, CatalogID{});
}
@ -725,6 +743,5 @@ void asset_view_create_catalog_tree_view_in_layout(::AssetLibrary *asset_library
std::make_unique<ed::asset_browser::AssetCatalogTreeView>(
asset_library, *catalog_filter_owner_ptr, *catalog_filter_prop, msg_bus));
ui::TreeViewBuilder builder(*block);
builder.build_tree_view(*tree_view);
ui::TreeViewBuilder::build_tree_view(*tree_view, *layout);
}

View File

@ -96,7 +96,7 @@ void asset_view_create_in_layout(const bContext &C,
CTX_wm_message_bus(&C)));
ui::GridViewBuilder builder(*block);
builder.build_grid_view(*grid_view, v2d);
builder.build_grid_view(*grid_view, v2d, layout);
}
} // namespace blender::ed::asset_browser

View File

@ -85,13 +85,9 @@ static SpaceLink *asset_browser_create(const ScrArea * /*area*/, const Scene * /
return (SpaceLink *)assets_space;
}
static void asset_browser_free(SpaceLink * /*sl*/)
{
}
static void asset_browser_free(SpaceLink * /*sl*/) {}
static void asset_browser_init(wmWindowManager * /*wm*/, ScrArea * /*area*/)
{
}
static void asset_browser_init(wmWindowManager * /*wm*/, ScrArea * /*area*/) {}
static SpaceLink *asset_browser_duplicate(SpaceLink *sl)
{
@ -133,8 +129,8 @@ static int /*eContextResult*/ asset_browser_context(const bContext *C,
}
if (CTX_data_equals(member, "asset_handle")) {
AssetHandle *asset = ED_assetlist_asset_get_from_index(&assets_space->asset_library_ref,
assets_space->active_asset_idx);
AssetHandle *asset = ED_assetlist_asset_get_by_index(&assets_space->asset_library_ref,
assets_space->active_asset_idx);
if (!asset) {
return CTX_RESULT_NO_DATA;
}
@ -204,9 +200,7 @@ static void asset_browser_header_init(wmWindowManager * /*wm*/, ARegion *region)
ED_region_header_init(region);
}
static void asset_browser_header_listener(const wmRegionListenerParams * /*params*/)
{
}
static void asset_browser_header_listener(const wmRegionListenerParams * /*params*/) {}
/* ---------------------------------------------------------------------- */
/* Navigation Region */