Commit: 0af08cea40964b69a48a2be773aeb22304d2b46f
Author: Julian Eisel
Date: Tue Jul 20 21:18:10 2021 +0200
Branches: master
https://developer.blender.org/rB0af08cea40964b69a48a2be773aeb22304d2b46f
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).
===================================================================
M source/blender/editors/asset/asset_list.cc
M source/blender/editors/interface/interface_template_asset_view.cc
===================================================================
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,
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs