diff --git a/release/scripts/startup/bl_operators/assets.py b/release/scripts/startup/bl_operators/assets.py index 1911a98f930..b794ede10a2 100644 --- a/release/scripts/startup/bl_operators/assets.py +++ b/release/scripts/startup/bl_operators/assets.py @@ -97,13 +97,12 @@ class ASSET_OT_open_containing_blend_file(Operator): def execute(self, context): asset_file_handle = context.asset_file_handle - asset_library_ref = context.asset_library_ref if asset_file_handle.local_id: self.report({'WARNING'}, "This asset is stored in the current blend file") return {'CANCELLED'} - asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref) + asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle) self.open_in_new_blender(asset_lib_path) wm = context.window_manager diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 1e7faf68b3f..614f350533b 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -862,8 +862,7 @@ def asset_path_str_get(_self): if asset_file_handle.local_id: return "Current File" - asset_library_ref = bpy.context.asset_library_ref - return bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref) + return bpy.types.AssetHandle.get_full_library_path(asset_file_handle) def register_props(): diff --git a/source/blender/editors/armature/pose_lib_2.c b/source/blender/editors/armature/pose_lib_2.c index e3189eacdd5..1e69d9d0fc2 100644 --- a/source/blender/editors/armature/pose_lib_2.c +++ b/source/blender/editors/armature/pose_lib_2.c @@ -249,16 +249,15 @@ static void poselib_tempload_exit(PoseBlendData *pbd) static bAction *poselib_blend_init_get_action(bContext *C, wmOperator *op) { bool asset_handle_valid; - const AssetLibraryReference *asset_library_ref = CTX_wm_asset_library_ref(C); const AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid); /* Poll callback should check. */ - BLI_assert((asset_library_ref != NULL) && asset_handle_valid); + BLI_assert(asset_handle_valid); PoseBlendData *pbd = op->customdata; pbd->temp_id_consumer = ED_asset_temp_id_consumer_create(&asset_handle); return (bAction *)ED_asset_temp_id_consumer_ensure_local_id( - pbd->temp_id_consumer, C, asset_library_ref, ID_AC, CTX_data_main(C), op->reports); + pbd->temp_id_consumer, ID_AC, CTX_data_main(C), op->reports); } static bAction *flip_pose(bContext *C, Object *ob, bAction *action) @@ -508,11 +507,9 @@ static bool poselib_asset_in_context(bContext *C) { bool asset_handle_valid; /* Check whether the context provides the asset data needed to add a pose. */ - const AssetLibraryReference *asset_library_ref = CTX_wm_asset_library_ref(C); - AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid); + const AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid); - return (asset_library_ref != NULL) && asset_handle_valid && - (ED_asset_handle_get_id_type(&asset_handle) == ID_AC); + return asset_handle_valid && (ED_asset_handle_get_id_type(&asset_handle) == ID_AC); } /* Poll callback for operators that require existing PoseLib data (with poses) to work. */ diff --git a/source/blender/editors/asset/ED_asset_handle.h b/source/blender/editors/asset/ED_asset_handle.h index 4a81840c40d..c11f94a3259 100644 --- a/source/blender/editors/asset/ED_asset_handle.h +++ b/source/blender/editors/asset/ED_asset_handle.h @@ -27,9 +27,7 @@ struct AssetMetaData *ED_asset_handle_get_metadata(const struct AssetHandle *ass struct ID *ED_asset_handle_get_local_id(const struct AssetHandle *asset); ID_Type ED_asset_handle_get_id_type(const struct AssetHandle *asset); int ED_asset_handle_get_preview_icon_id(const struct AssetHandle *asset); -void ED_asset_handle_get_full_library_path(const struct bContext *C, - const struct AssetLibraryReference *asset_library_ref, - const struct AssetHandle *asset, +void ED_asset_handle_get_full_library_path(const struct AssetHandle *asset, char r_full_lib_path[]); #ifdef __cplusplus @@ -41,9 +39,7 @@ void ED_asset_handle_get_full_library_path(const struct bContext *C, namespace blender::ed::asset { /** If the ID already exists in the database, return it, otherwise add it. */ -ID *get_local_id_from_asset_or_append_and_reuse(Main &bmain, - const AssetLibraryReference &library_ref, - AssetHandle asset); +ID *get_local_id_from_asset_or_append_and_reuse(Main &bmain, AssetHandle asset); } // namespace blender::ed::asset diff --git a/source/blender/editors/asset/ED_asset_list.h b/source/blender/editors/asset/ED_asset_list.h index bcd5dbca8d4..635dc3bff32 100644 --- a/source/blender/editors/asset/ED_asset_list.h +++ b/source/blender/editors/asset/ED_asset_list.h @@ -51,7 +51,6 @@ void ED_assetlist_storage_id_remap(struct ID *id_old, struct ID *id_new); void ED_assetlist_storage_exit(void); struct ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle); -const char *ED_assetlist_library_path(const struct AssetLibraryReference *library_reference); /** * \return True if the region needs a UI redraw. diff --git a/source/blender/editors/asset/ED_asset_list.hh b/source/blender/editors/asset/ED_asset_list.hh index 20faf5c495d..541fa315f77 100644 --- a/source/blender/editors/asset/ED_asset_list.hh +++ b/source/blender/editors/asset/ED_asset_list.hh @@ -15,10 +15,6 @@ struct AssetLibraryReference; struct FileDirEntry; struct bContext; -std::string ED_assetlist_asset_filepath_get(const bContext *C, - const AssetLibraryReference &library_reference, - const AssetHandle &asset_handle); - /* Can return false to stop iterating. */ using AssetListIterFn = blender::FunctionRef; void ED_assetlist_iterate(const AssetLibraryReference &library_reference, AssetListIterFn fn); diff --git a/source/blender/editors/asset/ED_asset_temp_id_consumer.h b/source/blender/editors/asset/ED_asset_temp_id_consumer.h index 43a466d51ad..d6ed2509a32 100644 --- a/source/blender/editors/asset/ED_asset_temp_id_consumer.h +++ b/source/blender/editors/asset/ED_asset_temp_id_consumer.h @@ -27,13 +27,10 @@ struct bContext; AssetTempIDConsumer *ED_asset_temp_id_consumer_create(const struct AssetHandle *handle); void ED_asset_temp_id_consumer_free(AssetTempIDConsumer **consumer); -struct ID *ED_asset_temp_id_consumer_ensure_local_id( - AssetTempIDConsumer *consumer, - const struct bContext *C, - const struct AssetLibraryReference *asset_library_ref, - ID_Type id_type, - struct Main *bmain, - struct ReportList *reports); +struct ID *ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer, + ID_Type id_type, + struct Main *bmain, + struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/editors/asset/intern/asset_handle.cc b/source/blender/editors/asset/intern/asset_handle.cc index 73686e02098..3528a3824db 100644 --- a/source/blender/editors/asset/intern/asset_handle.cc +++ b/source/blender/editors/asset/intern/asset_handle.cc @@ -6,7 +6,9 @@ #include +#include "AS_asset_identifier.hh" #include "AS_asset_representation.h" +#include "AS_asset_representation.hh" #include "DNA_space_types.h" @@ -42,14 +44,12 @@ int ED_asset_handle_get_preview_icon_id(const AssetHandle *asset) return asset->file_data->preview_icon_id; } -void ED_asset_handle_get_full_library_path(const bContext *C, - const AssetLibraryReference *asset_library_ref, - const AssetHandle *asset, +void ED_asset_handle_get_full_library_path(const AssetHandle *asset_handle, char r_full_lib_path[FILE_MAX_LIBEXTRA]) { *r_full_lib_path = '\0'; - std::string asset_path = ED_assetlist_asset_filepath_get(C, *asset_library_ref, *asset); + std::string asset_path = AS_asset_representation_full_path_get(asset_handle->file_data->asset); if (asset_path.empty()) { return; } @@ -59,16 +59,14 @@ void ED_asset_handle_get_full_library_path(const bContext *C, namespace blender::ed::asset { -ID *get_local_id_from_asset_or_append_and_reuse(Main &bmain, - const AssetLibraryReference &library_ref, - const AssetHandle asset) +ID *get_local_id_from_asset_or_append_and_reuse(Main &bmain, const AssetHandle asset) { if (ID *local_id = ED_asset_handle_get_local_id(&asset)) { return local_id; } char blend_path[FILE_MAX_LIBEXTRA]; - ED_asset_handle_get_full_library_path(nullptr, &library_ref, &asset, blend_path); + ED_asset_handle_get_full_library_path(&asset, blend_path); const char *id_name = ED_asset_handle_get_name(&asset); return WM_file_append_datablock(&bmain, diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc index bb72c5cc1bb..4a1f26abad0 100644 --- a/source/blender/editors/asset/intern/asset_list.cc +++ b/source/blender/editors/asset/intern/asset_list.cc @@ -22,8 +22,6 @@ #include "BKE_preferences.h" -#include "ED_fileselect.h" - #include "WM_api.h" /* XXX uses private header of file-space. */ @@ -119,7 +117,6 @@ class AssetList : NonCopyable { int size() const; void tagMainDataDirty() const; void remapID(ID *id_old, ID *id_new) const; - StringRef filepath() const; }; AssetList::AssetList(eFileSelectType filesel_type, const AssetLibraryReference &asset_library_ref) @@ -296,11 +293,6 @@ void AssetList::remapID(ID * /*id_old*/, ID * /*id_new*/) const tagMainDataDirty(); } -StringRef AssetList::filepath() const -{ - return filelist_dir(filelist_); -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -465,46 +457,6 @@ void ED_assetlist_iterate(const AssetLibraryReference &library_reference, AssetL } } -/* TODO hack to use the File Browser path, so we can keep all the import logic handled by the asset - * API. Get rid of this once the File Browser is integrated better with the asset list. */ -static const char *assetlist_library_path_from_sfile_get_hack(const bContext *C) -{ - SpaceFile *sfile = CTX_wm_space_file(C); - if (!sfile || !ED_fileselect_is_asset_browser(sfile)) { - return nullptr; - } - - FileAssetSelectParams *asset_select_params = ED_fileselect_get_asset_params(sfile); - if (!asset_select_params) { - return nullptr; - } - - return filelist_dir(sfile->files); -} - -std::string ED_assetlist_asset_filepath_get(const bContext *C, - const AssetLibraryReference &library_reference, - const AssetHandle &asset_handle) -{ - if (ED_asset_handle_get_local_id(&asset_handle) || - !ED_asset_handle_get_metadata(&asset_handle)) { - return {}; - } - const char *library_path = ED_assetlist_library_path(&library_reference); - if (!library_path && C) { - library_path = assetlist_library_path_from_sfile_get_hack(C); - } - if (!library_path) { - return {}; - } - const char *asset_relpath = asset_handle.file_data->relpath; - - char path[FILE_MAX_LIBEXTRA]; - BLI_path_join(path, sizeof(path), library_path, asset_relpath); - - return path; -} - ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle) { ImBuf *imbuf = filelist_file_getimage(asset_handle->file_data); @@ -515,15 +467,6 @@ ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle) return filelist_geticon_image_ex(asset_handle->file_data); } -const char *ED_assetlist_library_path(const AssetLibraryReference *library_reference) -{ - AssetList *list = AssetListStorage::lookup_list(*library_reference); - if (list) { - return list->filepath().data(); - } - return nullptr; -} - bool ED_assetlist_listen(const AssetLibraryReference *library_reference, const wmNotifier *notifier) { diff --git a/source/blender/editors/asset/intern/asset_temp_id_consumer.cc b/source/blender/editors/asset/intern/asset_temp_id_consumer.cc index d1fd48d966c..076a332c472 100644 --- a/source/blender/editors/asset/intern/asset_temp_id_consumer.cc +++ b/source/blender/editors/asset/intern/asset_temp_id_consumer.cc @@ -44,15 +44,11 @@ class AssetTemporaryIDConsumer : NonCopyable, NonMovable { return ED_asset_handle_get_local_id(&handle_); } - ID *import_id(const bContext *C, - const AssetLibraryReference &asset_library_ref, - ID_Type id_type, - Main &bmain, - ReportList &reports) + ID *import_id(ID_Type id_type, Main &bmain, ReportList &reports) { const char *asset_name = ED_asset_handle_get_name(&handle_); char blend_file_path[FILE_MAX_LIBEXTRA]; - ED_asset_handle_get_full_library_path(C, &asset_library_ref, &handle_, blend_file_path); + ED_asset_handle_get_full_library_path(&handle_, blend_file_path); temp_lib_context_ = BLO_library_temp_load_id( &bmain, blend_file_path, id_type, asset_name, &reports); @@ -84,13 +80,11 @@ void ED_asset_temp_id_consumer_free(AssetTempIDConsumer **consumer) } ID *ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer_, - const bContext *C, - const AssetLibraryReference *asset_library_ref, ID_Type id_type, Main *bmain, ReportList *reports) { - if (!(consumer_ && asset_library_ref && bmain && reports)) { + if (!(consumer_ && bmain && reports)) { return nullptr; } AssetTemporaryIDConsumer *consumer = reinterpret_cast(consumer_); @@ -98,5 +92,5 @@ ID *ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer_, if (ID *local_id = consumer->get_local_id()) { return local_id; } - return consumer->import_id(C, *asset_library_ref, id_type, *bmain, *reports); + return consumer->import_id(id_type, *bmain, *reports); } diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc index 2256c7ce148..3e707031dd2 100644 --- a/source/blender/editors/interface/interface_template_asset_view.cc +++ b/source/blender/editors/interface/interface_template_asset_view.cc @@ -36,9 +36,7 @@ struct AssetViewListData { bool show_names; }; -static void asset_view_item_but_drag_set(uiBut *but, - AssetViewListData *list_data, - AssetHandle *asset_handle) +static void asset_view_item_but_drag_set(uiBut *but, AssetHandle *asset_handle) { ID *id = ED_asset_handle_get_local_id(asset_handle); if (id != nullptr) { @@ -49,8 +47,7 @@ static void asset_view_item_but_drag_set(uiBut *but, char blend_path[FILE_MAX_LIBEXTRA]; /* Context can be null here, it's only needed for a File Browser specific hack that should go * away before too long. */ - ED_asset_handle_get_full_library_path( - nullptr, &list_data->asset_library_ref, asset_handle, blend_path); + ED_asset_handle_get_full_library_path(asset_handle, blend_path); if (blend_path[0]) { ImBuf *imbuf = ED_assetlist_asset_image_get(asset_handle); @@ -107,7 +104,7 @@ static void asset_view_draw_item(uiList *ui_list, /* 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, list_data, asset_handle); + asset_view_item_but_drag_set(but, asset_handle); } } diff --git a/source/blender/editors/space_node/add_node_search.cc b/source/blender/editors/space_node/add_node_search.cc index 91e57525f4e..ba060ab3925 100644 --- a/source/blender/editors/space_node/add_node_search.cc +++ b/source/blender/editors/space_node/add_node_search.cc @@ -67,7 +67,6 @@ static void add_node_search_listen_fn(const wmRegionListenerParams *params, void } static void search_items_for_asset_metadata(const bNodeTree &node_tree, - const AssetLibraryReference &library_ref, const AssetHandle asset, Vector &search_items) { @@ -82,10 +81,10 @@ static void search_items_for_asset_metadata(const bNodeTree &node_tree, item.identifier = node_tree.typeinfo->group_idname; item.description = asset_data.description == nullptr ? "" : asset_data.description; item.asset = asset; - item.after_add_fn = [asset, library_ref](const bContext &C, bNodeTree &node_tree, bNode &node) { + item.after_add_fn = [asset](const bContext &C, bNodeTree &node_tree, bNode &node) { Main &bmain = *CTX_data_main(&C); node.flag &= ~NODE_OPTIONS; - node.id = asset::get_local_id_from_asset_or_append_and_reuse(bmain, library_ref, asset); + node.id = asset::get_local_id_from_asset_or_append_and_reuse(bmain, asset); id_us_plus(node.id); BKE_ntree_update_tag_node_property(&node_tree, &node); DEG_relations_tag_update(&bmain); @@ -113,7 +112,7 @@ static void gather_search_items_for_asset_library(const bContext &C, /* If an asset with the same name has already been added, skip this. */ return true; } - search_items_for_asset_metadata(node_tree, library_ref, asset, search_items); + search_items_for_asset_metadata(node_tree, asset, search_items); return true; }); } diff --git a/source/blender/editors/space_node/link_drag_search.cc b/source/blender/editors/space_node/link_drag_search.cc index ffa2d377056..13a68a85ad1 100644 --- a/source/blender/editors/space_node/link_drag_search.cc +++ b/source/blender/editors/space_node/link_drag_search.cc @@ -141,7 +141,6 @@ static void add_existing_group_input_fn(nodes::LinkSearchOpParams ¶ms, */ static void search_link_ops_for_asset_metadata(const bNodeTree &node_tree, const bNodeSocket &socket, - const AssetLibraryReference &library_ref, const AssetHandle asset, Vector &search_link_ops) { @@ -186,13 +185,13 @@ static void search_link_ops_for_asset_metadata(const bNodeTree &node_tree, search_link_ops.append( {asset_name + " " + UI_MENU_ARROW_SEP + socket_name, - [library_ref, asset, socket_property, in_out](nodes::LinkSearchOpParams ¶ms) { + [asset, socket_property, in_out](nodes::LinkSearchOpParams ¶ms) { Main &bmain = *CTX_data_main(¶ms.C); bNode &node = params.add_node(params.node_tree.typeinfo->group_idname); node.flag &= ~NODE_OPTIONS; - node.id = asset::get_local_id_from_asset_or_append_and_reuse(bmain, library_ref, asset); + node.id = asset::get_local_id_from_asset_or_append_and_reuse(bmain, asset); id_us_plus(node.id); BKE_ntree_update_tag_node_property(¶ms.node_tree, &node); DEG_relations_tag_update(&bmain); @@ -232,7 +231,7 @@ static void gather_search_link_ops_for_asset_library(const bContext &C, if (skip_local && ED_asset_handle_get_local_id(&asset) != nullptr) { return true; } - search_link_ops_for_asset_metadata(node_tree, socket, library_ref, asset, search_link_ops); + search_link_ops_for_asset_metadata(node_tree, socket, asset, search_link_ops); return true; }); } diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 5c462581bbb..805342a884a 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -372,17 +372,14 @@ void NODE_OT_add_group(wmOperatorType *ot) /** \name Add Node Group Asset Operator * \{ */ -static bool add_node_group_asset(const bContext &C, - const AssetLibraryReference &library_ref, - const AssetHandle asset, - ReportList &reports) +static bool add_node_group_asset(const bContext &C, const AssetHandle asset, ReportList &reports) { Main &bmain = *CTX_data_main(&C); SpaceNode &snode = *CTX_wm_space_node(&C); bNodeTree &edit_tree = *snode.edittree; bNodeTree *node_group = reinterpret_cast( - asset::get_local_id_from_asset_or_append_and_reuse(bmain, library_ref, asset)); + asset::get_local_id_from_asset_or_append_and_reuse(bmain, asset)); if (!node_group) { return false; } @@ -439,7 +436,7 @@ static int node_add_group_asset_invoke(bContext *C, wmOperator *op, const wmEven snode.runtime->cursor /= UI_DPI_FAC; - if (!add_node_group_asset(*C, *library_ref, handle, *op->reports)) { + if (!add_node_group_asset(*C, handle, *op->reports)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c index d844c419835..e7eb6a022ba 100644 --- a/source/blender/makesrna/intern/rna_asset.c +++ b/source/blender/makesrna/intern/rna_asset.c @@ -273,13 +273,12 @@ static void rna_AssetHandle_file_data_set(PointerRNA *ptr, static void rna_AssetHandle_get_full_library_path( // AssetHandle *asset, - bContext *C, FileDirEntry *asset_file, - AssetLibraryReference *library, + AssetLibraryReference *UNUSED(asset_library), /* Deprecated. */ char r_result[/*FILE_MAX_LIBEXTRA*/]) { AssetHandle asset = {.file_data = asset_file}; - ED_asset_handle_get_full_library_path(C, library, &asset, r_result); + ED_asset_handle_get_full_library_path(&asset, r_result); } static PointerRNA rna_AssetHandle_local_id_get(PointerRNA *ptr) @@ -424,19 +423,18 @@ static void rna_def_asset_handle_api(StructRNA *srna) PropertyRNA *parm; func = RNA_def_function(srna, "get_full_library_path", "rna_AssetHandle_get_full_library_path"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); /* TODO temporarily static function, for until .py can receive the asset handle from context * properly. `asset_file_handle` should go away too then. */ RNA_def_function_flag(func, FUNC_NO_SELF); parm = RNA_def_pointer(func, "asset_file_handle", "FileSelectEntry", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_pointer(func, - "asset_library_ref", - "AssetLibraryReference", - "", - "The asset library containing the given asset, only valid if the asset " - "library is external (i.e. not the \"Current File\" one"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + RNA_def_pointer( + func, + "asset_library_ref", + "AssetLibraryReference", + "", + "The asset library containing the given asset. Deprecated and optional argument, will be " + "ignored. Kept for API compatibility only."); parm = RNA_def_string(func, "result", NULL, FILE_MAX_LIBEXTRA, "result", ""); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 3526a4349b5..264b76472f7 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -1332,10 +1332,7 @@ struct wmDragAssetCatalog *WM_drag_get_asset_catalog_data(const struct wmDrag *d /** * \note Does not store \a asset in any way, so it's fine to pass a temporary. */ -void WM_drag_add_asset_list_item(wmDrag *drag, - const struct bContext *C, - const struct AssetLibraryReference *asset_library_ref, - const struct AssetHandle *asset); +void WM_drag_add_asset_list_item(wmDrag *drag, const struct AssetHandle *asset); const ListBase *WM_drag_asset_list_get(const wmDrag *drag); const char *WM_drag_get_item_name(struct wmDrag *drag); diff --git a/source/blender/windowmanager/intern/wm_dragdrop.cc b/source/blender/windowmanager/intern/wm_dragdrop.cc index 393149f20f5..4b4b516f0b9 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.cc +++ b/source/blender/windowmanager/intern/wm_dragdrop.cc @@ -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(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(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);