Cleanup: Use asset utility function to get the asset .blend path

For this to work, the utility function needs to be callable without
context, which is only needed for a File Browser specific hack anyway
(doesn't apply to this usage of it).
This commit is contained in:
Julian Eisel 2021-07-20 21:18:10 +02:00
parent e99801390c
commit 0af08cea40
2 changed files with 3 additions and 5 deletions

View File

@ -500,7 +500,7 @@ std::string ED_assetlist_asset_filepath_get(const bContext *C,
return {};
}
const char *library_path = ED_assetlist_library_path(&library_reference);
if (!library_path) {
if (!library_path && C) {
library_path = assetlist_library_path_from_sfile_get_hack(C);
}
if (!library_path) {

View File

@ -58,12 +58,10 @@ static void asset_view_item_but_drag_set(uiBut *but,
return;
}
const blender::StringRef asset_list_path = ED_assetlist_library_path(&list_data->asset_library);
char blend_path[FILE_MAX_LIBEXTRA];
ED_asset_handle_get_full_library_path(NULL, &list_data->asset_library, asset_handle, blend_path);
char path[FILE_MAX_LIBEXTRA];
BLI_join_dirfile(path, sizeof(path), asset_list_path.data(), asset_handle->file_data->relpath);
if (BLO_library_path_explode(path, blend_path, nullptr, nullptr)) {
if (blend_path[0]) {
ImBuf *imbuf = ED_assetlist_asset_image_get(asset_handle);
UI_but_drag_set_asset(but,
asset_handle->file_data->name,