92 .dependencies_id_types = 0,
94 .struct_size =
sizeof(
ID),
95 .name =
"LinkPlaceholder",
96 .name_plural =
N_(
"link_placeholders"),
99 .asset_type_info =
nullptr,
101 .init_data =
nullptr,
102 .copy_data =
nullptr,
103 .free_data =
nullptr,
104 .make_local =
nullptr,
105 .foreach_id =
nullptr,
106 .foreach_cache =
nullptr,
107 .foreach_path =
nullptr,
108 .foreach_working_space_color =
nullptr,
109 .foreach_asset_weak_reference =
nullptr,
110 .owner_pointer_get =
nullptr,
112 .blend_write =
nullptr,
113 .blend_read_data =
nullptr,
114 .blend_read_after_liblink =
nullptr,
116 .blend_read_undo_preserve =
nullptr,
118 .lib_override_apply_post =
nullptr,
133 size_t path_dst_maxncpy,
134 const char *path_src)
136 const char **
data =
static_cast<const char **
>(bpath_data->
user_data);
139 const char *base_new =
data[0];
140 const char *base_old =
data[1];
143 CLOG_ERROR(&
LOG,
"old base path '%s' is not absolute.", base_old);
184 const char *bpath_user_data[2] = {
189 path_data.
bmain = bmain;
192 path_data.
user_data =
static_cast<void *
>(bpath_user_data);
215 if (id_in_mainlist) {
223 MEM_SAFE_DELETE(
id->library_weak_reference);
228 if (id_in_mainlist) {
285 if (key !=
nullptr) {
303 auto propagate_status_fn = [&
id](
ID &embedded_id) ->
void {
310 embedded_id.flag &= ~FLAGS_TO_SYNC;
311 embedded_id.flag |= (
id.flag & FLAGS_TO_SYNC);
312 embedded_id.tag &= ~TAGS_TO_SYNC;
313 embedded_id.tag |= (
id.tag & TAGS_TO_SYNC);
318 propagate_status_fn(ntree->
id);
320 if (
id.id_type() ==
ID_SCE) {
321 Collection *master_collection = id_cast<Scene &>(
id).master_collection;
322 if (master_collection) {
323 propagate_status_fn(master_collection->
id);
336 "A linked ID must never be both directly and indirectly linked at the same time.");
338 "A linked ID must always be either directly or indirectly linked.");
348 id->lib->runtime->parent =
nullptr;
362 "A linked ID must never be both directly and indirectly linked at the same time.");
364 "A linked ID must always be either directly or indirectly linked.");
393 if (
id->us <= limit) {
396 "ID user count error: %s (from '%s')",
398 id->lib ?
id->lib->runtime->filepath_abs :
"[Main]");
446 if (
id->us <= limit) {
451 "ID user decrement error: %s (from '%s'): %d <= %d",
453 id->lib ?
id->lib->runtime->filepath_abs :
"[Main]",
490 if (
id->newid ==
nullptr) {
502 if (key !=
nullptr) {
506 if (ntree !=
nullptr) {
510 Collection *master_collection = (id_cast<Scene *>(
id))->master_collection;
511 if (master_collection !=
nullptr) {
522 int const cb_flag = cb_data->
cb_flag;
535 if (*id_pointer !=
nullptr &&
ID_IS_LINKED(*id_pointer)) {
547 if (*id_pointer && *id_pointer != self_id &&
578 Main *bmain,
ID *
id,
int flags,
bool *r_force_local,
bool *r_force_copy)
582 BLI_assert(force_copy ==
false || force_copy != force_local);
584 if (force_local || force_copy) {
586 *r_force_local = force_local;
587 *r_force_copy = force_copy;
592 bool is_local =
false, is_lib =
false;
603 if (!lib_local && !is_local && !is_lib) {
606 else if (lib_local || is_local) {
615 *r_force_local = force_local;
616 *r_force_copy = force_copy;
625 bool force_local, force_copy;
635 else if (force_copy) {
636 const int copy_flags =
643 if (id_new !=
nullptr) {
649 if (key && key_new) {
653 if (ntree && ntree_new) {
657 Collection *master_collection = (id_cast<Scene *>(
id))->master_collection,
658 *master_collection_new = (id_cast<Scene *>(id_new))->master_collection;
659 if (master_collection && master_collection_new) {
660 ID_NEW_SET(master_collection, master_collection_new);
684 if (idtype_info ==
nullptr) {
711 ID *
id = *id_pointer;
716 if (
id ==
data->id_src) {
718 id = *id_pointer =
data->id_dst;
742#define LIB_ID_TYPES_NOCOPY ID_LI, ID_SCR, ID_WM, ID_WS
746#undef LIB_ID_TYPES_NOCOPY
750 std::optional<Library *> owner_library,
752 std::optional<const ID *> new_owner_id,
756 ID *newid = (new_id_p !=
nullptr) ? *new_id_p :
nullptr;
758 "Copying with 'no allocate' behavior should always get a non-null new ID buffer");
778 if (idtype_info !=
nullptr) {
786 idtype_info->
copy_data(bmain, owner_library, newid,
id, flag);
793 BLI_assert_msg(newid,
"Could not get an allocated new ID to copy into");
819 if (newid->
lib !=
id->lib) {
841 newid->
lib = owner_library ? *owner_library :
id->lib;
844 if (new_id_p !=
nullptr) {
864 const int copy_flags)
869 if (
id->newid ==
nullptr) {
883 if (key !=
nullptr) {
891 if (key_new !=
nullptr) {
929 if (newid ==
nullptr) {
955 if (owner_id.
lib ==
id.lib) {
960 BLI_assert_msg(
false,
"Only local IDs can be moved into a library");
968 id.lib = owner_id.
lib;
979 const bool do_full_id,
980 IDRemapper *remapper_id_a,
981 IDRemapper *remapper_id_b);
990 const bool do_full_id,
991 const bool do_self_remap,
994 const int self_remap_flags)
998 IDRemapper *remapper_id_a = input_remapper_id_a;
999 IDRemapper *remapper_id_b = input_remapper_id_b;
1000 if (do_self_remap) {
1001 if (remapper_id_a ==
nullptr) {
1002 remapper_id_a = MEM_new<IDRemapper>(__func__);
1004 if (remapper_id_b ==
nullptr) {
1005 remapper_id_b = MEM_new<IDRemapper>(__func__);
1011 const size_t id_struct_size = id_type->
struct_size;
1013 const ID id_a_back = *id_a;
1014 const ID id_b_back = *id_b;
1016 char *id_swap_buff =
static_cast<char *
>(alloca(id_struct_size));
1018 memcpy(id_swap_buff, id_a, id_struct_size);
1019 memcpy(id_a, id_b, id_struct_size);
1020 memcpy(id_b, id_swap_buff, id_struct_size);
1043 if (id_a->id_type() ==
ID_SCE) {
1044 Scene *scene_a = id_cast<Scene *>(id_a);
1045 Scene *scene_b = id_cast<Scene *>(id_b);
1054 if (remapper_id_a !=
nullptr) {
1055 remapper_id_a->
add(id_b, id_a);
1057 if (remapper_id_b !=
nullptr) {
1058 remapper_id_b->
add(id_a, id_b);
1062 if (do_self_remap) {
1085 if (input_remapper_id_a ==
nullptr && remapper_id_a !=
nullptr) {
1086 MEM_delete(remapper_id_a);
1088 if (input_remapper_id_b ==
nullptr && remapper_id_b !=
nullptr) {
1089 MEM_delete(remapper_id_b);
1100 const bool do_full_id,
1104 if (embedded_id_a !=
nullptr && *embedded_id_a !=
nullptr) {
1107 if (*embedded_id_b ==
nullptr) {
1115 bmain, *embedded_id_a, *embedded_id_b, do_full_id,
false, remapper_id_a, remapper_id_b, 0);
1117 std::swap(*embedded_id_a, *embedded_id_b);
1121 if (remapper_id_a !=
nullptr) {
1122 remapper_id_a->
add(*embedded_id_b, *embedded_id_a);
1124 if (remapper_id_b !=
nullptr) {
1125 remapper_id_b->
add(*embedded_id_a, *embedded_id_b);
1131 Main *bmain,
ID *id_a,
ID *id_b,
const bool do_self_remap,
const int self_remap_flags)
1133 id_swap(bmain, id_a, id_b,
false, do_self_remap,
nullptr,
nullptr, self_remap_flags);
1137 Main *bmain,
ID *id_a,
ID *id_b,
const bool do_self_remap,
const int self_remap_flags)
1139 id_swap(bmain, id_a, id_b,
true, do_self_remap,
nullptr,
nullptr, self_remap_flags);
1144 ID *newid =
nullptr;
1153 if (newid !=
nullptr) {
1203 ID *
id =
static_cast<ID *
>(idv);
1227 *bmain, *
id, *
id->lib,
id->deep_hash, is_new_);
1228 id->lib = archive_lib;
1248 ID *
id =
static_cast<ID *
>(idv);
1268 ID *
id =
static_cast<ID *
>(idv);
1280 ID *
id =
static_cast<ID *
>(idv);
1295 for (
id = lb->first();
id;
id =
static_cast<ID *
>(
id->next)) {
1300 const int ntag = ~tag;
1301 for (
id = lb->first();
id;
id =
static_cast<ID *
>(
id->next)) {
1317 int a = lbarray.size();
1327 for (
id = lb->first();
id;
id =
static_cast<ID *
>(
id->next)) {
1332 const int nflag = ~flag;
1333 for (
id = lb->first();
id;
id =
static_cast<ID *
>(
id->next)) {
1342 int a = lbarray.size();
1351 for (
ID &
id : *lb) {
1364 for (
ID &
id : *lb) {
1370 for (i = 0; i < lb_len; i++) {
1376 MEM_delete(id_array);
1406 id.runtime = MEM_new<bke::id::ID_Runtime>(__func__);
1414 if (id_type ==
nullptr) {
1415 if (r_name !=
nullptr) {
1421 if (r_name !=
nullptr) {
1422 *r_name = id_type->
name;
1440 std::optional<Library *> owner_library,
1464 *(
reinterpret_cast<short *
>(
id->name)) = type;
1493 id->lib = owner_library ? *owner_library :
nullptr;
1520 id->lib = owner_library ? *owner_library :
nullptr;
1554 if (idtype_info !=
nullptr) {
1555 if (idtype_info->
init_data !=
nullptr) {
1566 id->runtime->remap.status = 0;
1567 id->runtime->remap.skipped_refcounted = 0;
1568 id->runtime->remap.skipped_direct = 0;
1569 id->runtime->remap.skipped_indirect = 0;
1595 std::optional<Library *> owner_library,
1602 if (name ==
nullptr) {
1619 if (name ==
nullptr) {
1634 std::optional<Library *> owner_library,
1636 std::optional<const ID *> new_owner_id,
1638 const int orig_flag)
1640 ID *new_id = *new_id_p;
1641 int flag = orig_flag;
1654 if ((bmain !=
nullptr) && is_embedded_id) {
1661 const int copy_idtag_mask =
1672 memset(
static_cast<void *
>(new_id), 0, size);
1677 new_id->
lib = owner_library ? *owner_library :
id->lib;
1682 new_id =
static_cast<ID *
>(
1695 const size_t id_offset =
sizeof(
ID);
1696 if (
int(id_len) -
int(id_offset) > 0) {
1697 const char *cp =
reinterpret_cast<const char *
>(
id);
1698 char *cpn =
reinterpret_cast<char *
>(new_id);
1700 memcpy(cpn + id_offset, cp + id_offset, id_len - id_offset);
1703 new_id->
flag = (new_id->
flag & ~copy_idflag_mask) | (
id->flag & copy_idflag_mask);
1704 new_id->
tag = (new_id->
tag & ~copy_idtag_mask) | (
id->tag & copy_idtag_mask);
1715 if (new_owner_id.has_value()) {
1719 if (owner_id_pointer) {
1720 *owner_id_pointer =
const_cast<ID *
>(*new_owner_id);
1721 if (*new_owner_id ==
nullptr) {
1732 if (
id->properties) {
1735 if (
id->system_properties) {
1772 if (
id->asset_data) {
1811 const std::optional<Library *> lib)
1818 while (
id &&
id->lib != *lib) {
1830 for (
ID &
id : *lb) {
1831 if (
id.session_uid == session_uid) {
1853 const char *lib_name)
1855 const bool is_linked = (lib_name && lib_name[0] !=
'\0');
1868 const char *lib_filepath_abs)
1870 const bool is_linked = (lib_filepath_abs && lib_filepath_abs[0] !=
'\0');
1874 for (
ID &id_iter : *lb) {
1890#define ID_SORT_STEP_SIZE 512
1895 if (lb->first() == lb->last()) {
1902 if (!
ELEM(id_sorting_hint,
nullptr,
id) && id_sorting_hint->
lib ==
id->lib) {
1905 ID *id_sorting_hint_next =
static_cast<ID *
>(id_sorting_hint->
next);
1907 (id_sorting_hint_next ==
nullptr || id_sorting_hint_next->
lib !=
id->lib ||
1914 ID *id_sorting_hint_prev =
static_cast<ID *
>(id_sorting_hint->
prev);
1916 (id_sorting_hint_prev ==
nullptr || id_sorting_hint_prev->
lib !=
id->lib ||
1925 int item_array_index;
1932 bool is_in_library =
false;
1934 for (idtest = lb->last(); idtest !=
nullptr; idtest =
static_cast<ID *
>(idtest->
prev)) {
1935 if (is_in_library) {
1936 if (idtest->
lib !=
id->lib) {
1942 else if (idtest->
lib ==
id->lib) {
1944 is_in_library =
true;
1947 if (!is_in_library) {
1951 item_array[item_array_index] = idtest;
1952 if (item_array_index == 0) {
1968 for (item_array_index++; item_array_index <
ID_SORT_STEP_SIZE; item_array_index++) {
1969 idtest =
static_cast<ID *
>(item_array[item_array_index]);
1976 if (idtest ==
nullptr) {
1996#undef ID_SORT_STEP_SIZE
2002 const char *newname,
2004 const bool do_linked_data)
2016 if (newname ==
nullptr) {
2022 if (name[0] ==
'\0') {
2041 if (had_name_collision &&
2046 int prev_number = 0;
2068 if (is_idname_changed) {
2069 BLI_strncpy(
id.name + 2, orig_name,
sizeof(
id.name) - 2);
2085 if (is_idname_changed) {
2086 BLI_strncpy(
id.name + 2, name,
sizeof(
id.name) - 2);
2090 else if (had_name_collision) {
2113 if (*id_pointer ==
nullptr) {
2167 ID *
id = *id_pointer;
2191 extern_packed_ids.add(
id);
2213 auto reset_linked_status_cb = [](
ID &
id) ->
void {
2224 else if (
id.id_type() ==
ID_SCE) {
2255 reset_linked_status_cb(
id);
2260 if (local_ids.has_value()) {
2261 for (
ID *
id : *local_ids) {
2286 auto id_indirect_linked_update_packed_ids_fn =
2288 ID *self_id = cb_data->self_id;
2289 ID **id_pointer = cb_data->id_pointer;
2290 ID *
id = *id_pointer;
2322 extern_packed_ids.
add(
id);
2325 for (
int i = 0; i < extern_packed_ids.
size(); i++) {
2327 extern_packed_ids[i],
2328 id_indirect_linked_update_packed_ids_fn,
2346 from_id_entry = from_id_entry->
next)
2354 ID *from_id = from_id_entry->id_pointer.from;
2359 if (from_id->id_type() ==
ID_KE) {
2360 from_id = (id_cast<Key *>(from_id))->from;
2397 GHash *old_to_new_ids,
2398 const bool untagged_only,
2399 const bool set_fake,
2400 const bool clear_asset_data)
2425 printf(
"Pre-compute current ID relations: Done.\n");
2430 for (
int a = lbarray.size(); a--;) {
2431 ID *
id = lbarray[a]->first();
2437 for (;
id;
id =
static_cast<ID *
>(
id->next)) {
2441 if (ntree !=
nullptr) {
2449 ELEM(lib,
nullptr,
id->override_library->reference->lib) &&
2470 ELEM(lib,
nullptr,
id->lib) &&
2479 if (ntree !=
nullptr) {
2491 printf(
"Step 1: Detect data-blocks to make local: Done.\n");
2501 static_cast<ID *
>(it->link), loop_tags, bmain->
relations, done_ids);
2509 printf(
"Step 2: Check which data-blocks we can directly make local: Done.\n");
2518 for (
LinkNode *it = todo_ids, *it_next; it; it = it_next) {
2520 ID *
id =
static_cast<ID *
>(it->link);
2540 if (
id->newid->id_type() ==
ID_OB) {
2558 printf(
"Step 3: Make IDs local: Done.\n");
2576 ID *
id =
static_cast<ID *
>(it->link);
2582 if (old_to_new_ids) {
2599 printf(
"Step 4: Remap local usages of old (linked) ID to new (local) ID: Done.\n");
2611 if (ob->data !=
nullptr && ob->type ==
OB_ARMATURE && ob->pose !=
nullptr &&
2619 printf(
"Hack: Forcefully rebuild armature object poses: Done.\n");
2627 printf(
"Cleanup and finish: Done.\n");
2658 auto deg_tag_id = [](
ID &
id) ->
void {
2660 switch (
id.id_type()) {
2683 deg_tag_id(*
result.other_id);
2696 const size_t idname_len = strlen(
BKE_id_name(*
id));
2697 const size_t libname_len = strlen(
BKE_id_name(
id->lib->id));
2699 name[idname_len] = separator_char ? separator_char :
' ';
2700 name[idname_len + 1] =
'[';
2703 name[idname_len + 2 + libname_len] =
']';
2704 name[idname_len + 2 + libname_len + 1] =
'\0';
2710 const bool add_lib_hint,
2711 char separator_char,
2719 name[i++] = (
id->flag &
ID_FLAG_FAKEUSER) ?
'F' : ((
id->us == 0) ?
'0' :
' ');
2738 const char ascii_len = strlen(
BKE_id_name(
id->lib->id)) + 32;
2775 if (owner_id_pointer !=
nullptr) {
2776 return *owner_id_pointer;
2790 if (id_from.
lib && !id_to.
lib) {
2806 switch (
id->id_type()) {
2808 return &(id_cast<WorkSpace *>(
id))->order;
2821 BLI_assert((order_a && order_b) || (!order_a && !order_b));
2823 if (order_a && order_b) {
2824 if (*order_a < *order_b) {
2827 if (*order_a > *order_b) {
2832 return strcmp(a->
name,
b->name) < 0;
2839 for (
ID &
id : *lb) {
2863 relative_order = (after) ? lb->count() : 0;
2868 for (
ID &other : *lb) {
2870 if (*order > relative_order) {
2875 *id_order = relative_order + 1;
2879 for (
ID &other : *lb) {
2881 if (*order < relative_order) {
2886 *id_order = relative_order - 1;
2892 if (
id->asset_data) {
2896 if (
id->library_weak_reference !=
nullptr) {
2912 if (
id->override_library) {
2942static_assert(dna::is_ID_v<ID>);
2943static_assert(dna::is_ID_v<Object>);
2944static_assert(!dna::is_ID_v<int>);
2945static_assert(!dna::is_ID_v<ID *>);
2946static_assert(!dna::is_ID_v<const ID>);
2947static_assert(!dna::is_ID_v<ListBase>);
2948static_assert(!dna::is_ID_v<SomeTypeWithIDMember>);
#define MAIN_ID_SESSION_UID_UNSET
#define MAX_ID_FULL_NAME_UI
#define FOREACH_MAIN_ID_END
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
API for Blender-side Rigid Body stuff.
#define STRNCPY_UTF8(dst, src)
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
#define TIMEIT_VALUE_PRINT(var)
#define BLT_I18NCONTEXT_ID_ID
#define CLOG_ERROR(clg_ref,...)
ID and Library types, which are fundamental for SDNA.
#define ID_IS_OVERRIDE_LIBRARY_VIRTUAL(_id)
#define ID_IS_PACKED(_id)
#define ID_FAKE_USERS(id)
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_IS_LINKED(_id)
#define ID_TYPE_IS_DEPRECATED(id_type)
#define ID_IS_EDITABLE(_id)
#define ID_REAL_USERS(id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define ID_NEW_SET(_id, _idn)
#define ID_LINK_PLACEHOLDER
Object groups, one object can be in many groups at once.
#define USER_DEVELOPER_TOOL_TEST(userdef, member)
Read Blender memory allocation and freeing.
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE int32_t atomic_fetch_and_or_int32(int32_t *p, int32_t x)
ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x)
ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x)
#define POINTER_FROM_INT(i)
#define UNUSED_VARS_NDEBUG(...)
#define POINTER_AS_INT(i)
#define BLI_assert_msg(a, msg)
bool contains(const Key &key) const
bool remove(const Key &key)
constexpr const char * c_str() const
void append(const T &value)
IndexRange index_range() const
void add(ID *old_id, ID *new_id)
#define ID_SORT_STEP_SIZE
#define LIB_ID_TYPES_NOCOPY
void action_slots_user_cache_invalidate(Main &bmain)
Library * ensure_archive_library(Main &bmain, ID &id, Library &reference_library, const IDHash &id_deep_hash, bool &is_new)
bNodeTree ** node_tree_ptr_from_id(ID *id)
bNodeTree * node_tree_from_id(ID *id)
const char * BKE_idtype_idcode_to_name(short idcode)
void BKE_main_id_flag_listbase(ListBaseT< ID > *lb, int flag, bool value)
void BKE_main_relations_free(Main *bmain)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BKE_libblock_runtime_reset_remapping_status(ID *id) ATTR_NONNULL(1)
std::array< ListBaseT< ID > *, INDEX_ID_MAX - 1 > MainListsArray
void id_lib_extern(ID *id, bool enforce_fix=false)
static int foreach_assign_id_to_orig_callback(LibraryIDLinkCallbackData *cb_data)
const IDTypeInfo * BKE_idtype_get_info_from_idcode(short id_code)
char * STRNCPY(char(&dst)[N], const char *src)
ID * BKE_libblock_find_name(Main *bmain, short type, const char *name, const std::optional< Library * > lib=std::nullopt) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
void BKE_asset_metadata_write(BlendWriter *writer, AssetMetaData *asset_data)
void * BKE_libblock_alloc_in_lib(Main *bmain, std::optional< Library * > owner_library, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
static int libblock_management_us_min(LibraryIDLinkCallbackData *cb_data)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
AssetMetaData * BKE_asset_metadata_copy(const AssetMetaData *source)
IDTypeInfo IDType_ID_LINK_PLACEHOLDER
PointerRNA RNA_id_pointer_create(ID *id)
ID * BKE_libblock_find_session_uid(Main *bmain, short type, uint32_t session_uid)
static void id_embedded_swap(Main *bmain, ID **embedded_id_a, ID **embedded_id_b, const bool do_full_id, IDRemapper *remapper_id_a, IDRemapper *remapper_id_b)
ID * BKE_libblock_find_name_and_library_filepath(Main *bmain, short type, const char *name, const char *lib_filepath_abs)
void BKE_main_id_flag_all(Main *bmain, int flag, bool value)
void BKE_id_tag_set_atomic(ID *id, int tag)
@ IDWALK_IGNORE_MISSING_OWNER_ID
bool BKE_idtype_idcode_is_linkable(short idcode)
static int * id_order_get(ID *id)
void BKE_lib_libblock_session_uid_ensure(ID *id)
void BKE_asset_metadata_free(AssetMetaData **asset_data)
void IDP_BlendWrite(BlendWriter *writer, const IDProperty *prop)
void void BKE_libblock_remap(Main *bmain, void *old_idv, void *new_idv, int remap_flags) ATTR_NONNULL(1
static void lib_id_library_local_paths(Main *bmain, Library *lib_to, Library *lib_from, ID *id)
static int libblock_management_us_plus(LibraryIDLinkCallbackData *cb_data)
ID * BKE_id_copy_for_use_in_bmain(Main *bmain, const ID *id)
char * BKE_id_to_unique_string_key(const ID *id)
void * BLI_listbase_findafter_string(Link *link, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, struct MemArena *ma) ATTR_NONNULL(1
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
void BKE_libblock_management_main_remove(Main *bmain, void *idv)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
ID * BKE_id_copy_for_duplicate(Main *bmain, ID *id, eDupli_ID_Flags duplicate_flags, int copy_flags)
ID * BKE_libblock_alloc_notest(short type) ATTR_WARN_UNUSED_RESULT
bool BKE_main_namemap_get_unique_name(Main &bmain, ID &id, char *r_name)
ID * BKE_libblock_find_name_and_library(Main *bmain, short type, const char *name, const char *lib_name)
static int id_indirect_linked_update_fn(LibraryIDLinkCallbackData *cb_data)
void lib_id_copy_ensure_local(Main *bmain, const ID *old_id, ID *new_id, const int flags)
AnimData * BKE_animdata_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, AnimData *adt, int flag)
@ ID_REMAP_SKIP_INDIRECT_USAGE
MainListsArray BKE_main_lists_get(Main &bmain)
bool id_can_have_animdata(const ID *id)
void BKE_main_id_repair_duplicate_names_listbase(Main *bmain, ListBaseT< ID > *lb)
const char * BKE_id_name(const ID &id)
bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id)
void BKE_animdata_duplicate_id_action(Main *bmain, ID *id, uint duplicate_flags)
void id_fake_user_set(ID *id)
void BKE_animdata_blend_write(BlendWriter *writer, ID *id)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
void id_us_clear_real(ID *id)
void BKE_libblock_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int orig_flag)
void BKE_main_id_tag_idcode(Main *mainvar, short type, int tag, bool value)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
@ LIB_ID_COPY_NO_LIB_OVERRIDE
@ LIB_ID_COPY_NO_ANIMDATA
@ LIB_ID_COPY_SET_COPIED_ON_WRITE
@ LIB_ID_CREATE_NO_DEG_TAG
@ LIB_ID_CREATE_NO_ALLOCATE
@ LIB_ID_COPY_ASSET_METADATA
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BKE_main_namemap_remove_id(Main &bmain, ID &id)
void BKE_main_id_refcount_recompute(Main *bmain, bool do_linked_only)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
void id_lib_indirect_weak_link(ID *id)
void BKE_lib_id_make_local_generic_action_define(Main *bmain, ID *id, int flags, bool *r_force_local, bool *r_force_copy)
bool BKE_id_can_use_id(const ID &id_from, const ID &id_to)
void id_sort_by_name(ListBaseT< ID > *lb, ID *id, ID *id_sorting_hint)
void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *r_is_used_local, bool *r_is_used_linked)
static void propagate_status_to_embedded_ids(ID &id)
void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int orig_flag)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Key * BKE_key_from_id(ID *id)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
const IDTypeInfo * BKE_idtype_get_info_from_id(const ID *id)
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
void * BKE_libblock_copy(Main *bmain, const ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const ID *id, bool add_lib_hint, char separator_char, int *r_prefix_len)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void BKE_libblock_runtime_ensure(ID &id)
void BKE_rigidbody_ensure_local_object(struct Main *bmain, struct Object *ob)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_lib_override_library_main_hierarchy_root_ensure(Main *bmain, LibOverride_HierarchyRoot_ValidateOptions options={}, ReportList *reports=nullptr)
BMesh const char void * data
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Key ** BKE_key_from_id_p(ID *id)
void BLI_linklist_prepend_nlink(LinkNode **listp, void *ptr, LinkNode *nlink) ATTR_NONNULL(1
void id_lib_indirect(ID *id, bool enforce_fix=false)
void DEG_id_type_tag(Main *bmain, short id_type)
void BKE_lib_id_clear_library_data(Main *bmain, ID *id, int flags)
void BKE_lib_id_make_local_generic(Main *bmain, ID *id, int flags)
static void id_swap(Main *bmain, ID *id_a, ID *id_b, const bool do_full_id, const bool do_self_remap, IDRemapper *input_remapper_id_a, IDRemapper *input_remapper_id_b, const int self_remap_flags)
void BKE_lib_override_library_make_local(Main *bmain, ID *id)
void BKE_id_newptr_and_tag_clear(ID *id)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
void BKE_lib_override_library_copy(ID *dst_id, const ID *src_id, bool do_full_copy)
void BKE_libblock_init_empty(ID *id) ATTR_NONNULL(1)
static bool lib_id_library_local_paths_callback(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, ID *id)
@ LIBRARY_FLAG_IS_ARCHIVE
Vector< ID * > BKE_id_ordered_list(const ListBaseT< ID > *lb)
bool BKE_id_is_in_main(Main *bmain, ID *id)
void BKE_main_relations_create(Main *bmain, short flag)
void BKE_main_id_tag_all(Main *mainvar, int tag, bool value)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
static int id_copy_libmanagement_cb(LibraryIDLinkCallbackData *cb_data)
bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
static bool id_order_compare(ID *a, ID *b)
void BKE_lib_id_expand_local(Main *bmain, ID *id, int flags)
void * BKE_id_new_nomain(short type, const char *name)
void BKE_libblock_management_usercounts_set(Main *bmain, void *idv)
void BKE_main_id_newptr_and_tag_clear(Main *bmain)
void id_us_ensure_real(ID *id)
@ BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE
void BKE_lib_id_swap(Main *bmain, ID *id_a, ID *id_b, const bool do_self_remap, const int self_remap_flags)
IDNewNameResult BKE_libblock_rename(Main &bmain, ID &id, StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
void BKE_id_reorder(const ListBaseT< ID > *lb, ID *id, ID *relative, bool after)
T * DEG_get_original(T *id)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void BKE_lib_id_swap_full(Main *bmain, ID *id_a, ID *id_b, const bool do_self_remap, const int self_remap_flags)
static int lib_id_clear_library_data_users_update_cb(LibraryIDLinkCallbackData *cb_data)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static void library_make_local_copying_check(ID *id, Set< ID * > &loop_tags, MainIDRelations *id_relations, Set< ID * > &done_ids)
void BKE_main_unlock(Main *bmain)
void BKE_lib_libblock_session_uid_renew(ID *id)
ID_Type GS(const char *name)
static int id_refcount_recompute_callback(LibraryIDLinkCallbackData *cb_data)
@ ID_TAG_NO_USER_REFCOUNT
void BKE_id_tag_clear_atomic(ID *id, int tag)
void BKE_main_id_tag_listbase(ListBaseT< ID > *lb, int tag, bool value)
static uint global_session_uid
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
static int lib_id_expand_local_cb(LibraryIDLinkCallbackData *cb_data)
void BKE_main_lock(Main *bmain)
void BKE_id_move_to_same_lib(Main &bmain, ID &id, const ID &owner_id)
bool BKE_id_copy_is_allowed(const ID *id)
void BKE_libblock_management_main_add(Main *bmain, void *idv)
void BKE_main_lib_objects_recalc_all(Main *bmain)
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id, char separator_char)
ID * BKE_id_owner_get(ID *id, const bool debug_relationship_assert=true)
void DEG_relations_tag_update(Main *bmain)
void * BKE_id_new_in_lib(Main *bmain, std::optional< Library * > owner_library, short type, const char *name)
IDNewNameResult BKE_id_rename(Main &bmain, ID &id, StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
@ ID_FLAG_INDIRECT_WEAK_LINK
@ ID_FLAG_LINKED_AND_PACKED
@ ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE
@ LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR
@ LIB_ID_MAKELOCAL_FULL_LIBRARY
@ LIB_ID_MAKELOCAL_FORCE_LOCAL
@ LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR
@ LIB_ID_MAKELOCAL_INDIRECT
@ LIB_ID_MAKELOCAL_FORCE_COPY
size_t BLI_string_split_name_number(const char *name, char delim, char *r_name_left, int *r_number) ATTR_NONNULL(1
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
LibraryForeachIDCallbackFlag
@ IDWALK_CB_WRITEFILE_IGNORE
@ IDWALK_CB_DIRECT_WEAK_LINK
@ IDWALK_CB_EMBEDDED_NOT_OWNING
@ IDWALK_CB_INDIRECT_USAGE
void BKE_main_id_indirect_linked_update(Main &bmain, std::optional< Span< ID * > > local_ids=std::nullopt)
bool BKE_lib_id_make_local(Main *bmain, ID *id, int flags)
IDProperty * IDP_CopyProperty_ex(const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool DEG_is_evaluated(const T *id)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void BKE_libblock_relink_multiple(Main *bmain, const Span< ID * > ids, eIDRemapType remap_type, bke::id::IDRemapper &id_remapper, int remap_flags)
ID * BKE_id_copy(Main *bmain, const ID *id)
bool BKE_id_is_in_global_main(ID *id)
void id_us_plus_no_lib(ID *id)
void id_fake_user_clear(ID *id)
void BKE_library_foreach_ID_link(Main *bmain, ID *id, FunctionRef< LibraryIDLinkCallback > callback, void *user_data, LibraryForeachIDFlag flag)
void * BKE_id_new(Main *bmain, short type, const char *name)
size_t BKE_libblock_get_alloc_info(short type, const char **r_name)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int flag)
bool BKE_id_can_be_asset(const ID *id)
int BLI_str_utf8_invalid_strip(char *str, size_t str_len) ATTR_NONNULL(1)
void BKE_library_make_local(Main *bmain, const Library *lib, GHash *old_to_new_ids, bool untagged_only, bool set_fake, bool clear_asset_data)
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
IDNewNameResult BKE_id_new_name_validate(Main &bmain, ListBaseT< ID > &lb, ID &id, const char *newname, IDNewNameMode mode, bool do_linked_data)
ListBaseT< ID > * which_libbase(Main *bmain, short type)
void BKE_libblock_management_usercounts_clear(Main *bmain, void *idv)
@ IDTYPE_FLAGS_NO_ANIMDATA
@ IDTYPE_FLAGS_NO_LIBLINKING
@ IDTYPE_FLAGS_NEVER_UNUSED
OnClearAssetDataFn on_clear_asset_fn
BPathForeachPathFunctionCallback callback_function
void write_string(const char *data)
void write_struct_list(const ListBaseT< T > *list, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
@ RENAMED_COLLISION_FORCED
@ RENAMED_COLLISION_ADJUSTED
char * subitem_reference_name
char * subitem_local_name
ListBaseT< IDOverrideLibraryPropertyOperation > operations
IDTypeEmbeddedOwnerPointerGetFunction owner_pointer_get
IDTypeMakeLocalFunction make_local
AssetTypeInfo * asset_type_info
IDTypeInitDataFunction init_data
IDTypeCopyDataFunction copy_data
struct LibraryWeakReference * library_weak_reference
IDProperty * system_properties
struct AssetMetaData * asset_data
LibraryForeachIDCallbackFlag cb_flag
bke::library::LibraryRuntime * runtime
MainIDRelationsEntryItem * next
MainIDRelationsEntryItem * from_ids
Map< const ID *, MainIDRelationsEntry * > * relations_from_pointers
MainIDRelations * relations
bool is_locked_for_linking
ListBaseT< Object > objects
bool is_memfile_undo_written
struct Collection * master_collection
UniqueName_Map * name_map