96 N_(
"link_placeholders"),
131 size_t path_dst_maxncpy,
132 const char *path_src)
134 const char **
data =
static_cast<const char **
>(bpath_data->
user_data);
137 const char *base_new =
data[0];
138 const char *base_old =
data[1];
141 CLOG_ERROR(&
LOG,
"old base path '%s' is not absolute.", base_old);
182 const char *bpath_user_data[2] = {
187 path_data.
bmain = bmain;
190 path_data.
user_data = (
void *)bpath_user_data;
213 if (id_in_mainlist) {
217 lib_id_library_local_paths(bmain,
nullptr,
id->lib,
id);
224 if (id_in_mainlist) {
268 bmain, id_iter, lib_id_clear_library_data_users_update_cb,
id,
IDWALK_READONLY);
276 if (key !=
nullptr) {
293 id->lib->runtime->parent =
nullptr;
313 if (
id->us <= limit) {
316 "ID user count error: %s (from '%s')",
318 id->lib ?
id->lib->runtime->filepath_abs :
"[Main]");
366 if (
id->us <= limit) {
371 "ID user decrement error: %s (from '%s'): %d <= %d",
373 id->lib ?
id->lib->runtime->filepath_abs :
"[Main]",
410 if (
id->newid ==
nullptr) {
422 if (key !=
nullptr) {
426 if (ntree !=
nullptr) {
431 if (master_collection !=
nullptr) {
442 int const cb_flag = cb_data->
cb_flag;
455 if (*id_pointer !=
nullptr &&
ID_IS_LINKED(*id_pointer)) {
467 if (*id_pointer && *id_pointer != self_id &&
486 lib_id_library_local_paths(bmain,
nullptr, old_id->
lib, new_id);
491 Main *bmain,
ID *
id,
int flags,
bool *r_force_local,
bool *r_force_copy)
495 BLI_assert(force_copy ==
false || force_copy != force_local);
497 if (force_local || force_copy) {
499 *r_force_local = force_local;
500 *r_force_copy = force_copy;
505 bool is_local =
false, is_lib =
false;
516 if (!lib_local && !is_local && !is_lib) {
519 else if (lib_local || is_local) {
528 *r_force_local = force_local;
529 *r_force_copy = force_copy;
538 bool force_local, force_copy;
548 else if (force_copy) {
549 const int copy_flags =
556 if (id_new !=
nullptr) {
562 if (key && key_new) {
567 if (ntree && ntree_new) {
572 *master_collection_new = ((
Scene *)id_new)->master_collection;
573 if (master_collection && master_collection_new) {
574 ID_NEW_SET(master_collection, master_collection_new);
598 if (idtype_info ==
nullptr) {
625 ID *
id = *id_pointer;
630 if (
id ==
data->id_src) {
632 id = *id_pointer =
data->id_dst;
656#define LIB_ID_TYPES_NOCOPY ID_LI, ID_SCR, ID_WM, ID_WS
660#undef LIB_ID_TYPES_NOCOPY
664 std::optional<Library *> owner_library,
666 std::optional<const ID *> new_owner_id,
670 ID *newid = (new_id_p !=
nullptr) ? *new_id_p :
nullptr;
672 "Copying with 'no allocate' behavior should always get a non-null new ID buffer");
685 memset(newid, 0,
size);
695 if (idtype_info !=
nullptr) {
703 idtype_info->
copy_data(bmain, owner_library, newid,
id,
flag);
710 BLI_assert_msg(newid,
"Could not get an allocated new ID to copy into");
741 if (newid->
lib !=
id->lib) {
742 lib_id_library_local_paths(bmain, newid->
lib,
id->lib, newid);
757 newid->
lib = owner_library ? *owner_library :
id->lib;
760 if (new_id_p !=
nullptr) {
780 const int copy_flags)
785 if (
id->newid ==
nullptr) {
799 if (key !=
nullptr) {
807 if (key_new !=
nullptr) {
845 if (newid ==
nullptr) {
871 if (owner_id.
lib ==
id.lib) {
876 BLI_assert_msg(
false,
"Only local IDs can be moved into a library");
884 id.lib = owner_id.
lib;
895 const bool do_full_id,
906 const bool do_full_id,
907 const bool do_self_remap,
910 const int self_remap_flags)
914 IDRemapper *remapper_id_a = input_remapper_id_a;
915 IDRemapper *remapper_id_b = input_remapper_id_b;
917 if (remapper_id_a ==
nullptr) {
918 remapper_id_a = MEM_new<IDRemapper>(__func__);
920 if (remapper_id_b ==
nullptr) {
921 remapper_id_b = MEM_new<IDRemapper>(__func__);
927 const size_t id_struct_size = id_type->
struct_size;
929 const ID id_a_back = *id_a;
930 const ID id_b_back = *id_b;
932 char *id_swap_buff =
static_cast<char *
>(alloca(id_struct_size));
934 memcpy(id_swap_buff, id_a, id_struct_size);
935 memcpy(id_a, id_b, id_struct_size);
936 memcpy(id_b, id_swap_buff, id_struct_size);
970 if (remapper_id_a !=
nullptr) {
971 remapper_id_a->
add(id_b, id_a);
973 if (remapper_id_b !=
nullptr) {
974 remapper_id_b->
add(id_a, id_b);
1001 if (input_remapper_id_a ==
nullptr && remapper_id_a !=
nullptr) {
1002 MEM_delete(remapper_id_a);
1004 if (input_remapper_id_b ==
nullptr && remapper_id_b !=
nullptr) {
1005 MEM_delete(remapper_id_b);
1016 const bool do_full_id,
1020 if (embedded_id_a !=
nullptr && *embedded_id_a !=
nullptr) {
1023 if (*embedded_id_b ==
nullptr) {
1031 bmain, *embedded_id_a, *embedded_id_b, do_full_id,
false, remapper_id_a, remapper_id_b, 0);
1033 std::swap(*embedded_id_a, *embedded_id_b);
1037 if (remapper_id_a !=
nullptr) {
1038 remapper_id_a->
add(*embedded_id_b, *embedded_id_a);
1040 if (remapper_id_b !=
nullptr) {
1041 remapper_id_b->
add(*embedded_id_a, *embedded_id_b);
1047 Main *bmain,
ID *id_a,
ID *id_b,
const bool do_self_remap,
const int self_remap_flags)
1049 id_swap(bmain, id_a, id_b,
false, do_self_remap,
nullptr,
nullptr, self_remap_flags);
1053 Main *bmain,
ID *id_a,
ID *id_b,
const bool do_self_remap,
const int self_remap_flags)
1055 id_swap(bmain, id_a, id_b,
true, do_self_remap,
nullptr,
nullptr, self_remap_flags);
1060 ID *newid =
nullptr;
1069 if (newid !=
nullptr) {
1115 ID *
id =
static_cast<ID *
>(idv);
1148 ID *
id =
static_cast<ID *
>(idv);
1168 ID *
id =
static_cast<ID *
>(idv);
1180 ID *
id =
static_cast<ID *
>(idv);
1195 for (
id =
static_cast<ID *
>(lb->
first);
id;
id =
static_cast<ID *
>(
id->next)) {
1200 const int ntag = ~tag;
1201 for (
id =
static_cast<ID *
>(lb->
first);
id;
id =
static_cast<ID *
>(
id->next)) {
1217 int a = lbarray.size();
1227 for (
id =
static_cast<ID *
>(lb->
first);
id;
id =
static_cast<ID *
>(
id->next)) {
1232 const int nflag =
~flag;
1233 for (
id =
static_cast<ID *
>(lb->
first);
id;
id =
static_cast<ID *
>(
id->next)) {
1242 int a = lbarray.size();
1270 for (
i = 0;
i < lb_len;
i++) {
1310 if (id_type ==
nullptr) {
1311 if (r_name !=
nullptr) {
1317 if (r_name !=
nullptr) {
1318 *r_name = id_type->
name;
1335 std::optional<Library *> owner_library,
1358 *((
short *)
id->name) = type;
1387 id->lib = owner_library ? *owner_library :
nullptr;
1414 id->lib = owner_library ? *owner_library :
nullptr;
1437 if (idtype_info !=
nullptr) {
1438 if (idtype_info->
init_data !=
nullptr) {
1449 id->runtime.remap.status = 0;
1450 id->runtime.remap.skipped_refcounted = 0;
1451 id->runtime.remap.skipped_direct = 0;
1452 id->runtime.remap.skipped_indirect = 0;
1478 std::optional<Library *> owner_library,
1485 if (name ==
nullptr) {
1502 if (name ==
nullptr) {
1517 std::optional<Library *> owner_library,
1519 std::optional<const ID *> new_owner_id,
1521 const int orig_flag)
1523 ID *new_id = *new_id_p;
1524 int flag = orig_flag;
1537 if ((bmain !=
nullptr) && is_embedded_id) {
1544 const int copy_idtag_mask =
1557 new_id->
lib = owner_library ? *owner_library :
id->lib;
1561 new_id =
static_cast<ID *
>(
1574 const size_t id_offset =
sizeof(
ID);
1575 if (
int(id_len) -
int(id_offset) > 0) {
1576 const char *cp = (
const char *)
id;
1577 char *cpn = (
char *)new_id;
1579 memcpy(cpn + id_offset, cp + id_offset, id_len - id_offset);
1582 new_id->
flag = (new_id->
flag & ~copy_idflag_mask) | (
id->flag & copy_idflag_mask);
1583 new_id->
tag = (new_id->
tag & ~copy_idtag_mask) | (
id->tag & copy_idtag_mask);
1594 if (new_owner_id.has_value()) {
1598 if (owner_id_pointer) {
1599 *owner_id_pointer =
const_cast<ID *
>(*new_owner_id);
1600 if (*new_owner_id ==
nullptr) {
1611 if (
id->properties) {
1614 if (
id->system_properties) {
1651 if (
id->asset_data) {
1682 const std::optional<Library *>
lib)
1689 while (
id &&
id->lib != *
lib) {
1702 if (
id->session_uid == session_uid) {
1724 const char *lib_name)
1732 if (lib_name ==
nullptr || lib_name[0] ==
'\0') {
1733 if (
id->lib ==
nullptr) {
1738 if (
id->lib ==
nullptr) {
1752 const char *lib_filepath_abs)
1760 if (
id->lib ==
nullptr && lib_filepath_abs ==
nullptr) {
1763 if (
id->lib && lib_filepath_abs &&
STREQ(
id->lib->runtime->filepath_abs, lib_filepath_abs)) {
1772#define ID_SORT_STEP_SIZE 512
1784 if (!
ELEM(id_sorting_hint,
nullptr,
id) && id_sorting_hint->
lib ==
id->lib) {
1787 ID *id_sorting_hint_next =
static_cast<ID *
>(id_sorting_hint->
next);
1789 (id_sorting_hint_next ==
nullptr || id_sorting_hint_next->
lib !=
id->lib ||
1796 ID *id_sorting_hint_prev =
static_cast<ID *
>(id_sorting_hint->
prev);
1798 (id_sorting_hint_prev ==
nullptr || id_sorting_hint_prev->
lib !=
id->lib ||
1807 int item_array_index;
1814 bool is_in_library =
false;
1816 for (idtest =
static_cast<ID *
>(lb->
last); idtest !=
nullptr;
1817 idtest =
static_cast<ID *
>(idtest->
prev))
1819 if (is_in_library) {
1820 if (idtest->
lib !=
id->lib) {
1826 else if (idtest->
lib ==
id->lib) {
1828 is_in_library =
true;
1831 if (!is_in_library) {
1835 item_array[item_array_index] = idtest;
1836 if (item_array_index == 0) {
1852 for (item_array_index++; item_array_index <
ID_SORT_STEP_SIZE; item_array_index++) {
1853 idtest =
static_cast<ID *
>(item_array[item_array_index]);
1860 if (idtest ==
nullptr) {
1880#undef ID_SORT_STEP_SIZE
1886 const char *newname,
1888 const bool do_linked_data)
1900 if (newname ==
nullptr) {
1906 if (name[0] ==
'\0') {
1925 if (had_name_collision &&
1930 int prev_number = 0;
1952 if (is_idname_changed) {
1953 BLI_strncpy(
id.name + 2, orig_name,
sizeof(
id.name) - 2);
1969 if (is_idname_changed) {
1970 BLI_strncpy(
id.name + 2, name,
sizeof(
id.name) - 2);
1974 else if (had_name_collision) {
1997 if (*id_pointer ==
nullptr) {
2060 from_id_entry = from_id_entry->
next)
2068 ID *from_id = from_id_entry->id_pointer.from;
2074 from_id = ((
Key *)from_id)->from;
2111 GHash *old_to_new_ids,
2112 const bool untagged_only,
2113 const bool set_fake,
2114 const bool clear_asset_data)
2139 printf(
"Pre-compute current ID relations: Done.\n");
2144 for (
int a = lbarray.size(); a--;) {
2145 ID *
id =
static_cast<ID *
>(lbarray[a]->first);
2151 for (;
id;
id =
static_cast<ID *
>(
id->next)) {
2155 if (ntree !=
nullptr) {
2163 ELEM(
lib,
nullptr,
id->override_library->reference->lib) &&
2193 if (ntree !=
nullptr) {
2205 printf(
"Step 1: Detect data-blocks to make local: Done.\n");
2215 static_cast<ID *
>(it->link), loop_tags, bmain->
relations, done_ids);
2225 printf(
"Step 2: Check which data-blocks we can directly make local: Done.\n");
2234 for (
LinkNode *it = todo_ids, *it_next; it; it = it_next) {
2236 ID *
id =
static_cast<ID *
>(it->link);
2274 printf(
"Step 3: Make IDs local: Done.\n");
2292 ID *
id =
static_cast<ID *
>(it->link);
2298 if (old_to_new_ids) {
2315 printf(
"Step 4: Remap local usages of old (linked) ID to new (local) ID: Done.\n");
2327 ob =
static_cast<Object *
>(ob->id.next))
2329 if (ob->data !=
nullptr && ob->type ==
OB_ARMATURE && ob->pose !=
nullptr &&
2337 printf(
"Hack: Forcefully rebuild armature object poses: Done.\n");
2345 printf(
"Cleanup and finish: Done.\n");
2379 auto deg_tag_id = [](
ID &
id) ->
void {
2381 switch (
GS(
id.name)) {
2404 deg_tag_id(*
result.other_id);
2417 const size_t idname_len = strlen(
BKE_id_name(*
id));
2418 const size_t libname_len = strlen(
BKE_id_name(
id->lib->id));
2420 name[idname_len] = separator_char ? separator_char :
' ';
2421 name[idname_len + 1] =
'[';
2424 name[idname_len + 2 + libname_len] =
']';
2425 name[idname_len + 2 + libname_len + 1] =
'\0';
2431 const bool add_lib_hint,
2432 char separator_char,
2459 const char ascii_len = strlen(
BKE_id_name(
id->lib->id)) + 32;
2496 if (owner_id_pointer !=
nullptr) {
2497 return *owner_id_pointer;
2511 if (id_from.
lib && !id_to.
lib) {
2527 switch (
GS(
id->name)) {
2542 BLI_assert((order_a && order_b) || (!order_a && !order_b));
2544 if (order_a && order_b) {
2545 if (*order_a < *order_b) {
2548 if (*order_a > *order_b) {
2553 return strcmp(a->
name,
b->name) < 0;
2591 if (*order > relative_order) {
2596 *id_order = relative_order + 1;
2602 if (*order < relative_order) {
2607 *id_order = relative_order - 1;
2613 if (
id->asset_data) {
2617 if (
id->library_weak_reference !=
nullptr) {
2630 if (
id->override_library) {
2639 if (opop->subitem_reference_name) {
2642 if (opop->subitem_local_name) {
2654static_assert(blender::dna::is_ID_v<ID>);
2655static_assert(blender::dna::is_ID_v<Object>);
2656static_assert(!blender::dna::is_ID_v<int>);
2657static_assert(!blender::dna::is_ID_v<ID *>);
2658static_assert(!blender::dna::is_ID_v<const ID>);
2659static_assert(!blender::dna::is_ID_v<ListBase>);
2660static_assert(!blender::dna::is_ID_v<SomeTypeWithIDMember>);
AnimData * BKE_animdata_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, AnimData *adt, int flag)
void BKE_animdata_blend_write(BlendWriter *writer, ID *id)
bool id_can_have_animdata(const ID *id)
void BKE_animdata_duplicate_id_action(Main *bmain, ID *id, uint duplicate_flags)
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
AssetMetaData * BKE_asset_metadata_copy(const AssetMetaData *source)
void BKE_asset_metadata_free(AssetMetaData **asset_data)
void BKE_asset_metadata_write(BlendWriter *writer, AssetMetaData *asset_data)
void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, ID *id)
@ BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE
Main * CTX_data_main(const bContext *C)
IDProperty * IDP_CopyProperty_ex(const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_BlendWrite(BlendWriter *writer, const IDProperty *prop)
@ IDTYPE_FLAGS_NO_ANIMDATA
@ IDTYPE_FLAGS_NO_LIBLINKING
const IDTypeInfo * BKE_idtype_get_info_from_id(const ID *id)
const IDTypeInfo * BKE_idtype_get_info_from_idcode(short id_code)
const char * BKE_idtype_idcode_to_name(short idcode)
bool BKE_idtype_idcode_is_linkable(short idcode)
IDTypeInfo IDType_ID_LINK_PLACEHOLDER
Key ** BKE_key_from_id_p(ID *id)
Key * BKE_key_from_id(ID *id)
@ LIB_ID_CREATE_NO_ALLOCATE
@ LIB_ID_COPY_ASSET_METADATA
@ LIB_ID_COPY_NO_LIB_OVERRIDE
@ LIB_ID_COPY_SET_COPIED_ON_WRITE
@ LIB_ID_CREATE_NO_USER_REFCOUNT
@ LIB_ID_COPY_NO_ANIMDATA
@ LIB_ID_CREATE_NO_DEG_TAG
#define MAIN_ID_SESSION_UID_UNSET
#define MAX_ID_FULL_NAME_UI
@ LIB_ID_MAKELOCAL_INDIRECT
@ LIB_ID_MAKELOCAL_FORCE_LOCAL
@ LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR
@ LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR
@ LIB_ID_MAKELOCAL_FULL_LIBRARY
@ LIB_ID_MAKELOCAL_FORCE_COPY
const char * BKE_id_name(const ID &id)
void BKE_lib_override_library_main_hierarchy_root_ensure(Main *bmain)
bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id)
void BKE_lib_override_library_copy(ID *dst_id, const ID *src_id, bool do_full_copy)
void BKE_lib_override_library_make_local(Main *bmain, ID *id)
void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *r_is_used_local, bool *r_is_used_linked)
LibraryForeachIDCallbackFlag
@ IDWALK_CB_EMBEDDED_NOT_OWNING
void BKE_library_foreach_ID_link(Main *bmain, ID *id, blender::FunctionRef< LibraryIDLinkCallback > callback, void *user_data, LibraryForeachIDFlag flag)
@ IDWALK_IGNORE_MISSING_OWNER_ID
void BKE_libblock_relink_multiple(Main *bmain, const blender::Span< ID * > ids, eIDRemapType remap_type, blender::bke::id::IDRemapper &id_remapper, int remap_flags)
@ ID_REMAP_SKIP_INDIRECT_USAGE
void void BKE_libblock_remap(Main *bmain, void *old_idv, void *new_idv, int remap_flags) ATTR_NONNULL(1
#define FOREACH_MAIN_ID_END
MainListsArray BKE_main_lists_get(Main &bmain)
ListBase * which_libbase(Main *bmain, short type)
std::array< ListBase *, INDEX_ID_MAX - 1 > MainListsArray
void BKE_main_lock(Main *bmain)
void BKE_main_relations_create(Main *bmain, short flag)
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
void BKE_main_unlock(Main *bmain)
void BKE_main_relations_free(Main *bmain)
void BKE_main_namemap_remove_id(Main &bmain, ID &id)
bool BKE_main_namemap_get_unique_name(Main &bmain, ID &id, char *r_name)
API for Blender-side Rigid Body stuff.
void BKE_rigidbody_ensure_local_object(struct Main *bmain, struct Object *ob)
#define BLI_assert_msg(a, msg)
GSet * BLI_gset_ptr_new(const char *info)
bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_gset_len(const GSet *gs) ATTR_WARN_UNUSED_RESULT
void BLI_gset_insert(GSet *gs, void *key)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GSet * BLI_gset_str_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
bool BLI_gset_add(GSet *gs, void *key)
bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp)
void BLI_linklist_prepend_nlink(LinkNode **listp, void *ptr, LinkNode *nlink) ATTR_NONNULL(1
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, struct MemArena *ma) ATTR_NONNULL(1
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_listbase_findafter_string(Link *link, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
int BLI_str_utf8_invalid_strip(char *str, size_t str_len) ATTR_NONNULL(1)
#define STRNCPY_UTF8(dst, src)
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
#define TIMEIT_VALUE_PRINT(var)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_write_string(BlendWriter *writer, const char *data_ptr)
#define BLO_write_struct_list(writer, struct_name, list_ptr)
#define BLT_I18NCONTEXT_ID_ID
#define CLOG_ERROR(clg_ref,...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_id_type_tag(Main *bmain, short id_type)
void DEG_relations_tag_update(Main *bmain)
bool DEG_is_evaluated(const T *id)
T * DEG_get_original(T *id)
ID and Library types, which are fundamental for SDNA.
@ ID_FLAG_INDIRECT_WEAK_LINK
@ ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE
@ ID_TAG_NO_USER_REFCOUNT
Object groups, one object can be in many groups at once.
Read Guarded memory(de)allocation.
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)
blender::StringRef BLI_string_split_name_number(const blender::StringRef name_full, const char delim, int &r_number)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
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_IS_OVERRIDE_LIBRARY_VIRTUAL(_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_LINK_PLACEHOLDER
#define ID_REAL_USERS(id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define ID_NEW_SET(_id, _idn)
void BKE_id_newptr_and_tag_clear(ID *id)
ID * BKE_id_owner_get(ID *id, const bool debug_relationship_assert)
ID * BKE_libblock_alloc_notest(short type)
DEG_id_tag_update_ex(cb_data->bmain, cb_data->owner_id, ID_RECALC_TAG_FOR_UNDO|ID_RECALC_SYNC_TO_EVAL)
void BKE_libblock_init_empty(ID *id)
void id_lib_extern(ID *id)
void BKE_main_id_refcount_recompute(Main *bmain, const bool do_linked_only)
void * BKE_id_new_in_lib(Main *bmain, std::optional< Library * > owner_library, const short type, const char *name)
void BKE_main_id_repair_duplicate_names_listbase(Main *bmain, ListBase *lb)
void BKE_library_make_local(Main *bmain, const Library *lib, GHash *old_to_new_ids, const bool untagged_only, const bool set_fake, const bool clear_asset_data)
static int id_copy_libmanagement_cb(LibraryIDLinkCallbackData *cb_data)
#define ID_SORT_STEP_SIZE
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, const int orig_flag)
ID * BKE_id_copy_for_use_in_bmain(Main *bmain, const ID *id)
void BKE_id_tag_clear_atomic(ID *id, int tag)
void BKE_lib_id_clear_library_data(Main *bmain, ID *id, const int flags)
bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
ID * BKE_libblock_find_name(Main *bmain, const short type, const char *name, const std::optional< Library * > lib)
void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **new_id_p, const int orig_flag)
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id, char separator_char)
ID * BKE_libblock_find_name_and_library(Main *bmain, const short type, const char *name, const char *lib_name)
static bool lib_id_library_local_paths_callback(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
static int id_refcount_recompute_callback(LibraryIDLinkCallbackData *cb_data)
char * BKE_id_to_unique_string_key(const ID *id)
void BKE_main_id_flag_listbase(ListBase *lb, const int flag, const bool value)
void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint)
bool BKE_id_copy_is_allowed(const ID *id)
void BKE_main_id_tag_idcode(Main *mainvar, const short type, const int tag, const bool value)
void BKE_libblock_management_main_remove(Main *bmain, void *idv)
ID * BKE_libblock_find_name_and_library_filepath(Main *bmain, short type, const char *name, const char *lib_filepath_abs)
static int libblock_management_us_plus(LibraryIDLinkCallbackData *cb_data)
void BKE_lib_id_expand_local(Main *bmain, ID *id, const 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)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, const int flag)
void BKE_id_tag_set_atomic(ID *id, int tag)
void BKE_id_move_to_same_lib(Main &bmain, ID &id, const ID &owner_id)
bool BKE_id_can_use_id(const ID &id_from, const ID &id_to)
#define LIB_ID_TYPES_NOCOPY
void id_fake_user_set(ID *id)
void BKE_lib_id_swap(Main *bmain, ID *id_a, ID *id_b, const bool do_self_remap, const int self_remap_flags)
void BKE_id_reorder(const ListBase *lb, ID *id, ID *relative, bool after)
void * BKE_libblock_copy(Main *bmain, const ID *id)
void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const ID *id, const bool add_lib_hint, char separator_char, int *r_prefix_len)
IDNewNameResult BKE_libblock_rename(Main &bmain, ID &id, blender::StringRefNull name, const IDNewNameMode mode)
void BKE_main_id_flag_all(Main *bmain, const int flag, const bool value)
static int lib_id_expand_local_cb(LibraryIDLinkCallbackData *cb_data)
bool BKE_id_is_in_main(Main *bmain, ID *id)
void BKE_libblock_runtime_reset_remapping_status(ID *id)
void BKE_main_id_newptr_and_tag_clear(Main *bmain)
void BKE_lib_libblock_session_uid_ensure(ID *id)
void * BKE_id_new_nomain(const short type, const char *name)
void id_us_ensure_real(ID *id)
void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags)
void id_fake_user_clear(ID *id)
void id_us_clear_real(ID *id)
void BKE_lib_id_swap_full(Main *bmain, ID *id_a, ID *id_b, const bool do_self_remap, const int self_remap_flags)
void BKE_libblock_management_usercounts_set(Main *bmain, void *idv)
void BKE_lib_id_make_local_generic_action_define(Main *bmain, ID *id, int flags, bool *r_force_local, bool *r_force_copy)
void BKE_main_lib_objects_recalc_all(Main *bmain)
ID * BKE_id_copy(Main *bmain, const ID *id)
void id_us_plus_no_lib(ID *id)
static void library_make_local_copying_check(ID *id, GSet *loop_tags, MainIDRelations *id_relations, GSet *done_ids)
void BKE_main_id_tag_listbase(ListBase *lb, const int tag, const bool value)
void lib_id_copy_ensure_local(Main *bmain, const ID *old_id, ID *new_id, const int flags)
void BKE_main_id_tag_all(Main *mainvar, const int tag, const bool value)
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)
void id_lib_indirect_weak_link(ID *id)
bool BKE_lib_id_make_local(Main *bmain, ID *id, const int flags)
void * BKE_id_new(Main *bmain, const short type, const char *name)
static int * id_order_get(ID *id)
void * BKE_libblock_alloc_in_lib(Main *bmain, std::optional< Library * > owner_library, short type, const char *name, const int flag)
static uint global_session_uid
Vector< ID * > BKE_id_ordered_list(const ListBase *lb)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, const int flag)
IDNewNameResult BKE_id_new_name_validate(Main &bmain, ListBase &lb, ID &id, const char *newname, IDNewNameMode mode, const bool do_linked_data)
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, const int flag)
static int libblock_management_us_min(LibraryIDLinkCallbackData *cb_data)
ID * BKE_libblock_find_session_uid(Main *bmain, const short type, const uint32_t session_uid)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
void BKE_libblock_management_main_add(Main *bmain, void *idv)
ID * BKE_id_copy_for_duplicate(Main *bmain, ID *id, const eDupli_ID_Flags duplicate_flags, const int copy_flags)
void BKE_libblock_management_usercounts_clear(Main *bmain, void *idv)
static bool id_order_compare(ID *a, ID *b)
static int foreach_assign_id_to_orig_callback(LibraryIDLinkCallbackData *cb_data)
size_t BKE_libblock_get_alloc_info(short type, const char **r_name)
bool BKE_id_can_be_asset(const ID *id)
IDNewNameResult BKE_id_rename(Main &bmain, ID &id, blender::StringRefNull name, const IDNewNameMode mode)
bool BKE_id_is_in_global_main(ID *id)
void BKE_lib_libblock_session_uid_renew(ID *id)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void action_slots_user_cache_invalidate(Main &bmain)
bNodeTree ** node_tree_ptr_from_id(ID *id)
bNodeTree * node_tree_from_id(ID *id)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_id_pointer_create(ID *id)
OnClearAssetDataFn on_clear_asset_fn
BPathForeachPathFunctionCallback callback_function
@ RENAMED_COLLISION_FORCED
@ RENAMED_COLLISION_ADJUSTED
IDTypeCopyDataFunction copy_data
IDTypeInitDataFunction init_data
IDTypeMakeLocalFunction make_local
AssetTypeInfo * asset_type_info
IDTypeEmbeddedOwnerPointerGetFunction owner_pointer_get
struct AssetMetaData * asset_data
IDProperty * system_properties
struct LibraryWeakReference * library_weak_reference
LibraryForeachIDCallbackFlag cb_flag
LibraryRuntimeHandle * runtime
MainIDRelationsEntryItem * next
MainIDRelationsEntryItem * from_ids
GHash * relations_from_pointers
bool is_locked_for_linking
bool is_memfile_undo_written
MainIDRelations * relations
struct Collection * master_collection
static DynamicLibrary lib