94 N_(
"link_placeholders"),
129 size_t path_dst_maxncpy,
130 const char *path_src)
132 const char **data =
static_cast<const char **
>(bpath_data->
user_data);
135 const char *base_new = data[0];
136 const char *base_old = data[1];
139 CLOG_ERROR(&
LOG,
"old base path '%s' is not absolute.", base_old);
180 const char *bpath_user_data[2] = {
185 path_data.
bmain = bmain;
188 path_data.user_data = (
void *)bpath_user_data;
211 if (id_in_mainlist) {
221 id->flag &= ~ID_FLAG_INDIRECT_WEAK_LINK;
222 if (id_in_mainlist) {
229 if (!
ELEM(result.action,
274 if (key !=
nullptr) {
288 id->tag &= ~ID_TAG_INDIRECT;
289 id->flag &= ~ID_FLAG_INDIRECT_WEAK_LINK;
291 id->lib->runtime.parent =
nullptr;
311 if (id->us <= limit) {
314 "ID user count error: %s (from '%s')",
316 id->lib ? id->lib->runtime.filepath_abs :
"[Main]");
342 id->tag &= ~ID_TAG_EXTRAUSER_SET;
364 if (id->us <= limit) {
369 "ID user decrement error: %s (from '%s'): %d <= %d",
371 id->lib ? id->lib->runtime.filepath_abs :
"[Main]",
400 id->flag &= ~ID_FLAG_FAKEUSER;
408 if (id->newid ==
nullptr) {
412 id->newid->tag &= ~ID_TAG_NEW;
420 if (key !=
nullptr) {
424 if (ntree !=
nullptr) {
429 if (master_collection !=
nullptr) {
440 int const cb_flag = cb_data->
cb_flag;
453 if (*id_pointer !=
nullptr &&
ID_IS_LINKED(*id_pointer)) {
465 if (*id_pointer && *id_pointer != self_id &&
489 Main *bmain,
ID *
id,
int flags,
bool *r_force_local,
bool *r_force_copy)
493 BLI_assert(force_copy ==
false || force_copy != force_local);
495 if (force_local || force_copy) {
497 *r_force_local = force_local;
498 *r_force_copy = force_copy;
503 bool is_local =
false, is_lib =
false;
514 if (!lib_local && !is_local && !is_lib) {
517 else if (lib_local || is_local) {
526 *r_force_local = force_local;
527 *r_force_copy = force_copy;
536 bool force_local, force_copy;
546 else if (force_copy) {
547 const int copy_flags =
554 if (id_new !=
nullptr) {
560 if (key && key_new) {
565 if (ntree && ntree_new) {
570 *master_collection_new = ((
Scene *)id_new)->master_collection;
571 if (master_collection && master_collection_new) {
572 ID_NEW_SET(master_collection, master_collection_new);
596 if (idtype_info ==
nullptr) {
623 ID *
id = *id_pointer;
624 const int cb_flag = cb_data->
cb_flag;
628 if (
id == data->id_src) {
630 id = *id_pointer = data->id_dst;
649#define LIB_ID_TYPES_NOCOPY ID_LI, ID_SCR, ID_WM, ID_WS
653#undef LIB_ID_TYPES_NOCOPY
657 std::optional<Library *> owner_library,
659 const ID *new_owner_id,
663 ID *newid = (new_id_p !=
nullptr) ? *new_id_p :
nullptr;
665 "Copying with 'no allocate' behavior should always get a non-null new ID buffer");
678 memset(newid, 0, size);
688 if (idtype_info !=
nullptr) {
696 idtype_info->
copy_data(bmain, owner_library, newid,
id,
flag);
703 BLI_assert_msg(newid,
"Could not get an allocated new ID to copy into");
734 if (newid->
lib != id->lib) {
750 newid->
lib = owner_library ? *owner_library :
id->lib;
753 if (new_id_p !=
nullptr) {
773 const int copy_flags)
778 if (id->newid ==
nullptr) {
792 if (key !=
nullptr) {
800 if (key_new !=
nullptr) {
838 if (newid ==
nullptr) {
864 if (owner_id.
lib ==
id.lib) {
869 BLI_assert_msg(
false,
"Only local IDs can be moved into a library");
875 id.lib = owner_id.
lib;
886 const bool do_full_id,
897 const bool do_full_id,
898 const bool do_self_remap,
901 const int self_remap_flags)
905 IDRemapper *remapper_id_a = input_remapper_id_a;
906 IDRemapper *remapper_id_b = input_remapper_id_b;
908 if (remapper_id_a ==
nullptr) {
909 remapper_id_a = MEM_new<IDRemapper>(__func__);
911 if (remapper_id_b ==
nullptr) {
912 remapper_id_b = MEM_new<IDRemapper>(__func__);
918 const size_t id_struct_size = id_type->
struct_size;
920 const ID id_a_back = *id_a;
921 const ID id_b_back = *id_b;
923 char *id_swap_buff =
static_cast<char *
>(alloca(id_struct_size));
925 memcpy(id_swap_buff, id_a, id_struct_size);
926 memcpy(id_a, id_b, id_struct_size);
927 memcpy(id_b, id_swap_buff, id_struct_size);
957 if (remapper_id_a !=
nullptr) {
958 remapper_id_a->
add(id_b, id_a);
960 if (remapper_id_b !=
nullptr) {
961 remapper_id_b->
add(id_a, id_b);
972 if (input_remapper_id_a ==
nullptr && remapper_id_a !=
nullptr) {
973 MEM_delete(remapper_id_a);
975 if (input_remapper_id_b ==
nullptr && remapper_id_b !=
nullptr) {
976 MEM_delete(remapper_id_b);
986 const bool do_full_id,
990 if (embedded_id_a !=
nullptr && *embedded_id_a !=
nullptr) {
993 if (*embedded_id_b ==
nullptr) {
1009 std::swap(*embedded_id_a, *embedded_id_b);
1013 if (remapper_id_a !=
nullptr) {
1014 remapper_id_a->
add(*embedded_id_b, *embedded_id_a);
1016 if (remapper_id_b !=
nullptr) {
1017 remapper_id_b->
add(*embedded_id_a, *embedded_id_b);
1023 Main *bmain,
ID *id_a,
ID *id_b,
const bool do_self_remap,
const int self_remap_flags)
1025 id_swap(bmain, id_a, id_b,
false, do_self_remap,
nullptr,
nullptr, self_remap_flags);
1029 Main *bmain,
ID *id_a,
ID *id_b,
const bool do_self_remap,
const int self_remap_flags)
1031 id_swap(bmain, id_a, id_b,
true, do_self_remap,
nullptr,
nullptr, self_remap_flags);
1036 ID *newid =
nullptr;
1045 if (newid !=
nullptr) {
1060 gpd->
flag &= ~GP_DATA_SHOW_ONIONSKINS;
1074 const int cb_flag = cb_data->
cb_flag;
1088 const int cb_flag = cb_data->
cb_flag;
1099 ID *
id =
static_cast<ID *
>(idv);
1132 ID *
id =
static_cast<ID *
>(idv);
1152 ID *
id =
static_cast<ID *
>(idv);
1159 id->tag &= ~ID_TAG_NO_USER_REFCOUNT;
1164 ID *
id =
static_cast<ID *
>(idv);
1179 for (
id =
static_cast<ID *
>(lb->
first); id;
id =
static_cast<ID *
>(
id->next)) {
1184 const int ntag = ~tag;
1185 for (
id =
static_cast<ID *
>(lb->
first); id;
id =
static_cast<ID *
>(
id->next)) {
1213 for (
id =
static_cast<ID *
>(lb->
first); id;
id =
static_cast<ID *
>(
id->next)) {
1218 const int nflag = ~flag;
1219 for (
id =
static_cast<ID *
>(lb->
first); id;
id =
static_cast<ID *
>(
id->next)) {
1248 ID **id_array =
static_cast<ID **
>(
MEM_mallocN(
sizeof(*id_array) * lb_len, __func__));
1257 for (i = 0; i < lb_len; i++) {
1297 if (id_type ==
nullptr) {
1298 if (r_name !=
nullptr) {
1304 if (r_name !=
nullptr) {
1305 *r_name = id_type->
name;
1322 std::optional<Library *> owner_library,
1345 *((
short *)id->name) = type;
1374 id->lib = owner_library ? *owner_library :
nullptr;
1400 BLI_strncpy(id->name + 2, name,
sizeof(id->name) - 2);
1401 id->lib = owner_library ? *owner_library :
nullptr;
1424 if (idtype_info !=
nullptr) {
1425 if (idtype_info->
init_data !=
nullptr) {
1436 id->runtime.remap.status = 0;
1437 id->runtime.remap.skipped_refcounted = 0;
1438 id->runtime.remap.skipped_direct = 0;
1439 id->runtime.remap.skipped_indirect = 0;
1465 std::optional<Library *> owner_library,
1472 if (name ==
nullptr) {
1489 if (name ==
nullptr) {
1504 std::optional<Library *> owner_library,
1506 const ID *new_owner_id,
1508 const int orig_flag)
1510 ID *new_id = *new_id_p;
1511 int flag = orig_flag;
1524 if ((bmain !=
nullptr) && is_embedded_id) {
1531 const int copy_idtag_mask =
1544 new_id->
lib = owner_library ? *owner_library :
id->lib;
1548 new_id =
static_cast<ID *
>(
1557 new_id->
tag &= ~ID_TAG_COPIED_ON_EVAL;
1561 const size_t id_offset =
sizeof(
ID);
1562 if (
int(id_len) -
int(id_offset) > 0) {
1563 const char *cp = (
const char *)
id;
1564 char *cpn = (
char *)new_id;
1566 memcpy(cpn + id_offset, cp + id_offset, id_len - id_offset);
1569 new_id->
flag = (new_id->
flag & ~copy_idflag_mask) | (id->flag & copy_idflag_mask);
1570 new_id->
tag = (new_id->
tag & ~copy_idtag_mask) | (id->tag & copy_idtag_mask);
1574 new_id->
tag &= ~ID_TAG_NO_MAIN;
1585 *owner_id_pointer =
const_cast<ID *
>(new_owner_id);
1592 if (id->properties) {
1629 if (id->asset_data) {
1660 const std::optional<Library *>
lib)
1667 while (
id && id->lib != *
lib) {
1680 if (id->session_uid == session_uid) {
1690 const char *lib_name)
1698 if (lib_name ==
nullptr || lib_name[0] ==
'\0') {
1699 if (id->lib ==
nullptr) {
1704 if (id->lib ==
nullptr) {
1718 const char *lib_filepath_abs)
1726 if (id->lib ==
nullptr && lib_filepath_abs ==
nullptr) {
1729 else if (id->lib && lib_filepath_abs &&
STREQ(id->lib->runtime.filepath_abs, lib_filepath_abs))
1739#define ID_SORT_STEP_SIZE 512
1751 if (!
ELEM(id_sorting_hint,
nullptr,
id) && id_sorting_hint->
lib == id->lib) {
1754 ID *id_sorting_hint_next =
static_cast<ID *
>(id_sorting_hint->
next);
1756 (id_sorting_hint_next ==
nullptr || id_sorting_hint_next->
lib !=
id->lib ||
1763 ID *id_sorting_hint_prev =
static_cast<ID *
>(id_sorting_hint->
prev);
1765 (id_sorting_hint_prev ==
nullptr || id_sorting_hint_prev->
lib !=
id->lib ||
1774 int item_array_index;
1781 bool is_in_library =
false;
1783 for (idtest =
static_cast<ID *
>(lb->
last); idtest !=
nullptr;
1784 idtest =
static_cast<ID *
>(idtest->
prev))
1786 if (is_in_library) {
1787 if (idtest->
lib != id->lib) {
1793 else if (idtest->
lib == id->lib) {
1795 is_in_library =
true;
1798 if (!is_in_library) {
1802 item_array[item_array_index] = idtest;
1803 if (item_array_index == 0) {
1819 for (item_array_index++; item_array_index <
ID_SORT_STEP_SIZE; item_array_index++) {
1820 idtest =
static_cast<ID *
>(item_array[item_array_index]);
1827 if (idtest ==
nullptr) {
1847#undef ID_SORT_STEP_SIZE
1853 const char *newname,
1855 const bool do_linked_data)
1867 if (newname ==
nullptr) {
1873 if (name[0] ==
'\0') {
1892 if (had_name_collision &&
1897 int prev_number = 0;
1919 if (is_idname_changed) {
1920 BLI_strncpy(
id.name + 2, orig_name,
sizeof(
id.name) - 2);
1935 if (is_idname_changed) {
1936 BLI_strncpy(
id.name + 2, name,
sizeof(
id.name) - 2);
1940 else if (had_name_collision) {
1960 const int cb_flag = cb_data->
cb_flag;
1963 if (*id_pointer ==
nullptr) {
2026 from_id_entry = from_id_entry->next)
2034 ID *from_id = from_id_entry->id_pointer.from;
2040 from_id = ((
Key *)from_id)->from;
2067 id->tag &= ~ID_TAG_DOIT;
2077 GHash *old_to_new_ids,
2078 const bool untagged_only,
2079 const bool set_fake,
2080 const bool clear_asset_data)
2105 printf(
"Pre-compute current ID relations: Done.\n");
2111 ID *
id =
static_cast<ID *
>(lbarray[a]->
first);
2117 for (; id;
id =
static_cast<ID *
>(
id->next)) {
2120 id->tag &= ~ID_TAG_DOIT;
2121 if (ntree !=
nullptr) {
2122 ntree->
tag &= ~ID_TAG_DOIT;
2127 id->flag &= ~ID_FLAG_INDIRECT_WEAK_LINK;
2129 ELEM(
lib,
nullptr, id->override_library->reference->lib) &&
2150 ELEM(
lib,
nullptr, id->lib) &&
2159 if (ntree !=
nullptr) {
2171 printf(
"Step 1: Detect data-blocks to make local: Done.\n");
2181 static_cast<ID *
>(it->link), loop_tags, bmain->
relations, done_ids);
2191 printf(
"Step 2: Check which data-blocks we can directly make local: Done.\n");
2200 for (
LinkNode *it = todo_ids, *it_next; it; it = it_next) {
2202 ID *
id =
static_cast<ID *
>(it->link);
2211 id->tag &= ~ID_TAG_DOIT;
2222 if (
GS(id->newid->name) ==
ID_OB) {
2240 printf(
"Step 3: Make IDs local: Done.\n");
2258 ID *
id =
static_cast<ID *
>(it->link);
2264 if (old_to_new_ids) {
2281 printf(
"Step 4: Remap local usages of old (linked) ID to new (local) ID: Done.\n");
2293 ob =
static_cast<Object *
>(ob->id.next))
2295 if (ob->data !=
nullptr && ob->type ==
OB_ARMATURE && ob->pose !=
nullptr &&
2303 printf(
"Hack: Forcefully rebuild armature object poses: Done.\n");
2311 printf(
"Cleanup and finish: Done.\n");
2329 if (!
ELEM(result.action,
2345 if (!
ELEM(result.action,
2349 switch (
GS(
id.name)) {
2370 const size_t idname_len = strlen(
BKE_id_name(*
id));
2371 const size_t libname_len = strlen(
BKE_id_name(id->lib->id));
2373 name[idname_len] = separator_char ? separator_char :
' ';
2374 name[idname_len + 1] =
'[';
2377 name[idname_len + 2 + libname_len] =
']';
2378 name[idname_len + 2 + libname_len + 1] =
'\0';
2384 const bool add_lib_hint,
2385 char separator_char,
2393 name[i++] = (
id->flag &
ID_FLAG_FAKEUSER) ?
'F' : ((
id->us == 0) ?
'0' :
' ');
2412 const char ascii_len = strlen(
BKE_id_name(id->lib->id)) + 32;
2413 return BLI_sprintfN(
"%c%s%s", ascii_len, id->lib->id.name, id->name);
2449 if (owner_id_pointer !=
nullptr) {
2450 return *owner_id_pointer;
2464 if (id_from.
lib && !id_to.
lib) {
2480 switch (
GS(id->name)) {
2493 if (order_a && order_b) {
2494 if (*order_a < *order_b) {
2497 if (*order_a > *order_b) {
2502 return strcmp(a->name,
b->name) < 0;
2540 if (*order > relative_order) {
2545 *id_order = relative_order + 1;
2551 if (*order < relative_order) {
2556 *id_order = relative_order - 1;
2562 if (id->asset_data) {
2566 if (id->library_weak_reference !=
nullptr) {
2571 if (id->properties && !
ELEM(
GS(id->name),
ID_WM)) {
2577 if (id->override_library) {
2586 if (opop->subitem_reference_name) {
2589 if (opop->subitem_local_name) {
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_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)
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
const char * BKE_id_name(const ID &id)
@ 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
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)
@ IDWALK_CB_EMBEDDED_NOT_OWNING
void BKE_library_foreach_ID_link(Main *bmain, ID *id, blender::FunctionRef< LibraryIDLinkCallback > callback, void *user_data, int flag)
@ IDWALK_IGNORE_MISSING_OWNER_ID
@ ID_REMAP_SKIP_INDIRECT_USAGE
void BKE_libblock_relink_multiple(Main *bmain, const blender::Span< ID * > ids, eIDRemapType remap_type, blender::bke::id::IDRemapper &id_remapper, int remap_flags)
void void BKE_libblock_remap(Main *bmain, void *old_idv, void *new_idv, int remap_flags) ATTR_NONNULL(1
#define FOREACH_MAIN_ID_END
ListBase * which_libbase(Main *bmain, short type)
void BKE_main_lock(Main *bmain)
int set_listbasepointers(Main *bmain, ListBase *lb[])
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)
bool BKE_main_namemap_get_name(Main *bmain, ID *id, char *name, const bool do_unique_in_bmain) ATTR_NONNULL()
void BKE_main_namemap_remove_name(Main *bmain, ID *id, const char *name) ATTR_NONNULL()
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
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void * BLI_listbase_findafter_string_ptr(struct Link *link, const char *id, const int offset)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
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
#define STRNCPY(dst, src)
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
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 length) ATTR_NONNULL(1)
#define STRNCPY_UTF8(dst, src)
size_t BLI_string_split_name_number(const char *name, char delim, char *r_name_left, int *r_number) ATTR_NONNULL(1
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_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
bool DEG_is_evaluated_id(const ID *id)
ID * DEG_get_original_id(ID *id)
ID and Library types, which are fundamental for SDNA.
#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)
@ ID_FLAG_INDIRECT_WEAK_LINK
@ ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE
@ ID_TAG_NO_USER_REFCOUNT
#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.
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)
void append(const T &value)
IndexRange index_range() const
void add(ID *old_id, ID *new_id)
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void BKE_id_newptr_and_tag_clear(ID *id)
ID * BKE_id_owner_get(ID *id, const bool debug_relationship_assert)
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
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)
void * BKE_libblock_alloc_notest(short type)
static void lib_id_library_local_paths(Main *bmain, Library *lib_to, Library *lib_from, ID *id)
void BKE_libblock_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, const ID *new_owner_id, ID **new_id_p, const int orig_flag)
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)
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)
ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, const ID *new_owner_id, ID **new_id_p, const int flag)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, const int flag)
IDTypeInfo IDType_ID_LINK_PLACEHOLDER
IDNewNameResult BKE_id_new_name_validate(Main &bmain, ListBase &lb, ID &id, const char *newname, IDNewNameMode mode, const bool do_linked_data)
static void id_embedded_swap(ID **embedded_id_a, ID **embedded_id_b, const bool do_full_id, IDRemapper *remapper_id_a, IDRemapper *remapper_id_b)
static int lib_id_clear_library_data_users_update_cb(LibraryIDLinkCallbackData *cb_data)
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_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
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
@ 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
struct LibraryWeakReference * library_weak_reference
struct UniqueName_Map * name_map
struct Library_Runtime runtime
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