Assets: Get asset path via new identifier (not via file browser hacks)
With the asset identifier introduced in the previous commit, we can now locate an asset just from its `AssetRepresentation`, without requiring information from the asset library and the file browser storage. With this we can remove some hacks and function parameters. A RNA/BPY function is also affected, but I didn't remove the paramter to keep compatibility. It's simply ignored and not required anymore, noted this in the parameter description (noted for T102877).
This commit is contained in:
@@ -206,12 +206,11 @@ wmDrag *WM_drag_data_create(bContext *C, int icon, int type, void *poin, double
|
||||
/* The asset-list case is special: We get multiple assets from context and attach them to the
|
||||
* drag item. */
|
||||
case WM_DRAG_ASSET_LIST: {
|
||||
const AssetLibraryReference *asset_library = CTX_wm_asset_library_ref(C);
|
||||
ListBase asset_file_links = CTX_data_collection_get(C, "selected_asset_files");
|
||||
LISTBASE_FOREACH (const CollectionPointerLink *, link, &asset_file_links) {
|
||||
const FileDirEntry *asset_file = static_cast<const FileDirEntry *>(link->ptr.data);
|
||||
const AssetHandle asset_handle = {asset_file};
|
||||
WM_drag_add_asset_list_item(drag, C, asset_library, &asset_handle);
|
||||
WM_drag_add_asset_list_item(drag, &asset_handle);
|
||||
}
|
||||
BLI_freelistN(&asset_file_links);
|
||||
break;
|
||||
@@ -711,12 +710,7 @@ wmDragAssetCatalog *WM_drag_get_asset_catalog_data(const wmDrag *drag)
|
||||
return static_cast<wmDragAssetCatalog *>(drag->poin);
|
||||
}
|
||||
|
||||
void WM_drag_add_asset_list_item(
|
||||
wmDrag *drag,
|
||||
/* Context only needed for the hack in #ED_asset_handle_get_full_library_path(). */
|
||||
const bContext *C,
|
||||
const AssetLibraryReference *asset_library_ref,
|
||||
const AssetHandle *asset)
|
||||
void WM_drag_add_asset_list_item(wmDrag *drag, const AssetHandle *asset)
|
||||
{
|
||||
BLI_assert(drag->type == WM_DRAG_ASSET_LIST);
|
||||
|
||||
@@ -731,7 +725,7 @@ void WM_drag_add_asset_list_item(
|
||||
}
|
||||
else {
|
||||
char asset_blend_path[FILE_MAX_LIBEXTRA];
|
||||
ED_asset_handle_get_full_library_path(C, asset_library_ref, asset, asset_blend_path);
|
||||
ED_asset_handle_get_full_library_path(asset, asset_blend_path);
|
||||
drag_asset->is_external = true;
|
||||
drag_asset->asset_data.external_info = WM_drag_create_asset_data(
|
||||
asset, BLI_strdup(asset_blend_path), FILE_ASSET_IMPORT_APPEND);
|
||||
|
||||
Reference in New Issue
Block a user