From 0af08cea40964b69a48a2be773aeb22304d2b46f Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 20 Jul 2021 21:18:10 +0200 Subject: 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). --- source/blender/editors/asset/asset_list.cc | 2 +- source/blender/editors/interface/interface_template_asset_view.cc | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/asset/asset_list.cc b/source/blender/editors/asset/asset_list.cc index 3095239b711..e610a1dfbcd 100644 --- a/source/blender/editors/asset/asset_list.cc +++ b/source/blender/editors/asset/asset_list.cc @@ -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) { diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc index 1d8420718bb..6fa5300401a 100644 --- a/source/blender/editors/interface/interface_template_asset_view.cc +++ b/source/blender/editors/interface/interface_template_asset_view.cc @@ -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, -- cgit v1.2.3