|
Blender V5.0
|
#include <list>#include <string>#include "BLI_bit_vector.hh"#include "BLI_function_ref.hh"#include "BLI_map.hh"#include "BLO_readfile.hh"Go to the source code of this file.
Classes | |
| struct | BlendfileLinkAppendContextItem |
| struct | BlendfileLinkAppendContextLibrary |
| struct | BlendfileLinkAppendContext |
Macros | |
| #define | BLENDFILE_LINK_APPEND_INVALID -1 |
Enumerations | |
| enum | { LINK_APPEND_ACT_UNSET = 0 , LINK_APPEND_ACT_KEEP_LINKED , LINK_APPEND_ACT_REUSE_LOCAL , LINK_APPEND_ACT_MAKE_LOCAL , LINK_APPEND_ACT_COPY_LOCAL } |
| enum | { LINK_APPEND_TAG_INDIRECT = 1 << 0 , LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY = 1 << 1 , LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY = 1 << 2 } |
| enum | eBlendfileLinkAppendForeachItemFlag { BKE_BLENDFILE_LINK_APPEND_FOREACH_ITEM_FLAG_DO_DIRECT = 1 << 0 , BKE_BLENDFILE_LINK_APPEND_FOREACH_ITEM_FLAG_DO_INDIRECT = 1 << 1 } |
| enum | eBKELibLinkOverride { BKE_LIBLINK_OVERRIDE_INIT = 0 , BKE_LIBLINK_OVERRIDE_USE_EXISTING_LIBOVERRIDES = 1 << 0 , BKE_LIBLINK_OVERRIDE_CREATE_RUNTIME = 1 << 1 } |
| #define BLENDFILE_LINK_APPEND_INVALID -1 |
Definition at line 243 of file BKE_blendfile_link_append.hh.
Referenced by BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_copybuffer_paste(), and BKE_copybuffer_read().
| anonymous enum |
Actions to apply to an item (i.e. linked ID).
| Enumerator | |
|---|---|
| LINK_APPEND_ACT_UNSET | |
| LINK_APPEND_ACT_KEEP_LINKED | |
| LINK_APPEND_ACT_REUSE_LOCAL | |
| LINK_APPEND_ACT_MAKE_LOCAL | |
| LINK_APPEND_ACT_COPY_LOCAL | |
Definition at line 31 of file BKE_blendfile_link_append.hh.
| anonymous enum |
Various status info about an item (i.e. linked ID).
| Enumerator | |
|---|---|
| LINK_APPEND_TAG_INDIRECT | An indirectly linked ID. |
| LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY | An ID also used as liboverride dependency (either directly, as a liboverride reference, or indirectly, as data used by a liboverride reference). It should never be directly made local. Mutually exclusive with LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY. |
| LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY | An ID only used as liboverride dependency (either directly or indirectly, see LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY for precisions). It should not be considered during the 'make local' process, and remain purely linked data. Mutually exclusive with LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY. |
Definition at line 40 of file BKE_blendfile_link_append.hh.
| enum eBKELibLinkOverride |
Options controlling the behavior of liboverrides creation.
| Enumerator | |
|---|---|
| BKE_LIBLINK_OVERRIDE_INIT | |
| BKE_LIBLINK_OVERRIDE_USE_EXISTING_LIBOVERRIDES | Try to find a matching existing liboverride first, instead of always creating a new one.
|
| BKE_LIBLINK_OVERRIDE_CREATE_RUNTIME | Create (or return an existing) runtime liboverride, instead of a regular saved-in-blend-files one. See also the ID_TAG_RUNTIME tag of IDs in DNA_ID.h.
|
Definition at line 370 of file BKE_blendfile_link_append.hh.
Definition at line 293 of file BKE_blendfile_link_append.hh.
| void BKE_blendfile_append | ( | BlendfileLinkAppendContext * | lapp_context, |
| ReportList * | reports ) |
Perform append operation, using modern ID usage looper to detect which ID should be kept linked, made local, duplicated as local, re-used from local etc.
The IDs processed by this functions are the one that have been linked by a previous call to BKE_blendfile_link on the same lapp_context.
Definition at line 1366 of file blendfile_link_append.cc.
References BlendfileLinkAppendContextItem::action, BlendfileLinkAppendContext::Appending, BKE_id_multi_tagged_delete(), BKE_idtype_idcode_append_is_reusable(), BKE_lib_id_make_local(), BKE_libblock_relink_to_newid(), BKE_main_id_newptr_and_tag_clear(), BKE_main_id_tag_all(), BKE_main_library_weak_reference_add_item(), BKE_main_library_weak_reference_create(), BKE_main_library_weak_reference_destroy(), blendfile_append_define_actions(), BLI_assert, BLI_assert_unreachable, BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR, BLO_LIBLINK_APPEND_RECURSIVE, BLO_LIBLINK_APPEND_SET_FAKEUSER, BLO_read_do_version_after_setup(), BLO_readfile_id_runtime_data_free_all(), LibraryLink_Params::bmain, CLOG_ERROR, ELEM, FILE_LINK, FILE_MAX, LibraryLink_Params::flag, GS, id_fake_user_set(), ID_GR, ID_IS_LINKED, ID_NEW_SET, ID_OB, ID_TAG_DOIT, ID_TAG_PRE_EXISTING, BlendfileLinkAppendContext::items, LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR, LIB_ID_MAKELOCAL_FORCE_COPY, LIB_ID_MAKELOCAL_FORCE_LOCAL, LIB_ID_MAKELOCAL_FULL_LIBRARY, LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR, BlendfileLinkAppendContext::library_weak_reference_mapping, LINK_APPEND_ACT_COPY_LOCAL, LINK_APPEND_ACT_KEEP_LINKED, LINK_APPEND_ACT_MAKE_LOCAL, LINK_APPEND_ACT_REUSE_LOCAL, LINK_APPEND_ACT_UNSET, LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY, LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY, BlendfileLinkAppendContext::Linking, LOG, MAX_ID_NAME, ID::name, BlendfileLinkAppendContextItem::new_id, new_id_to_item_mapping_create(), ID::newid, BlendfileLinkAppendContext::params, BlendfileLinkAppendContext::process_stage, BlendFileReadReport::reports, BlendfileLinkAppendContextItem::reusable_local_id, STRNCPY(), and BlendfileLinkAppendContextItem::tag.
Referenced by bpy_lib_exit(), copybuffer_append(), wm_file_link_append_datablock_ex(), and wm_link_append_exec().
| void BKE_blendfile_id_relocate | ( | BlendfileLinkAppendContext & | lapp_context, |
| ReportList * | reports ) |
Relocate a single linked ID.
NOTE: content of lapp_context after execution of that function should not be assumed valid anymore, and should immediately be freed.
Definition at line 2207 of file blendfile_link_append.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_blendfile_link(), BKE_layer_collection_resync_allow(), BKE_layer_collection_resync_forbid(), BKE_main_collection_sync(), BKE_main_collection_sync_remap(), BKE_main_id_tag_all(), BKE_main_lock(), BKE_main_unlock(), blendfile_library_relocate_id_remap(), blendfile_relocate_postprocess_cleanup(), blendfile_relocate_postprocess_liboverrides(), BLI_assert, LibraryLink_Params::bmain, FILE_LINK, LibraryLink_Params::flag, GS, ID_REMAP_SKIP_INDIRECT_USAGE, ID_REMAP_SKIP_NEVER_NULL_USAGE, ID_TAG_PRE_EXISTING, BlendfileLinkAppendContext::items, ID::lib, ID::name, BlendfileLinkAppendContextItem::new_id, BlendfileLinkAppendContext::params, and BlendfileLinkAppendContextItem::userdata.
Referenced by wm_id_linked_relocate_exec().
| void BKE_blendfile_library_relocate | ( | BlendfileLinkAppendContext * | lapp_context, |
| ReportList * | reports, | ||
| Library * | library, | ||
| bool | do_reload ) |
Try to relocate all linked IDs added to lapp_context, belonging to the given library.
This function searches for matching IDs (type and name) in all libraries added to the given lapp_context.
Typical usages include:
NOTE: content of lapp_context after execution of that function should not be assumed valid anymore, and should immediately be freed.
Definition at line 2082 of file blendfile_link_append.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_blendfile_link(), BKE_blendfile_link_append_context_flag_set(), BKE_blendfile_link_append_context_init_done(), BKE_blendfile_link_append_context_item_add(), BKE_id_name(), BKE_idtype_idcode_is_linkable(), BKE_key_from_id(), BKE_layer_collection_resync_allow(), BKE_layer_collection_resync_forbid(), BKE_lib_override_library_main_operations_create(), BKE_main_collection_sync(), BKE_main_collection_sync_remap(), BKE_main_collections_parent_relations_rebuild(), BKE_main_id_refcount_recompute(), BKE_main_id_tag_all(), BKE_main_lists_get(), BKE_main_lock(), BKE_main_unlock(), blendfile_library_relocate_id_remap(), blendfile_relocate_postprocess_cleanup(), blendfile_relocate_postprocess_liboverrides(), BLI_addtail(), BLI_assert, BLI_remlink(), BLO_LIBLINK_COLLECTION_NO_HIERARCHY_REBUILD, LibraryLink_Params::bmain, CLOG_DEBUG, blender::bits::BitVector< InlineBufferCapacity, Allocator >::fill(), GS, Key::id, ID_REMAP_SKIP_INDIRECT_USAGE, ID_REMAP_SKIP_NEVER_NULL_USAGE, ID_TAG_PRE_EXISTING, BlendfileLinkAppendContext::items, ID::lib, BlendfileLinkAppendContextItem::libraries, LOG, ID::name, BlendfileLinkAppendContextItem::new_id, BlendfileLinkAppendContext::params, BlendfileLinkAppendContextItem::userdata, and which_libbase().
Referenced by WM_lib_reload(), and wm_lib_relocate_exec_do().
| void BKE_blendfile_link | ( | BlendfileLinkAppendContext * | lapp_context, |
| ReportList * | reports ) |
Perform linking operation on all items added to given lapp_context.
Definition at line 1616 of file blendfile_link_append.cc.
References BKE_reportf(), BLI_assert, BlendfileLinkAppendContextLibrary::blo_handle, BLO_library_link_begin(), BLO_library_link_end(), BLO_library_link_named_part(), BLO_read_do_version_after_setup(), BLO_readfile_id_runtime_data_free_all(), LibraryLink_Params::bmain, Main::curlib, FILE_LINK, blender::bits::BitVector< InlineBufferCapacity, Allocator >::fill(), LibraryLink_Params::flag, ID_TAG_MISSING, BlendfileLinkAppendContextItem::idcode, Vector< T, InlineBufferCapacity, Allocator >::index_range(), BlendfileLinkAppendContext::Init, Vector< T, InlineBufferCapacity, Allocator >::is_empty(), BlendfileLinkAppendContext::items, ID::lib, lib, BlendfileLinkAppendContext::libraries, BlendfileLinkAppendContextItem::libraries, link_append_context_library_blohandle_ensure(), link_append_context_library_blohandle_release(), BlendfileLinkAppendContext::Linking, BlendfileLinkAppendContextItem::name, BlendfileLinkAppendContextItem::new_id, BlendfileLinkAppendContext::params, BlendfileLinkAppendContextLibrary::path, BlendfileLinkAppendContext::process_stage, BlendFileReadReport::reports, RPT_WARNING, BlendfileLinkAppendContextItem::source_library, Main::subversionfile, and Main::versionfile.
Referenced by blender::bke::asset_link_id(), BKE_blendfile_id_relocate(), BKE_blendfile_library_relocate(), bpy_lib_exit(), copybuffer_append(), wm_file_link_append_datablock_ex(), and wm_link_append_exec().
| void BKE_blendfile_link_append_context_embedded_blendfile_clear | ( | BlendfileLinkAppendContext * | lapp_context | ) |
Clear reference to Blender's embedded startup file into the context.
Definition at line 175 of file blendfile_link_append.cc.
References BlendfileLinkAppendContext::blendfile_mem, and BlendfileLinkAppendContext::blendfile_memsize.
| void BKE_blendfile_link_append_context_embedded_blendfile_set | ( | BlendfileLinkAppendContext * | lapp_context, |
| const void * | blendfile_mem, | ||
| int | blendfile_memsize ) |
Store reference to a Blender's embedded memfile into the context.
Definition at line 165 of file blendfile_link_append.cc.
References BlendfileLinkAppendContext::blendfile_mem, BlendfileLinkAppendContext::blendfile_memsize, and BLI_assert_msg.
Referenced by wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), and wm_link_append_exec().
| void BKE_blendfile_link_append_context_finalize | ( | BlendfileLinkAppendContext * | lapp_context | ) |
Finalize the link/append process.
NOTE: Currently only used to call the matching handler..
Definition at line 366 of file blendfile_link_append.cc.
References BlendfileLinkAppendContext::Appending, BKE_callback_exec(), BKE_CB_EVT_BLENDIMPORT_POST, BKE_main_ensure_invariants(), BLI_assert, LibraryLink_Params::bmain, BlendfileLinkAppendContext::Done, ELEM, BlendfileLinkAppendContext::Instantiating, BlendfileLinkAppendContext::Linking, BlendfileLinkAppendContext::params, BlendfileLinkAppendContext::process_stage, and RNA_pointer_create_discrete().
Referenced by blender::bke::asset_link_id(), bpy_lib_exit(), copybuffer_append(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), WM_lib_reload(), wm_lib_relocate_exec_do(), and wm_link_append_exec().
| void BKE_blendfile_link_append_context_flag_set | ( | BlendfileLinkAppendContext * | lapp_context, |
| int | flag, | ||
| bool | do_set ) |
Set or clear flags in given lapp_context.
| flag | A combination of:
|
| do_set | Set the given flag if true, clear it otherwise. |
Definition at line 153 of file blendfile_link_append.cc.
References flag, LibraryLink_Params::flag, and BlendfileLinkAppendContext::params.
Referenced by blender::bke::asset_link_id(), and BKE_blendfile_library_relocate().
| void BKE_blendfile_link_append_context_free | ( | BlendfileLinkAppendContext * | lapp_context | ) |
Free a link/append context.
Definition at line 142 of file blendfile_link_append.cc.
References BLI_assert, BlendfileLinkAppendContext::libraries, BlendfileLinkAppendContext::library_weak_reference_mapping, and link_append_context_library_blohandle_release().
Referenced by blender::bke::asset_link_id(), BKE_copybuffer_paste(), BKE_copybuffer_read(), bpy_lib_exit(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), WM_lib_reload(), wm_lib_relocate_exec_do(), and wm_link_append_exec().
| void BKE_blendfile_link_append_context_init_done | ( | BlendfileLinkAppendContext * | lapp_context | ) |
Called once the link/append process has been fully initialized (all of its data has been set).
NOTE: Currently only used to call the matching handler.
Definition at line 357 of file blendfile_link_append.cc.
References BKE_callback_exec(), BKE_CB_EVT_BLENDIMPORT_PRE, BLI_assert, LibraryLink_Params::bmain, BlendfileLinkAppendContext::Init, BlendfileLinkAppendContext::params, BlendfileLinkAppendContext::process_stage, and RNA_pointer_create_discrete().
Referenced by blender::bke::asset_link_id(), BKE_blendfile_library_relocate(), bpy_lib_exit(), copybuffer_append(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), and wm_link_append_exec().
| bool BKE_blendfile_link_append_context_is_empty | ( | BlendfileLinkAppendContext * | lapp_context | ) |
Check if given link/append context is empty (has no items to process) or not.
Definition at line 285 of file blendfile_link_append.cc.
References BlendfileLinkAppendContext::items.
Referenced by wm_link_append_exec().
| BlendfileLinkAppendContextItem * BKE_blendfile_link_append_context_item_add | ( | BlendfileLinkAppendContext * | lapp_context, |
| const char * | idname, | ||
| short | idcode, | ||
| void * | userdata ) |
Add a new item (data-block name and idcode) to be searched and linked/appended from libraries associated to the given context.
| userdata | an opaque user-data pointer stored in generated link/append item. |
TODO: Add a more friendly version of this function that combines it with the call to BKE_blendfile_link_append_context_item_library_index_enable to enable the added item for all added library sources.
Definition at line 200 of file blendfile_link_append.cc.
References BlendfileLinkAppendContextItem::action, BlendfileLinkAppendContextItem::idcode, BlendfileLinkAppendContext::items, BlendfileLinkAppendContextItem::lapp_context, BlendfileLinkAppendContext::libraries, BlendfileLinkAppendContextItem::libraries, LINK_APPEND_ACT_UNSET, BlendfileLinkAppendContextItem::name, BlendfileLinkAppendContextItem::new_id, Vector< T, InlineBufferCapacity, Allocator >::size(), and BlendfileLinkAppendContextItem::userdata.
Referenced by blender::bke::asset_link_id(), BKE_blendfile_library_relocate(), BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_blendfile_link_pack(), bpy_lib_exit(), foreach_libblock_append_add_dependencies_callback(), foreach_libblock_link_finalize_cb(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), and wm_link_append_exec().
| void BKE_blendfile_link_append_context_item_foreach | ( | BlendfileLinkAppendContext * | lapp_context, |
| blender::FunctionRef< bool(BlendfileLinkAppendContext *lapp_context, BlendfileLinkAppendContextItem *item)> | callback_function, | ||
| eBlendfileLinkAppendForeachItemFlag | flag ) |
Iterate over all (or a subset) of the items listed in given BlendfileLinkAppendContext, and call the callback_function on them.
| flag | Control which type of items to process (see eBlendfileLinkAppendForeachItemFlag enum flags). |
| userdata | An opaque void pointer passed to the callback_function. |
| callback_function | Called over each (or a subset of each) of the items in given BlendfileLinkAppendContext. |
Definition at line 333 of file blendfile_link_append.cc.
References BKE_BLENDFILE_LINK_APPEND_FOREACH_ITEM_FLAG_DO_DIRECT, BKE_BLENDFILE_LINK_APPEND_FOREACH_ITEM_FLAG_DO_INDIRECT, flag, BlendfileLinkAppendContext::items, LINK_APPEND_TAG_INDIRECT, and BlendfileLinkAppendContextItem::tag.
Referenced by bpy_lib_exit(), and blender::bke::greasepencil::convert::legacy_main().
| short BKE_blendfile_link_append_context_item_idcode_get | ( | BlendfileLinkAppendContext * | lapp_context, |
| BlendfileLinkAppendContextItem * | item ) |
Definition at line 327 of file blendfile_link_append.cc.
References BlendfileLinkAppendContextItem::idcode.
Referenced by bpy_lib_exit_lapp_context_items_cb().
| int BKE_blendfile_link_append_context_item_idtypes_from_library_add | ( | BlendfileLinkAppendContext * | lapp_context, |
| ReportList * | reports, | ||
| uint64_t | id_types_filter, | ||
| int | library_index ) |
Search for all ID matching given id_types_filter in given library_index, and add them to the list of items to process.
| id_types_filter | A set of FILTER_ID bit-flags, the types of IDs to add to the items list. |
| library_index | The index of the library to look into, in given lapp_context. |
Definition at line 223 of file blendfile_link_append.cc.
References BKE_blendfile_link_append_context_item_add(), BKE_blendfile_link_append_context_item_library_index_enable(), BKE_idtype_idcode_is_linkable(), BKE_idtype_idcode_iter_step(), BKE_idtype_idcode_to_idfilter(), BLENDFILE_LINK_APPEND_INVALID, BLI_assert, BLO_blendhandle_get_datablock_names(), FILE_ASSETS_ONLY, LibraryLink_Params::flag, BlendfileLinkAppendContext::Init, BlendfileLinkAppendContext::libraries, LinkNode::link, link_append_context_library_blohandle_ensure(), MEM_freeN(), LinkNode::next, BlendfileLinkAppendContext::params, and BlendfileLinkAppendContext::process_stage.
Referenced by BKE_copybuffer_paste(), and BKE_copybuffer_read().
| ID * BKE_blendfile_link_append_context_item_liboverrideid_get | ( | BlendfileLinkAppendContext * | lapp_context, |
| BlendfileLinkAppendContextItem * | item ) |
Definition at line 319 of file blendfile_link_append.cc.
References BLI_assert, BlendfileLinkAppendContext::Init, BlendfileLinkAppendContextItem::liboverride_id, BlendfileLinkAppendContext::process_stage, and UNUSED_VARS_NDEBUG.
Referenced by bpy_lib_exit_lapp_context_items_cb().
| void BKE_blendfile_link_append_context_item_library_index_enable | ( | BlendfileLinkAppendContext * | lapp_context, |
| BlendfileLinkAppendContextItem * | item, | ||
| int | library_index ) |
Enable search of the given item into the library stored at given index in the link/append context.
Definition at line 275 of file blendfile_link_append.cc.
References BLI_assert, BlendfileLinkAppendContext::Init, BlendfileLinkAppendContextItem::libraries, BlendfileLinkAppendContext::process_stage, and UNUSED_VARS_NDEBUG.
Referenced by blender::bke::asset_link_id(), BKE_blendfile_link_append_context_item_idtypes_from_library_add(), bpy_lib_exit(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), and wm_link_append_exec().
| ID * BKE_blendfile_link_append_context_item_newid_get | ( | BlendfileLinkAppendContext * | lapp_context, |
| BlendfileLinkAppendContextItem * | item ) |
Definition at line 296 of file blendfile_link_append.cc.
References BLI_assert, BlendfileLinkAppendContext::Init, BlendfileLinkAppendContextItem::new_id, BlendfileLinkAppendContext::process_stage, and UNUSED_VARS_NDEBUG.
Referenced by blender::bke::asset_link_id(), bpy_lib_exit_lapp_context_items_cb(), and wm_file_link_append_datablock_ex().
| void BKE_blendfile_link_append_context_item_newid_set | ( | BlendfileLinkAppendContext * | lapp_context, |
| BlendfileLinkAppendContextItem * | item, | ||
| ID * | new_id ) |
Replace the newly linked ID by another from the same library. Rarely used, necessary e.g. in some complex 'do version after setup' code when an ID is replaced by another one.
Definition at line 304 of file blendfile_link_append.cc.
References Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BLI_assert, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), BlendfileLinkAppendContext::Init, ID::lib, BlendfileLinkAppendContextItem::liboverride_id, BlendfileLinkAppendContextItem::new_id, BlendfileLinkAppendContext::new_id_to_item, BlendfileLinkAppendContext::process_stage, and Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove().
Referenced by blender::bke::greasepencil::convert::legacy_main().
| void * BKE_blendfile_link_append_context_item_userdata_get | ( | BlendfileLinkAppendContext * | lapp_context, |
| BlendfileLinkAppendContextItem * | item ) |
Definition at line 290 of file blendfile_link_append.cc.
References BlendfileLinkAppendContextItem::userdata.
Referenced by bpy_lib_exit_lapp_context_items_cb().
| void BKE_blendfile_link_append_context_library_add | ( | BlendfileLinkAppendContext * | lapp_context, |
| const char * | libname, | ||
| BlendHandle * | blo_handle ) |
Add a new source library to search for items to be linked to the given link/append context.
| libname | the absolute path to the library blend file. |
| blo_handle | the blend file handle of the library, nullptr if not available. Note that the ownership of this handle is always stolen, because readfile code may forcefully clear this handle after reading in some cases (endianness conversion, see usages of the FD_FLAGS_SWITCH_ENDIAN flag). |
Definition at line 182 of file blendfile_link_append.cc.
References Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_assert, BlendfileLinkAppendContextLibrary::blo_handle, BlendfileLinkAppendContextLibrary::blo_handle_is_owned, BlendfileLinkAppendContext::Init, BlendfileLinkAppendContext::items, BlendfileLinkAppendContext::libraries, BlendfileLinkAppendContextLibrary::path, and BlendfileLinkAppendContext::process_stage.
Referenced by blender::bke::asset_link_id(), BKE_copybuffer_paste(), BKE_copybuffer_read(), bpy_lib_exit(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), WM_lib_reload(), wm_lib_relocate_exec_do(), and wm_link_append_exec().
| BlendfileLinkAppendContext * BKE_blendfile_link_append_context_new | ( | LibraryLink_Params * | params | ) |
Allocate and initialize a new context to link/append data-blocks.
Definition at line 134 of file blendfile_link_append.cc.
References BlendfileLinkAppendContext::Init, BlendfileLinkAppendContext::params, params, and BlendfileLinkAppendContext::process_stage.
Referenced by blender::bke::asset_link_id(), BKE_copybuffer_paste(), BKE_copybuffer_read(), bpy_lib_exit(), wm_file_link_append_datablock_ex(), wm_id_linked_relocate_exec(), WM_lib_reload(), wm_lib_relocate_exec_do(), and wm_link_append_exec().
| void BKE_blendfile_link_append_instantiate_loose | ( | BlendfileLinkAppendContext * | lapp_context, |
| ReportList * | reports ) |
Instantiate loose data in the scene (e.g. add object to the active collection).
Definition at line 1573 of file blendfile_link_append.cc.
References LooseDataInstantiateContext::active_collection, BlendfileLinkAppendContext::Appending, BKE_library_foreach_ID_link(), BLI_assert, LibraryLink_Params::bmain, LibraryLink_Params::context, ELEM, FILE_LINK, LibraryLink_Params::flag, foreach_libblock_link_finalize_cb(), IDWALK_NOP, BlendfileLinkAppendContext::Instantiating, BlendfileLinkAppendContextCallBack::item, BlendfileLinkAppendContext::items, BlendfileLinkAppendContextCallBack::lapp_context, LooseDataInstantiateContext::lapp_context, BlendfileLinkAppendContext::Linking, loose_data_instantiate(), BlendfileLinkAppendContextItem::new_id, new_id_to_item_mapping_create(), BlendfileLinkAppendContext::params, BlendfileLinkAppendContext::process_stage, BlendfileLinkAppendContextCallBack::reports, LibraryLink_Params::scene, and BlendfileLinkAppendContextItem::userdata.
Referenced by copybuffer_append(), wm_file_link_append_datablock_ex(), and wm_link_append_exec().
| void BKE_blendfile_link_pack | ( | BlendfileLinkAppendContext * | lapp_context, |
| ReportList * | reports ) |
Perform packing operation.
The IDs processed by this functions are the one that have been linked by a previous call to BKE_blendfile_link on the same lapp_context.
Definition at line 955 of file blendfile_link_append.cc.
References BlendfileLinkAppendContextItem::action, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_blendfile_link_append_context_item_add(), BKE_id_multi_delete(), BKE_id_name(), BKE_main_id_newptr_and_tag_clear(), BLI_assert, LibraryLink_Params::bmain, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, GS, ID_IS_LINKED, ID_IS_PACKED, ID_TAG_PRE_EXISTING, BlendfileLinkAppendContext::items, ID::lib, LINK_APPEND_ACT_UNSET, LINK_APPEND_TAG_INDIRECT, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), ID::name, BlendfileLinkAppendContextItem::new_id, BlendfileLinkAppendContext::new_id_to_item, new_id_to_item_mapping_add(), new_id_to_item_mapping_create(), ID::newid, blender::bke::library::pack_linked_id_hierarchy(), BlendfileLinkAppendContext::params, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove(), BlendfileLinkAppendContextItem::source_library, BlendfileLinkAppendContextItem::tag, and ID::tag.
Referenced by bpy_lib_exit(), and wm_file_link_append_datablock_ex().
| void BKE_blendfile_override | ( | BlendfileLinkAppendContext * | lapp_context, |
| const eBKELibLinkOverride | flags, | ||
| ReportList * | reports ) |
Create (or find existing) liboverrides from linked data.
The IDs processed by this functions are the one that have been linked by a previous call to BKE_blendfile_link on the same lapp_context.
Control over how liboverrides are created is done through the extra eBKELibLinkOverride flags.
Definition at line 1698 of file blendfile_link_append.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_lib_override_library_create_from_id(), BKE_LIBLINK_OVERRIDE_CREATE_RUNTIME, BKE_LIBLINK_OVERRIDE_USE_EXISTING_LIBOVERRIDES, BKE_main_namemap_clear(), BLI_assert, LibraryLink_Params::bmain, FILE_LINK, LibraryLink_Params::flag, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, ID_TAG_EXTERN, ID_TAG_INDIRECT, ID_TAG_PRE_EXISTING, ID_TAG_RUNTIME, BlendfileLinkAppendContext::items, BlendfileLinkAppendContextItem::liboverride_id, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), BlendfileLinkAppendContextItem::new_id, ID::override_library, BlendfileLinkAppendContext::params, IDOverrideLibrary::reference, ID::tag, and BlendfileLinkAppendContextItem::userdata.
Referenced by bpy_lib_exit().