31#include <fmt/format.h>
36#define DNA_DEPRECATED_ALLOW
130#define U (*((const UserDef *)&U))
189#define USE_BHEAD_READ_ON_DEMAND
194#if ENDIAN_ORDER == B_ENDIAN
195# warning "Support for Big Endian endianness is deprecated and will be removed in Blender 5.0"
203 const char *blockname,
204 const int id_type_index,
205 int64_t *r_alloc_len =
nullptr);
208 const char *blockname,
209 const int id_type_index,
215#ifdef USE_BHEAD_READ_ON_DEMAND
225#define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -int(offsetof(BHeadN, bhead))))
231#define BHEAD_USE_READ_ON_DEMAND(bhead) ((bhead)->code == BLO_CODE_DATA)
242 char fixed_buf[1024];
246 va_start(args, format);
247 vsnprintf(fixed_buf,
sizeof(fixed_buf), format, args);
250 fixed_buf[
sizeof(fixed_buf) - 1] =
'\0';
254 if (
G.background == 0) {
292 return MEM_new<OldNewMap>(__func__);
300 OldNewMap *onm,
const void *oldaddr,
void *newaddr,
const int nr,
const int64_t alloc_len = 0)
302 if (oldaddr ==
nullptr || newaddr ==
nullptr) {
306 return onm->
map.add_overwrite(oldaddr,
NewAddress{newaddr, alloc_len, nr});
324 const bool increase_users,
325 int64_t *r_alloc_len =
nullptr)
328 if (entry ==
nullptr) {
331 if (increase_users) {
343 if (addr ==
nullptr) {
361 if (new_addr.nr == 0) {
387 int a = fromarray.size();
404 if (bmain->
id_map !=
nullptr) {
413 if (tojoin == bmain) {
429 const bool do_split_packed_ids)
431 for (
ID *
id = lb_src->first(), *idnext;
id;
id = idnext) {
432 idnext =
static_cast<ID *
>(
id->next);
435 if (
uint(
id->lib->runtime->temp_index) < lib_main_array.
size()) {
436 Main *mainvar = lib_main_array[
id->lib->runtime->temp_index];
452 bmain->
split_mains = std::make_shared<VectorSet<Main *>>();
459 if (bmain->
id_map !=
nullptr) {
474 lib =
static_cast<Library *
>(lib->id.next), i++)
486 libmain->
colorspace = lib->runtime->colorspace;
489 lib->runtime->temp_index = lib_index;
490 lib_main_array.
append(libmain);
497 ID *
id = lbarray[i]->first();
498 if (
id ==
nullptr ||
id->id_type() ==
ID_LI) {
502 split_libdata(lbarray[i], lib_main_array, do_split_packed_ids);
537 main->curlib->runtime->versionfile =
main->versionfile;
538 main->curlib->runtime->subversionfile =
main->subversionfile;
541 main->curlib->runtime->colorspace =
main->colorspace;
549 return bhead->
code <= 0xFFFF;
558 const short id_type_code = bhead->
code & 0xFFFF;
565 bool is_link =
false;
570 if (code_prev != bhead->code) {
571 code_prev = bhead->code;
600 "A critical error happened (the blend file is likely corrupted): %s",
612 BHeadN *new_bhead =
nullptr;
618 BHead *bhead =
nullptr;
619 if (!bhead_opt.has_value()) {
622 else if (bhead_opt->len < 0) {
627 bhead = &bhead_opt.value();
636#ifdef USE_BHEAD_READ_ON_DEMAND
641 new_bhead->
next = new_bhead->
prev =
nullptr;
645 new_bhead->
bhead = *bhead;
646 const off64_t seek_new = fd->
file->
seek(fd->
file, bhead->
len, SEEK_CUR);
647 if (seek_new == -1) [[unlikely]] {
649 MEM_delete(new_bhead);
662 new_bhead =
static_cast<BHeadN *
>(
665 new_bhead->
next = new_bhead->
prev =
nullptr;
666#ifdef USE_BHEAD_READ_ON_DEMAND
671 new_bhead->
bhead = *bhead;
675 if (readsize != bhead->
len) [[unlikely]] {
677 MEM_delete(new_bhead);
707 BHead *bhead =
nullptr;
713 if (new_bhead ==
nullptr) {
718 bhead = &new_bhead->
bhead;
729 return (prev) ? &prev->bhead :
nullptr;
734 BHeadN *new_bhead =
nullptr;
735 BHead *bhead =
nullptr;
743 new_bhead = new_bhead->
next;
744 if (new_bhead ==
nullptr) {
752 bhead = &new_bhead->
bhead;
758#ifdef USE_BHEAD_READ_ON_DEMAND
781 if (fd->
file->
seek(fd->
file, offset_backup, SEEK_SET) == -1) {
797 MEM_delete(new_bhead_data);
800 return &new_bhead_data->
bhead;
813 return reinterpret_cast<const T *
>(
POINTER_OFFSET(bhead,
sizeof(*bhead) + offset));
820 if (
str ==
nullptr) [[unlikely]] {
824 const size_t size = std::min(maxsize,
size_t(bhead->
len - offset));
825 return std::memchr(
str,
'\0', size) ?
str :
nullptr;
834 if (id_name && id_name[0] !=
'\0' && id_name[1] !=
'\0') {
847 return flag ? *flag : 0;
855 return asset_data ? *asset_data :
nullptr;
884 if (std::holds_alternative<BlenderHeaderInvalid>(header_variant)) {
887 if (std::holds_alternative<BlenderHeaderUnknown>(header_variant)) {
891 const BlenderHeader &header = std::get<BlenderHeader>(header_variant);
931 subversion = atoi(
num);
935 const bool do_alias =
false;
947 fd->
filesdna.get(),
"ID",
"char",
"name[]");
950 fd->
filesdna.get(),
"ID",
"AssetMetaData",
"*asset_data");
952 fd->
filesdna.get(),
"ID",
"short",
"flag");
954 fd->
filesdna.get(),
"ID",
"IDHash",
"deep_hash");
957 fd->
filesdna.get(),
"Library",
"char",
"filepath[]");
959 fd->
filesdna.get(),
"Library",
"ushort",
"flag");
973 *r_error_message =
"Missing DNA block";
980 int *blend_thumb =
nullptr;
985 int *
data =
reinterpret_cast<int *
>(bhead + 1);
987 if (bhead->
len <
sizeof(
int[2])) {
991 const int width =
data[0];
992 const int height =
data[1];
1025 ListBaseT<ID> *lb_iter;
1033 for (
ID &id_iter : lb_iter->items_mutable()) {
1034 if (processed_ids.
contains(&id_iter)) {
1037 processed_ids.
add_new(&id_iter);
1042 if (!used_names.
contains(id_iter.name)) {
1043 used_names.
add_new(id_iter.name);
1050 used_names.
add_new(id_iter.name);
1051 CLOG_DEBUG(&
LOG,
"ID name has been de-duplicated to '%s'", id_iter.name);
1076 switch (id_iter->id_type()) {
1078 bool has_truncated_slot_identifier =
false;
1083 "Truncated too long action slot name to '%s'",
1085 has_truncated_slot_identifier =
true;
1088 if (!has_truncated_slot_identifier) {
1116 auto visit_constraint = [](
const bConstraint &constraint) ->
bool {
1123 "Truncated too long bActionConstraint.last_slot_identifier to '%s'",
1131 visit_constraint(con);
1136 visit_constraint(con);
1147 "Truncated too long AnimData.last_slot_identifier to '%s'",
1152 "Truncated too long AnimData.tmp_last_slot_identifier to '%s'",
1159 "Truncated too long NlaStrip.last_slot_identifier to '%s'",
1182 FileData *fd = MEM_new<FileData>(__func__);
1214 if (fg ==
nullptr) [[unlikely]] {
1221 char writer_ver_str[16];
1222 char min_reader_ver_str[16];
1231 writer_ver_str,
sizeof(writer_ver_str),
short(fd->
fileversion), -1);
1233 min_reader_ver_str,
sizeof(min_reader_ver_str), fg->
minversion, -1);
1237 "The file was saved by a newer version, open it with Blender %s or later",
1238 min_reader_ver_str);
1240 "%s: File saved by a newer version of Blender (%s), Blender %s or later is "
1241 "needed to open it.",
1244 min_reader_ver_str);
1262 "Blend file '%s' created by a Big Endian version of Blender, support for "
1263 "these files has been removed in Blender 5.0, use an older version of Blender "
1264 "to open and convert it.",
1270 const char *error_message =
nullptr;
1273 reports,
RPT_ERROR,
"Failed to read blend file '%s': %s", fd->
relabase, error_message);
1286 "Cannot read blend file '%s', incomplete header, may be from a newer version of Blender",
1305 if (file ==
nullptr) {
1314 if (
BLI_stat(filepath, &stat) != -1) {
1328 "Unable to open '%s': %s",
1330 errno ? strerror(errno) :
RPT_(
"unknown error reading file"));
1339 if (fd !=
nullptr) {
1356 if (fd !=
nullptr) {
1412# ifdef USE_BHEAD_READ_ON_DEMAND
1417 MEM_delete(&new_bhead);
1465 const int width = fd_data[0];
1466 const int height = fd_data[1];
1473 data->width = width;
1474 data->height = height;
1475 memcpy(
data->rect, &fd_data[2], data_size -
sizeof(*
data));
1536 const bool is_linked_only,
1539 return newlibadr(fd, self_id, is_linked_only, adr);
1551 entry.nr = ((
ID *)newp)->id_type();
1564 if (old == entry.newp) {
1568 entry.nr = ((
ID *)newp)->id_type();
1624 ID *
id,
const IDCacheKey *key,
void **cache_p,
uint ,
void *cache_storage_v)
1626 if (*cache_p ==
nullptr) {
1638 *storage_key = *key;
1641 storage_value->
cache_v = *cache_p;
1648 ID *
id,
const IDCacheKey *key,
void **cache_p,
const uint flags,
void *cache_storage_v)
1652 if (cache_storage ==
nullptr) {
1673 if (storage_value ==
nullptr) {
1678 *cache_p = storage_value->
cache_v;
1686 void *cache_storage_v)
1692 if (storage_value ==
nullptr) {
1717 ID *
id = lb->first();
1718 if (
id ==
nullptr) {
1747 ID *
id = lb->first();
1748 if (
id ==
nullptr) {
1793 const char *blockname,
1800 using keyT =
const std::pair<const std::string, const int>;
1805 constexpr std::string_view STORAGE_ID =
"readfile";
1811 std::string(STORAGE_ID));
1816 const bool is_id_data = !blockname && (id_type_index >= 0 && id_type_index <
INDEX_ID_MAX);
1820 static const std::array<std::string, INDEX_ID_MAX> id_alloc_names = [] {
1821 auto n =
decltype(id_alloc_names)();
1822 for (
int idtype_index = 0; idtype_index <
INDEX_ID_MAX; idtype_index++) {
1828 n[size_t(idtype_index)] =
"UNKNWOWN";
1831 n[size_t(idtype_index)] = idtype_info->
name;
1837 const std::string block_alloc_name = is_id_data ? id_alloc_names[id_type_index] : blockname;
1839 keyT key{block_alloc_name + struct_name, bh->
nr};
1841 const std::string alloc_string = fmt::format(
1842 fmt::runtime(is_id_data ?
"{}{} (for ID type '{}')" :
"{}{} (for block '{}')"),
1844 bh->
nr > 1 ? fmt::format(
"[{}]", bh->
nr) :
"",
1846 return storage.insert(key, alloc_string);
1853 if (!
storage.contains(id_type_index)) [[unlikely]] {
1855 return storage.insert(id_type_index,
"Data from UNKNOWN");
1858 const std::string alloc_string = fmt::format(
"Data from '{}' ID type", id_type->
name);
1859 return storage.insert(id_type_index, alloc_string);
1861 return storage.find(id_type_index);
1870 void *temp =
nullptr;
1873#ifdef USE_BHEAD_READ_ON_DEMAND
1874 BHead *bh_orig = bh;
1894#ifdef USE_BHEAD_READ_ON_DEMAND
1897 if (bh ==
nullptr) [[unlikely]] {
1913 (old_struct_size != 0 && bh->
nr > bh->
len / old_struct_size)) [[unlikely]]
1919#ifdef USE_BHEAD_READ_ON_DEMAND
1920 if (bh_orig != bh) {
1929 const char *alloc_name =
get_alloc_name(fd, bh, blockname, id_type_index);
1931#ifdef USE_BHEAD_READ_ON_DEMAND
1934 if (bh ==
nullptr) [[unlikely]] {
1947#ifdef USE_BHEAD_READ_ON_DEMAND
1949 memcpy(temp, (bh + 1), bh->
len);
1961 memcpy(temp, (bh + 1), bh->
len);
1963 if (r_alloc_len && temp) {
1964 *r_alloc_len = bh->
len;
1969#ifdef USE_BHEAD_READ_ON_DEMAND
1970 if (bh_orig != bh) {
1982 const char *blockname,
1983 const int id_type_index,
1987 void *
data =
read_struct(fd, bh, blockname, id_type_index, &alloc_len);
1988 if (
data ==
nullptr || alloc_len >= min_size) {
2003 ID *
id =
static_cast<ID *
>(
read_struct(fd, bh, blockname, id_type_index, &alloc_len));
2012 min_size = id_type->struct_size;
2015 if (alloc_len < min_size) [[unlikely]] {
2043 return (bhead->
len) ?
static_cast<const void *
>(bhead + 1) :
nullptr;
2067 ln->
next =
static_cast<Link *
>(poin);
2088 if (nodetree !=
nullptr) {
2091 if (nodetree->
owner_id ==
nullptr) {
2093 "NULL owner_id pointer for embedded NodeTree of %s, should never happen",
2097 else if (nodetree->
owner_id !=
id) {
2099 "Inconsistent owner_id pointer for embedded NodeTree of %s, should never happen",
2106 Scene *scene = id_cast<Scene *>(
id);
2112 "NULL owner_id pointer for embedded Scene Collection of %s, should never happen",
2118 "Inconsistent owner_id pointer for embedded Scene Collection of %s, should "
2160 Library *current_library,
2164 ID_Readfile_Data::Tags id_read_tags);
2173 Scene *scene = id_cast<Scene *>(
id);
2182 if (nodetree !=
nullptr && *nodetree !=
nullptr) {
2188 RPT_(
"Data-block '%s' had an invalid embedded node group, which has not been read"),
2190 MEM_SAFE_DELETE(*nodetree);
2195 id_cast<ID *>(*nodetree),
2205 Scene *scene = id_cast<Scene *>(
id);
2214 RPT_(
"Scene '%s' had an invalid root collection, which has not been read"),
2223 id_old !=
nullptr ? &(id_cast<Scene *>(id_old))->master_collection->id :
nullptr,
2236 if (id_current->id_type() ==
ID_OB && (id_cast<Object *>(
const_cast<ID *
>(id_current)))->pose) {
2244 const ID *id_target,
2245 const ID *id_current,
2246 const bool is_identical)
2251 int recalc = id_target->
recalc;
2253 if (id_current ==
nullptr) {
2262 if (!is_identical) {
2271 recalc |= id_current->
recalc;
2291 if (
id.runtime->readfile_data) {
2301 if (!
id.runtime || !
id.runtime->readfile_data) {
2304 return id.runtime->readfile_data->tags;
2310 return id.runtime->readfile_data->tags;
2315 MEM_SAFE_DELETE(
id.runtime->readfile_data);
2351 "Unknown or invalid ID type, this should never happen");
2362 id->lib = current_library;
2369 id->newid =
nullptr;
2370 id->orig_id =
nullptr;
2371 id->py_instance =
nullptr;
2384 "Data-block '%s' flagged as packed, but without a valid library, fixing by "
2385 "making fully local...",
2392 "Data-block '%s' flagged as packed, but using a regular library, fixing by "
2393 "making fully indirectly linked...",
2404 id->runtime->readfile_data->tags = id_read_tags;
2411 id->library_weak_reference =
nullptr;
2426 if (
id->asset_data) {
2434 if (
id->properties) {
2440 if (
id->system_properties) {
2457 id->recalc_after_undo_push = 0;
2461 id->recalc_after_undo_push = 0;
2465 if (
id->override_library) {
2468 if (
id->override_library !=
nullptr) {
2473 id->override_library->runtime =
nullptr;
2507#ifdef USE_SETSCENE_CHECK
2511static bool scene_validate_setscene__liblink(
Scene *sce,
const int totscene)
2516 if (sce->set ==
nullptr) {
2520 for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) {
2526 if (sce->id.lib != sce_iter->id.lib) {
2545#ifdef USE_SETSCENE_CHECK
2546 const int totscene = bmain->
scenes.count();
2550 if (!scene_validate_setscene__liblink(&sce, totscene)) {
2560#undef USE_SETSCENE_CHECK
2574 "Packed Archive libraries should never own their filedata");
2593 const BHead *bheadlib,
2596 const char *lib_filepath,
2598 const bool is_packed_library,
2599 const bool is_external_lib)
2626 if (is_external_lib) {
2630 if (is_packed_library) {
2654 if (is_packed_library) {
2718 RPT_(
"Library '%s', '%s' had multiple instances, save and reload!"),
2751 fd,
main,
"Corrupt .blend file, archive library without parent library");
2762 RPT_(
"Library '%s' ('%s') is an archive storage for packed data, but has "
2763 "no real library parent."),
2776 parent_lib = parent_lib_bmain->
curlib;
2812 lib->
id.
lib =
nullptr;
2820 if (basepath ==
nullptr || basepath[0] ==
'\0') {
2855 const bool was_liboverride)
2864 *(
reinterpret_cast<short *
>(ph_id->
name)) = idcode;
2871 if (was_liboverride) {
2882 if (mainvar->
id_map !=
nullptr) {
2933 bool success =
true;
2935 switch (
id->id_type()) {
2959 const char *allocname,
2960 const int id_type_index)
2966 void *
data =
read_struct(fd, bhead, allocname, id_type_index, &alloc_len);
2971 "Blendfile corruption: Invalid, or multiple `bhead` with same old address "
2972 "value (%p) for a given ID.",
3015 std::deque<ID *> no_undo_ids;
3018 int i = lbarray.size();
3024 ID *
id = lbarray[i]->first();
3030 if (old_bmain_iter->
curlib) {
3037 no_undo_ids.push_back(id_iter);
3044 while (!no_undo_ids.empty()) {
3045 ID *id_iter = no_undo_ids.front();
3046 no_undo_ids.pop_front();
3067 no_undo_ids.push_back(
id);
3094 int i = lbarray.size();
3101 ID *
id = lbarray[i]->first();
3112 for (
ID &id_iter : *new_lb) {
3143 if (bhead !=
nullptr) {
3186 if (id_old ==
nullptr) {
3196 if (&libmain->curlib->id == id_old) {
3200 " compare with %s -> match (existing libpath: %s)",
3201 libmain->curlib->id.name,
3202 libmain->curlib->runtime->filepath_abs);
3231 for (
Main *lib_bmain : old_bmain_split_mains) {
3268 for (
Main *lib_bmain : new_bmain->
split_mains->as_span().drop_front(1)) {
3275 for (
ID *unused_id : lib_bmain->curlib->
runtime->unused_ids_on_undo) {
3284 const short idcode = unused_id->id_type();
3288 unused_id->
lib =
nullptr;
3294 lib_bmain->curlib->runtime->unused_ids_on_undo.clear();
3310 if (*r_id_old ==
nullptr) {
3315 if (*r_id_old ==
nullptr) {
3317 " from %s (%s): NOT found",
3324 " from %s (%s): found by name",
3334 " from %s (%s): found by session_uid",
3371 id_old->
newid =
nullptr;
3374 const short idcode = id_old->id_type();
3392 if (id_old->id_type() ==
ID_OB) {
3393 Object *ob = id_cast<Object *>(id_old);
3398 if (id_old->id_type() ==
ID_LI) {
3438 const short idcode =
id->id_type();
3481 if (id_old->id_type() ==
ID_LI) {
3482 Library *lib_old = id_cast<Library *>(id_old);
3483 Library *lib = id_cast<Library *>(
id);
3487 if (bmain_iter->
curlib == lib) {
3489 bmain_iter->
curlib = lib_old;
3539 &
LOG_UNDO,
"UNDO: skip restore datablock %s, 'NO_MEMFILE_UNDO' type of ID",
id->name);
3556 if (!do_partial_undo) {
3558 "UNDO: read %s (uid %u) -> no partial undo, always read at new address",
3568 "UNDO: read %s (uid %u) -> keep identical data-block",
3577 if (id_old !=
nullptr) {
3580 "UNDO: read %s (uid %u) -> read to old existing address",
3589 &
LOG_UNDO,
"UNDO: read %s (uid %u) -> read at new address",
id->name,
id->session_uid);
3605 const bool placeholder_set_indirect_extern,
3610 auto process_packed_id = [&fd, &
main](
ID &
id) ->
void {
3618 BLI_assert(
id.deep_hash == IDHash::get_null());
3621 BLI_assert(
id.deep_hash != IDHash::get_null());
3629 ID *id_old =
nullptr;
3635 if (id_old !=
nullptr) {
3636 if (
main->id_map !=
nullptr) {
3639 process_packed_id(*id_old);
3649 const char *blockname =
nullptr;
3653 const char *blockname =
get_alloc_name(fd, bhead,
nullptr, id_type_index);
3656 if (
id ==
nullptr) {
3664 const short idcode =
id->id_type();
3666 if (lb ==
nullptr) {
3668 CLOG_WARN(&
LOG,
"Unknown id code '%c%c'", (idcode & 0xff), (idcode >> 8));
3683 ID *id_target = (do_partial_undo && id_old !=
nullptr) ? id_old :
id;
3699 if (placeholder_set_indirect_extern) {
3710 if (
main->id_map !=
nullptr) {
3719 const void *id_address_old = bhead->
old;
3728 if (entry && entry->
newp ==
id) {
3743 if (r_id !=
nullptr) {
3748 if (do_partial_undo && id_old !=
nullptr) {
3755 if (
main->id_map !=
nullptr) {
3758 process_packed_id(*id_target);
3760 id->runtime->src_blend_modifification_time = fd->
file_stat->st_mtime;
3781 if (*r_asset_data) {
3808 if (fg ==
nullptr) [[unlikely]] {
3888 if (user ==
nullptr) {
3900 main->is_locked_for_linking =
true;
3922 char build_commit_datetime[32];
3923 time_t temp_time =
main->build_commit_timestamp;
3924 tm *tm = (temp_time) ? gmtime(&temp_time) :
nullptr;
3925 if (tm) [[likely]] {
3926 strftime(build_commit_datetime,
sizeof(build_commit_datetime),
"%Y-%m-%d %H:%M", tm);
3929 STRNCPY(build_commit_datetime,
"unknown");
3934 " Version %d sub %d date %s hash %s",
3936 main->subversionfile,
3937 build_commit_datetime,
3941 if (!
main->is_read_invalid) {
3944 if (!
main->is_read_invalid) {
3947 if (!
main->is_read_invalid) {
3950 if (!
main->is_read_invalid) {
3953 if (!
main->is_read_invalid) {
3956 if (!
main->is_read_invalid) {
3959 if (!
main->is_read_invalid) {
3962 if (!
main->is_read_invalid) {
3965 if (!
main->is_read_invalid) {
3968 if (!
main->is_read_invalid) {
3971 if (!
main->is_read_invalid) {
3974 if (!
main->is_read_invalid) {
3977 if (!
main->is_read_invalid) {
3980 if (!
main->is_read_invalid) {
3983 if (!
main->is_read_invalid) {
3986 if (!
main->is_read_invalid) {
3989 if (!
main->is_read_invalid) {
3998 main->is_locked_for_linking =
false;
4006 "Processing %s (%s), %d.%d",
4007 main->curlib ?
main->curlib->filepath :
main->filepath,
4008 main->curlib ?
"LIB" :
"MAIN",
4010 main->subversionfile);
4013 main->is_locked_for_linking =
true;
4015 if (!
main->is_read_invalid) {
4018 if (!
main->is_read_invalid) {
4021 if (!
main->is_read_invalid) {
4024 if (!
main->is_read_invalid) {
4027 if (!
main->is_read_invalid) {
4030 if (!
main->is_read_invalid) {
4033 if (!
main->is_read_invalid) {
4036 if (!
main->is_read_invalid) {
4039 if (!
main->is_read_invalid) {
4042 if (!
main->is_read_invalid) {
4045 if (!
main->is_read_invalid) {
4048 if (!
main->is_read_invalid) {
4051 if (!
main->is_read_invalid) {
4054 if (!
main->is_read_invalid) {
4057 if (!
main->is_read_invalid) {
4060 if (!
main->is_read_invalid) {
4064 main->is_locked_for_linking =
false;
4154 id->orig_id =
nullptr;
4180 reports ? reports->
reports :
nullptr,
4182 "Critical blend-file corruption: Conflicts and/or otherwise invalid data-blocks names "
4183 "(see console for details)");
4241 if (user ==
nullptr) [[unlikely]] {
4269 keymap.
poll =
nullptr;
4300 return user_menu_item_struct_size(umi.type);
4360 if (*id_pointer !=
nullptr) {
4427 bfd = MEM_new<BlendFileData>(__func__);
4463 const int width =
data[0];
4464 const int height =
data[1];
4490 Main *bmain_to_read_into =
nullptr;
4491 bool placeholder_set_indirect_extern =
false;
4492 bool is_linked_packed_id =
false;
4494 switch (bhead->
code) {
4527 placeholder_set_indirect_extern =
true;
4531 if (bmain_to_read_into->
curlib ==
nullptr) [[unlikely]] {
4533 bmain_to_read_into =
nullptr;
4540 fd, bfd->
main,
"Corrupt .blend file, link placeholder in archive library");
4541 bmain_to_read_into =
nullptr;
4552 bmain_to_read_into = fd->
bmain;
4580 "Local IDs should always be put in the first Main split data-base, not in "
4581 "a 'linked data' one");
4584 if (bmain_to_read_into) {
4587 fd, bmain_to_read_into, bhead, id_tag, {}, placeholder_set_indirect_extern,
nullptr);
4618 "Blendfile '%s' was created by a future version of Blender and contains ID "
4619 "names longer than currently supported. These have been truncated.",
4625 "Blendfile '%s' appears corrupted, it contains invalid ID names. These have "
4657 const bool contains_link_placeholder = (bmain->
curlib !=
nullptr &&
4662 for (ListBaseT<ID> *lb_array : lbarray) {
4663 for (
ID &
id : lb_array->items_mutable()) {
4665 (
id.runtime->readfile_data->tags.is_link_placeholder == contains_link_placeholder),
4666 contains_link_placeholder ?
4667 "Real Library split Main contains non-placeholder IDs" :
4668 (bmain->
curlib ==
nullptr ?
4669 "Local data split Main contains placeholder IDs" :
4670 "Archive Library split Main contains placeholder IDs"));
4674 if (contains_link_placeholder) {
4787 {.extra_remapping_flags = (ID_REMAP_FORCE_UI_POINTERS | ID_REMAP_SKIP_USER_REFCOUNT |
4788 ID_REMAP_SKIP_UPDATE_TAGGING | ID_REMAP_SKIP_USER_CLEAR)});
4815 std::string cur_view_layer_name = bfd->
cur_view_layer !=
nullptr ?
4886 if (x1->
old > x2->old) {
4889 if (x1->
old < x2->old) {
4939 if (
id &&
id->id_type() !=
ID_LI) [[unlikely]] {
4944 fd, fd->
bmain,
"Corrupt .blend file, unexpected non-library block type");
4987 if (bhead->
old == old) {
4999 *(
reinterpret_cast<short *
>(idname_full)) = idcode;
5000 BLI_strncpy(idname_full + 2, name,
sizeof(idname_full) - 2);
5008 if (bhead) [[likely]] {
5024 if (
ID *existing_id = fd->
id_by_deep_hash->lookup_default(*deep_hash,
nullptr)) {
5033 if (mainvar->
id_map ==
nullptr) {
5060 const bool has_forward_compatibility_issues,
5061 const char *filepath)
5066 if (has_forward_compatibility_issues) {
5069 "Library '%s' was created by a future version of Blender and contains ID names "
5070 "longer than currently supported. This may cause missing linked data, consider "
5071 "opening and re-saving that library with the current Blender version.",
5077 "Library '%s' appears corrupted, it contains invalid ID names. This may cause "
5078 "missing linked data.",
5090 std::queue<ID *> &ids_to_expand,
5114 const BHead *bheadlib,
5115 const char *lib_filepath,
5116 const char *relabase,
5117 const BHead *id_bhead,
5118 const char *id_name,
5119 const bool is_packed_id,
5120 const bool is_external_lib)
5122 Library *parent_lib =
nullptr;
5125 STRNCPY(filepath_abs, lib_filepath);
5141 "Found library '%s' for file path '%s'",
5144 if (!is_packed_id) {
5150 parent_lib = main_it->
curlib;
5214 "Found archive library '%s' for the packed ID '%s'",
5224 fd, bheadlib,
nullptr,
nullptr, lib_filepath, filepath_abs,
false, is_external_lib);
5225 parent_lib = reference_bmain->
curlib;
5227 "Added new parent library '%s' for file path '%s'",
5247 "Added new archive library '%s' for the packed ID '%s'",
5253 &
LOG,
"Added new library '%s' for file path '%s'", bmain->
curlib->
id.
name, lib_filepath);
5267 std::queue<ID *> &ids_to_expand,
5274 ID *
id = existing_id;
5276 if (
id ==
nullptr) {
5280 if (
id ==
nullptr) {
5289 if (
id ==
nullptr) {
5305 ids_to_expand.push(
id);
5334 printf(
"expand_doit: already linked: %s lib: %s\n",
id->name, lib->
filepath);
5341 std::queue<ID *> &ids_to_expand,
5352 if (bhead ==
nullptr) {
5371 "A link placeholder ID (aka reference to some ID linked from another library) "
5372 "should never be packed.");
5416 fd, bhead, lib->
filepath, fd->
relabase,
nullptr,
nullptr,
false, is_external_lib);
5419 if (libmain->
curlib ==
nullptr) {
5422 RPT_(
"LIB: Data refers to main .blend file: '%s' from %s"),
5423 id_name ? id_name :
"<InvalidIDName>",
5432 if (bheadlib ==
nullptr) {
5435 RPT_(
"LIB: .blend file %s seems corrupted, no owner 'Library' data found "
5436 "for the linked data-block '%s'. Try saving the file again."),
5438 id_name ? id_name :
"<InvalidIDName>");
5443 if (lib ==
nullptr) {
5447 if (is_external_lib) {
5449 "External libraries are not supported for link/append. ID '%s' belongs to "
5450 "external archive '%s'",
5451 id_name ? id_name :
"<InvalidIDName>",
5458 fd, bheadlib, lib->
filepath, fd->
relabase,
nullptr,
nullptr,
false, is_external_lib);
5461 if (libmain->
curlib ==
nullptr) {
5464 RPT_(
"LIB: Data refers to main .blend file: '%s' from %s"),
5465 id_name ? id_name :
"<InvalidIDName>",
5474 else if (is_packed_id) {
5481 read_id_in_lib(fd, ids_to_expand,
nullptr,
nullptr, bhead, existing_id, {});
5486 if (bheadlib ==
nullptr) {
5489 RPT_(
"LIB: .blend file %s seems corrupted, no owner 'Library' data found "
5490 "for the packed linked data-block %s. Try saving the file again."),
5492 id_name ? id_name :
"<InvalidIDName>");
5497 if (lib ==
nullptr) {
5501 if (is_external_lib) {
5503 "External libraries are not supported for link/append. ID '%s' belongs to "
5504 "external archive '%s'",
5505 id_name ? id_name :
"<InvalidIDName>",
5512 fd, bheadlib, lib->
filepath, fd->
relabase, bhead, id_name, is_packed_id, is_external_lib);
5515 if (libmain->
curlib ==
nullptr) {
5518 RPT_(
"LIB: Data refers to main .blend file: '%s' from %s"),
5519 id_name ? id_name :
"<InvalidIDName>",
5526 read_id_in_lib(fd, ids_to_expand, libmain,
nullptr, bhead,
nullptr, id_read_tags);
5532 read_id_in_lib(fd, ids_to_expand, mainvar,
nullptr, bhead,
nullptr, id_read_tags);
5628 Main *mainl,
FileData *fd,
const short idcode,
const char *name,
const int flag)
5640 if (
id ==
nullptr) {
5646 read_libblock(fd, mainl, bhead, id_tag, id_read_tags,
false, &
id);
5665 else if (use_placeholders) {
5687 ID *ret_id =
nullptr;
5702 const char *filepath,
5714 fd->
bmain = mainvar;
5750 const int id_tag_extra)
5752 memset(params, 0,
sizeof(*params));
5753 params->
bmain = bmain;
5754 params->
flag = flag;
5761 const int id_tag_extra,
5768 if (scene !=
nullptr) {
5769 params->
context.scene = scene;
5770 params->
context.view_layer = view_layer;
5776 const char *filepath,
5794 int i = lbarray.size();
5798 for (
ID &
id : lbarray[i]->items_mutable()) {
5809 Main *mainvar = (*fd)->bmain;
5812 if (mainl->
id_map ==
nullptr) {
5879 if (mainlib->is_read_invalid) {
5954 *bh =
reinterpret_cast<BlendHandle *
>(fd);
5971 int a = lbarray.size();
5973 for (
ID &
id : *lbarray[a]) {
5988 BHead *bhead =
nullptr;
6004 RPT_(
"LIB: %s: '%s' is directly linked from '%s' (parent '%s'), but is a "
6005 "non-linkable data type"),
6023 "LIB: %s: '%s' missing from '%s', parent '%s'",
6036 id->override_library !=
nullptr) :
6047 int a = lbarray.size();
6049 ID *
id = lbarray[a]->first();
6052 ID *id_next =
static_cast<ID *
>(
id->next);
6057 if (mainvar->
id_map !=
nullptr) {
6085 id->runtime->readfile_data =
nullptr;
6128 int a = lbarray.size();
6130 ID *
id = lbarray[a]->first();
6133 ID *id_next =
static_cast<ID *
>(
id->next);
6156 if (fd !=
nullptr) {
6167 RPT_(
"Read packed library: '%s', parent '%s'"),
6179 RPT_(
"Read library: '%s', '%s', parent '%s'"),
6220 if (fd ==
nullptr) {
6223 RPT_(
"Cannot find lib '%s'"),
6240 for (
ID &
id : lb->items_mutable()) {
6246 if (libmain->id_map !=
nullptr) {
6280 for (
int i = 1; i < bmain->
split_mains->size(); i++) {
6295 "Reading linked data-blocks from %s (%s)",
6311 if (libmain->
id_map ==
nullptr) {
6338 if (libmain->is_read_invalid) [[unlikely]] {
6348 if (libmain->versionfile) {
6359 if (libmain->curlib->runtime->filedata) {
6360 do_versions(libmain->curlib->runtime->filedata, libmain->curlib, main_newid);
6365 if (libmain->is_read_invalid) [[unlikely]] {
6371 if (libmain->curlib->runtime->filedata) {
6372 lib_link_all(libmain->curlib->runtime->filedata, libmain);
6374 if (libmain->is_read_invalid) [[unlikely]] {
6394 const size_t expected_size)
6396 if (new_address !=
nullptr) {
6401 if (
size_t(alloc_len) < expected_size) {
6405 "Corrupt .blend file, unexpected data size.");
6425 const void *old_address,
6426 const size_t expected_size)
6429 if (entry ==
nullptr) {
6433 reader->
fd, entry->
newp, old_address, entry->
alloc_len, expected_size);
6441 const void *old_address,
6442 const size_t expected_size)
6450 const void *old_address,
6453 if (old_address !=
nullptr && new_address ==
nullptr) {
6456 "Corrupt .blend file, missing required data block.");
6462 const void *old_address,
6463 const size_t expected_size)
6470 const void *old_address,
6471 const size_t expected_size)
6480 const size_t elem_size,
6485 total_elems = array_size;
6490 if (total_elems < 0) {
6494 "Corrupt .blend file, array size integer overflow or invalid.");
6500 if (entry ==
nullptr) {
6502 return total_elems == 0;
6504 if (elem_size > 0) {
6506 if (total_elems > max_array_size) {
6510 "Corrupt .blend file, array size exceeds allocated size.");
6517 *ptr_p = entry->
newp;
6524 const void *old_address)
6535 const bool is_linked_only,
6538 return static_cast<ID *
>(
newlibadr(reader->
fd, self_id, is_linked_only,
id));
6552 const size_t expected_elem_size,
6561 Link *prev =
nullptr;
6577 const void *old_address,
6580 const size_t type_size = type_size_fn(entry.
newp);
6584 if (entry.
nr == 0) {
6592 const size_t base_size,
6597 const void *old_address =
list->first_;
6598 Link *prev =
nullptr;
6599 list->first_ =
nullptr;
6601 while (old_address) {
6603 if (entry ==
nullptr) {
6608 if (ln ==
nullptr) {
6613 const void *old_address_item = old_address;
6614 old_address = ln->
next;
6634 const void *old_address,
6635 const size_t base_size,
6640 if (entry ==
nullptr) {
6657 *ptr_p =
static_cast<char *
>(
newdataadr(reader->
fd, *ptr_p, &alloc_len));
6659 const char *
str = *ptr_p;
6663 if (
str[
len - 1] ==
'\0') {
6668 BLI_assert_msg(0,
"Corrupt .blend file, expected string to be null terminated.");
6692 for (
int i = 0; i < array_size; i++) {
6703 for (
int i = 0; i < array_size; i++) {
6712 if (array_size < 0) {
6716 "Corrupt .blend file, pointer array size integer overflow or invalid.");
6722 if (entry ==
nullptr) {
6725 return array_size == 0;
6728 const int file_pointer_size = fd->
filesdna->pointer_size;
6732 if (array_size > max_array_size) {
6735 "Corrupt .blend file, pointer array size exceeds allocated size.");
6741 void *orig_array = entry->
newp;
6742 void *final_array =
nullptr;
6746 if (file_pointer_size == current_pointer_size) {
6748 final_array = orig_array;
6750 else if (file_pointer_size == 8 && current_pointer_size == 4) {
6755 static_cast<uint64_t *
>(orig_array),
6756 static_cast<uint32_t *
>(final_array));
6759 else if (file_pointer_size == 4 && current_pointer_size == 8) {
6764 static_cast<uint32_t *
>(orig_array),
6765 static_cast<uint64_t *
>(final_array));
6772 *ptr_p = final_array;
6792 sharing_info_data->sharing_info->add_user();
6793 return *sharing_info_data;
6804 if (shared_data->sharing_info) {
6805 shared_data->sharing_info->add_user();
6807 return *shared_data;
6813 const void *new_address = *ptr_p;
6855 return reader->
main;
#define BLENDER_FILE_SUBVERSION
#define BLENDER_FILE_VERSION
#define IDP_BlendDataRead(reader, prop)
#define MAIN_ID_SESSION_UID_UNSET
#define FOREACH_MAIN_ID_END
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
#define FOREACH_MAIN_LISTBASE_ID_END
#define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id)
#define FOREACH_MAIN_LISTBASE_END
#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb)
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
#define MAIN_VERSION_FILE_OLDER_OR_EQUAL(main, ver, subver)
#define BLEN_THUMB_MEMSIZE(_x, _y)
#define BLEN_THUMB_MEMSIZE_IS_VALID(_x, _y)
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
File and directory operations.
#define BLI_MEMARENA_STD_BUFSIZE
#define BLI_SCOPED_DEFER(function_to_defer)
Platform independent time functions.
Compatibility-like things for windows.
Utilities ensuring .blend file (i.e. Main) is in valid state during write and/or read process.
#define BLO_read_raw_address(reader, ptr_p)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
external readfile function prototypes.
#define BLEN_THUMB_MEMSIZE_FILE(_x, _y)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_DEBUG(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO(clg_ref,...)
#define ID_IS_PACKED(_id)
#define ID_FAKE_USERS(id)
#define ID_IS_LINKED(_id)
#define ID_TAG_KEEP_ON_UNDO
#define ID_LINK_PLACEHOLDER
Object groups, one object can be in many groups at once.
blenloader genfile private function prototypes
#define SDNA_RAW_DATA_STRUCT_INDEX
Read Blender memory allocation and freeing.
bool MEM_size_safe_multiply(size_t a, size_t b, size_t *result)
#define BLI_assert_unreachable()
#define UNUSED_VARS_NDEBUG(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_OFFSET(v, ofs)
#define BLI_assert_msg(a, msg)
bool add_overwrite(const Key &key, const Value &value)
Value lookup_default(const Key &key, const Value &default_value) const
bool contains(const Key &key) const
void add_new(const Key &key)
bool remove(const Key &key)
void append(const T &value)
#define pf(_x, _i)
Prefetch 64.
#define storage(slot, qualifiers)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
bool foreach_strip_adt(const AnimData &adt, FunctionRef< bool(NlaStrip *)> callback)
void node_tree_blend_read_data(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree)
void node_tree_update_all_new(Main &main)
bNodeTree ** node_tree_ptr_from_id(ID *id)
bNodeTree * node_tree_from_id(ID *id)
uint32_t struct_size(Span< shader::ShaderCreateInfo::PushConst > push_constants)
ID_Readfile_Data::Tags & BLO_readfile_id_runtime_tags_for_write(ID &id)
const char * BKE_idtype_idcode_to_name(short idcode)
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void blo_readfile_invalidate(FileData *fd, Main *bmain, const char *message)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
struct DNA_ReconstructInfo * DNA_reconstruct_info_create(const struct SDNA *oldsdna, const struct SDNA *newsdna, const char *compare_flags)
void BKE_idtype_id_foreach_cache(ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)
std::array< ListBaseT< ID > *, INDEX_ID_MAX - 1 > MainListsArray
@ SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK
static FileData * blo_filedata_from_file_minimal(const char *filepath)
static int direct_link_id_restore_recalc_exceptions(const ID *id_current)
static void direct_link_library(FileData *fd, Library *lib, Main *main)
bool blo_read_array_impl(BlendDataReader *reader, int64_t array_size, int elems, size_t elem_size, void **ptr_p)
unsigned __int64 uint64_t
static int read_undo_remap_noundo_data_cb(LibraryIDLinkCallbackData *cb_data)
void BLO_read_glob_list(BlendDataReader *reader, ListBase *list)
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings)==CTX_MODE_NUM+1, "Must have a string for each context mode") const char *CTX_data_mode_string(const bContext *C)
static void expand_doit_library(void *fdhandle, std::queue< ID * > &ids_to_expand, Main *mainvar, void *old)
static const char * get_alloc_name(FileData *fd, BHead *bh, const char *blockname, const int id_type_index=INDEX_ID_NULL)
const IDTypeInfo * BKE_idtype_get_info_from_idcode(short id_code)
char * STRNCPY(char(&dst)[N], const char *src)
static BHeadN * get_bhead(FileData *fd)
void BLO_library_link_params_init_with_context(LibraryLink_Params *params, Main *bmain, int flag, int id_tag_extra, Scene *scene, ViewLayer *view_layer, const View3D *v3d)
void BLO_read_struct_list_with_size(BlendDataReader *reader, size_t expected_elem_size, ListBase *list)
@ LIBRARY_TAG_RESYNC_REQUIRED
@ LIBRARY_IS_ASSET_EDIT_FILE
static void * newlibadr(FileData *fd, ID *, const bool is_linked_only, const void *adr)
static void library_filedata_release(Library *lib)
static void oldnewmap_clear(OldNewMap *onm)
static void placeholders_ensure_valid(Main *bmain)
void BKE_id_delete(Main *bmain, void *idv, const BKEIDDeleteOptions &options={}) ATTR_NONNULL()
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
static void split_main_newid(Main *mainptr, Main *main_newid)
bool BKE_screen_blend_read_data(BlendDataReader *reader, bScreen *screen)
static void * blo_check_data_address_nonnull(FileData *fd, const void *old_address, void *new_address)
void * blo_read_struct_no_us_impl(BlendDataReader *reader, const void *old_address, size_t expected_size)
void do_versions_after_linking_401(FileData *fd, Main *bmain)
FileData * blo_filedata_from_memfile(MemFile *memfile, const BlendFileReadParams *params, BlendFileReadReport *reports)
static BHead * find_bhead_from_idname(FileData *fd, const char *idname)
static int * read_file_thumbnail(FileData *fd)
static void library_link_end(Main *mainl, FileData **fd, const int flag, ReportList *reports)
static void read_file_version_and_colorspace(FileData *fd, Main *main)
BlendFileReadReport * BLO_read_data_reports(BlendDataReader *reader)
static void change_link_placeholder_to_real_ID_pointer_fd(FileData *fd, const void *old, void *newp)
@ IDTYPE_CACHE_CB_FLAGS_PERSISTENT
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 * BLO_read_struct_by_name_array(BlendDataReader *reader, StringRef struct_name, int64_t items_num, const void *old_address)
bool BKE_idtype_idcode_is_valid(short idcode)
void BLO_read_data_globmap_add(BlendDataReader *reader, void *oldaddr, void *newaddr)
static ID * library_id_is_yet_read_deep_hash(FileData *fd, BHead *bhead)
static void expand_main(void *fdhandle, Main *mainvar, BLOExpandDoitCallback callback)
static void read_undo_libraries_preserve_never_undo_libraries(FileData *fd)
short BLO_version_from_file(const char *filepath)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void * BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
void do_versions_after_linking_270(Main *bmain)
void * blo_do_versions_newlibadr(FileData *fd, ID *self_id, const bool is_linked_only, const void *adr)
static int verg_bheadsort(const void *v1, const void *v2)
void blo_do_versions_key_uidgen(Key *key)
static void do_versions_userdef(FileData *, BlendFileData *bfd)
@ IDWALK_NO_ORIG_POINTERS_ACCESS
@ IDWALK_DO_DEPRECATED_POINTERS
static const IDHash * blo_bhead_id_deep_hash(const FileData *fd, const BHead *bhead)
void do_versions_after_linking_500(FileData *fd, Main *bmain)
bool BKE_idtype_idcode_is_linkable(short idcode)
void * blo_read_get_new_globaldata_address(FileData *fd, const void *adr)
static void do_versions(FileData *fd, Library *lib, Main *main)
void BKE_lib_libblock_session_uid_ensure(ID *id)
ID * BKE_main_idmap_lookup_name(IDNameLib_Map *id_map, short id_type, const char *name, const Library *lib) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void blo_do_versions_dna(SDNA *sdna, int versionfile, int subversionfile)
void blo_do_versions_500(FileData *fd, Library *lib, Main *bmain)
static int lib_link_cb(LibraryIDLinkCallbackData *cb_data)
void blo_cache_storage_init(FileData *fd, Main *bmain)
void BKE_main_collections_parent_relations_rebuild(Main *bmain)
BlendThumbnail * BLO_thumbnail_from_file(const char *filepath)
std::optional< BHead > BLO_readfile_read_bhead(FileReader *file, BHeadType type)
static bool read_libblock_undo_restore_linked(FileData *fd, Main *libmain, const ID *id, ID **r_id_old, BHead *bhead)
void BKE_id_free_ex(Main *bmain, void *idv, int flag_orig, bool use_flag_from_idtag)
void blo_do_versions_userdef(UserDef *userdef)
uint BKE_idtype_cache_key_hash(const void *key_v)
static void read_libraries_free_placeholders(FileData *basefd)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void read_undo_move_libmain_data(FileData *fd, Main *libmain, BHead *bhead)
FileReader * BLO_file_reader_uncompressed_from_descriptor(int filedes)
ID * BKE_libblock_alloc_notest(short type) ATTR_WARN_UNUSED_RESULT
void(*)(void *fdhandle, std::queue< ID * > &ids_to_expand, Main *mainvar, void *idv) BLOExpandDoitCallback
static FileData * blo_filedata_from_file_open(const char *filepath, BlendFileReadReport *reports)
void void void BLI_movelisttolist(ListBase *dst, ListBase *src) ATTR_NONNULL(1
static void blo_cache_storage_entry_clear_in_old(ID *, const IDCacheKey *key, void **cache_p, const uint, void *cache_storage_v)
AssetMetaData * blo_bhead_id_asset_data_address(const FileData *fd, const BHead *bhead)
void BKE_preferences_extension_repo_read_data(struct BlendDataReader *reader, bUserExtensionRepo *repo)
ImplicitSharingInfoAndData blo_read_shared_impl(BlendDataReader *reader, const void **ptr_p, FunctionRef< const ImplicitSharingInfo *()> read_fn)
void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
@ ID_REMAP_NO_ORIG_POINTERS_ACCESS
@ ID_REMAP_SKIP_USER_REFCOUNT
@ ID_REMAP_SKIP_USER_CLEAR
@ ID_REMAP_SKIP_UPDATE_TAGGING
const char * BKE_main_blendfile_path_from_global()
MainListsArray BKE_main_lists_get(Main &bmain)
static FileData * blo_decode_and_check(FileData *fd, ReportList *reports)
void blo_do_versions_501(FileData *fd, Library *lib, Main *bmain)
FileData * blo_filedata_from_file(const char *filepath, BlendFileReadReport *reports)
static void read_library_linked_ids(FileData *basefd, FileData *fd, Main *mainvar)
void do_versions_after_linking_260(Main *bmain)
static void oldnewmap_free(OldNewMap *onm)
@ LIB_ID_FREE_NO_USER_REFCOUNT
static BHead * find_bhead_from_code_name(FileData *fd, const short idcode, const char *name)
static void * newdataadr(FileData *fd, const void *adr, int64_t *r_alloc_len=nullptr)
void BLO_read_data_invalidate(BlendDataReader *reader, const char *message)
void * DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info, int old_struct_index, int blocks, const void *old_blocks, const char *alloc_name, int64_t *r_alloc_size=nullptr)
const char * BKE_id_name(const ID &id)
ID * BLO_library_link_named_part(Main *mainl, BlendHandle **bh, short idcode, const char *name, const LibraryLink_Params *params)
int BLI_open(const char *filepath, int oflag, int pmode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
size_t size_t size_t bool BLI_str_utf8_truncate_at_size(char *str, const size_t str_size)
static void blo_read_file_checks(Main *bmain)
@ BLO_LIBLINK_FORCE_INDIRECT
@ BLO_LIBLINK_COLLECTION_NO_HIERARCHY_REBUILD
@ BLO_LIBLINK_USE_PLACEHOLDERS
void MEM_delete_void(void *vmemh)
static Library * read_library_struct(FileData *fd, BHead *bheadlib)
void do_versions_after_linking_502(FileData *fd, Main *bmain)
void * blo_read_raw_address_impl(BlendDataReader *reader, const void *old_address)
static void * oldnewmap_liblookup(OldNewMap *onm, const void *addr, const bool is_linked_only)
void blo_do_versions_300(FileData *fd, Library *lib, Main *bmain)
void BLO_library_link_params_init(LibraryLink_Params *params, Main *bmain, int flag, int id_tag_extra)
static void read_undo_tag_all_noundo_ids(FileData *fd)
void blo_do_versions_502(FileData *fd, Library *lib, Main *bmain)
static Main * blo_add_main_for_library(FileData *fd, const BHead *bheadlib, Library *lib, Library *reference_lib, const char *lib_filepath, char(&filepath_abs)[FILE_MAX], const bool is_packed_library, const bool is_external_lib)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void do_versions_after_linking_503(FileData *fd, Main *bmain)
static void after_liblink_merged_bmain_process(Main *bmain, BlendFileReadReport *reports)
static void read_id_in_lib(FileData *fd, std::queue< ID * > &ids_to_expand, Main *libmain, Library *parent_lib, BHead *bhead, ID *existing_id, ID_Readfile_Data::Tags id_read_tags)
void BKE_main_id_refcount_recompute(Main *bmain, bool do_linked_only)
static CLG_LogRef LOG_UNDO
void do_versions_after_linking_402(FileData *fd, Main *bmain)
void BKE_layer_collection_resync_forbid(Main &bmain)
static void read_undo_remap_noundo_data(FileData *fd)
void BKE_libblock_free_data(ID *id, bool do_id_user) ATTR_NONNULL()
static void read_library_clear_weak_links(FileData *basefd, Main *mainvar)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
void do_versions_after_linking_280(FileData *fd, Main *bmain)
void BKE_animdata_blend_read_data(BlendDataReader *reader, ID *id)
void blo_do_versions_401(FileData *fd, Library *lib, Main *bmain)
FileReader * BLO_file_reader_uncompressed_from_memory(const void *mem, const int memsize)
void blo_cache_storage_old_bmain_clear(FileData *fd, Main *bmain_old)
void id_sort_by_name(ListBaseT< ID > *lb, ID *id, ID *id_sorting_hint)
static ID * read_id_struct(FileData *fd, BHead *bh, const char *blockname, const int id_type_index)
AnimData * BKE_animdata_from_id(const ID *id)
size_t void BLI_uniquename_cb(FunctionRef< bool(StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
void * MEM_new_uninitialized_aligned(size_t len, size_t alignment, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3)
static void lib_link_all(FileData *fd, Main *bmain)
static Main * blo_find_main_for_library_and_idname(FileData *fd, const BHead *bheadlib, const char *lib_filepath, const char *relabase, const BHead *id_bhead, const char *id_name, const bool is_packed_id, const bool is_external_lib)
StringRef DNA_struct_identifier(struct SDNA *sdna, int struct_index)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void do_versions_after_linking_404(FileData *fd, Main *bmain)
bool BLO_read_data_is_undo(BlendDataReader *reader)
static void split_libdata(ListBaseT< ID > *lb_src, Vector< Main * > &lib_main_array, const bool do_split_packed_ids)
void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
const char * blo_bhead_library_filepath(const FileData *fd, const BHead *bhead)
static void read_undo_reuse_noundo_local_ids(FileData *fd)
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 blo_split_main(Main *bmain, const bool do_split_packed_ids)
static FileData * change_ID_link_filedata_get(Main *bmain, FileData *basefd)
static void direct_link_id_override_property(BlendDataReader *reader, IDOverrideLibraryProperty *op)
void * blo_read_struct_nonnull_impl(BlendDataReader *reader, const void *old_address, size_t expected_size)
static bool is_minversion_older_than_blender(FileData *fd, ReportList *reports)
static void direct_link_keymapitem(BlendDataReader *reader, wmKeyMapItem *kmi)
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_layer_collection_resync_allow(Main &bmain)
void BKE_asset_catalog_path_list_blend_read_data(BlendDataReader *reader, ListBaseT< AssetCatalogPathLink > &catalog_path_list)
static void read_libraries(FileData *basefd)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
const char * blo_bhead_id_name(FileData *fd, const BHead *bhead)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
const char * DNA_struct_get_compareflags(const struct SDNA *oldsdna, const struct SDNA *newsdna)
static void after_liblink_id_embedded_id_process(BlendLibReader *reader, ID *id)
void do_versions_after_linking_400(FileData *fd, Main *bmain)
void blo_do_versions_oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, const int nr)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
LibraryFlag blo_bhead_library_flag(const FileData *fd, const BHead *bhead)
void BKE_object_materials_sync_length(Main *bmain, Object *ob, ID *id)
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static FileData * filedata_new(BlendFileReadReport *reports)
static void * newdataadr_no_us(FileData *fd, const void *adr, int64_t *r_alloc_len=nullptr)
static void after_liblink_id_process(BlendLibReader *reader, ID *id)
static int has_linked_ids_to_read(Main *mainvar)
static void * read_struct(FileData *fd, BHead *bh, const char *blockname, const int id_type_index, int64_t *r_alloc_len=nullptr)
void blo_do_versions_403(FileData *fd, Library *lib, Main *bmain)
bool BKE_main_namemap_validate_and_fix(Main &bmain)
void * blo_read_struct_with_type_size_impl(BlendDataReader *reader, const void *old_address, size_t base_size, FunctionRef< size_t(const void *data)> type_size_fn)
std::variant< BlenderHeaderInvalid, BlenderHeaderUnknown, BlenderHeader > BlenderHeaderVariant
static void read_libraries_report_invalid_id_names(FileData *fd, ReportList *reports, const bool has_forward_compatibility_issues, const char *filepath)
void BKE_main_ensure_invariants(Main &bmain, std::optional< Span< ID * > > modified_ids=std::nullopt)
void version_system_idprops_nodes_generate(Main *bmain)
const IDTypeInfo * BKE_idtype_get_info_from_idtype_index(const int idtype_index)
static void read_file_bhead_idname_map_create(FileData *fd)
BlendFileReadReport * BLO_read_lib_reports(BlendLibReader *reader)
static BHead * blo_bhead_read_full(FileData *fd, BHead *thisblock)
void BLO_library_link_end(Main *mainl, BlendHandle **bh, const LibraryLink_Params *params, ReportList *reports)
int BKE_idtype_idcode_to_index(short idcode)
void blo_do_versions_270(FileData *fd, Library *lib, Main *bmain)
void BLO_read_struct_list_with_type_size(BlendDataReader *reader, size_t base_size, ListBase *list, FunctionRef< size_t(const void *data)> type_size_fn)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static void read_libblock_undo_restore_identical(FileData *fd, Main *main, const ID *, ID *id_old, BHead *bhead, const eID_Tag id_tag)
uint32_t uint32_from_uint64_ptr(uint64_t ptr)
void BLO_main_validate_embedded_liboverrides(Main *bmain, ReportList *reports)
ID * BLO_read_get_new_id_address(BlendLibReader *reader, ID *self_id, const bool is_linked_only, ID *id) ATTR_NONNULL(2)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
static ID * create_placeholder(Main *mainvar, const short idcode, const char *idname, const int tag, const bool was_liboverride)
static const T * blo_bhead_data_at(const BHead *bhead, const int offset)
void BKE_collections_after_lib_link(Main *bmain)
void blo_do_versions_290(FileData *fd, Library *lib, Main *bmain)
bool blo_read_pointer_array_impl(BlendDataReader *reader, int64_t array_size, void **ptr_p)
void BKE_libblock_init_empty(ID *id) ATTR_NONNULL(1)
void BLO_read_data_set_need_preview_render_restart(BlendDataReader *reader)
static OldNewMap * oldnewmap_new()
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
static void add_main_to_main(Main *mainvar, Main *from)
static bool read_file_dna(FileData *fd, const char **r_error_message)
static void change_link_placeholder_to_real_ID_pointer(FileData *basefd, const void *old, void *newp)
void BKE_main_namemap_clear(Main &bmain)
@ LIBRARY_FLAG_IS_ARCHIVE
@ LIBRARY_FLAG_IS_EXTERNAL
ATTR_WARN_UNUSED_RESULT const size_t num
int DNA_struct_size(const struct SDNA *sdna, int struct_index)
void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
BHead * blo_read_asset_data_block(FileData *fd, BHead *bhead, AssetMetaData **r_asset_data)
void BLO_main_validate_embedded_flag(Main *bmain, ReportList *reports)
void IMB_colormanagement_working_space_convert(Main *bmain, const float3x3 ¤t_scene_linear_to_xyz, const float3x3 &new_xyz_to_scene_linear, bool depsgraph_tag=false, bool linked_only=false, bool editable_assets_only=false)
MatBase< float, 3, 3 > float3x3
static void change_ID_pointer_to_real_ID_pointer_fd(FileData *fd, const void *old, void *newp)
static size_t user_menu_item_struct_size(const eUserMenu_Type type)
void BKE_main_id_tag_all(Main *mainvar, int tag, bool value)
static BHead * find_previous_lib(FileData *fd, BHead *bhead)
static void * blo_verify_data_address(FileData *fd, void *new_address, const void *, const int64_t alloc_len, const size_t expected_size)
BHead * blo_bhead_prev(FileData *, BHead *thisblock)
void do_versions_after_linking_403(FileData *fd, Main *bmain)
BlendFileData * blo_read_file_internal(FileData *fd, const char *filepath)
static void * read_struct_and_validate_size(FileData *fd, BHead *bh, const char *blockname, const int id_type_index, const int64_t min_size)
@ BLO_READ_SKIP_UNDO_OLD_MAIN
static void read_libblock_undo_restore_at_old_address(FileData *fd, Main *main, ID *id, ID *id_old)
void do_versions_after_linking_501(FileData *fd, Main *bmain)
static void change_ID_pointer_to_real_ID_pointer(FileData *basefd, const void *old, void *newp)
static bool blo_bhead_is_id(const BHead *bhead)
void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna)
static FileData * read_library_file_data(FileData *basefd, Main *bmain, Main *lib_bmain)
Main * BLO_library_link_begin(BlendHandle **bh, const char *filepath, const LibraryLink_Params *params)
static Main * library_link_begin(Main *mainvar, FileData *fd, const char *filepath, const eID_Tag id_tag_extra)
void BKE_report_log(eReportType type, const char *message, CLG_LogRef *log)
void BKE_main_free(Main *bmain)
Main * BLO_read_lib_get_main(BlendLibReader *reader)
int DNA_struct_find_with_alias(const struct SDNA *sdna, StringRef str)
static void blo_cache_storage_entry_restore_in_new(ID *id, const IDCacheKey *key, void **cache_p, const uint flags, void *cache_storage_v)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
FileReader * BLO_memfile_new_filereader(MemFile *memfile, int undo_direction)
ViewLayer * BKE_view_layer_find(const Scene *scene, const char *layer_name)
void id_us_ensure_real(ID *id)
static void read_undo_libraries_cleanup_unused_ids(FileData *fd)
void BKE_lib_override_library_main_update(Main *bmain)
void BKE_libblock_free_runtime_data(ID *id)
void BKE_lib_override_library_main_validate(Main *bmain, ReportList *reports)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
static void blo_cache_storage_entry_register(ID *id, const IDCacheKey *key, void **cache_p, uint, void *cache_storage_v)
static ID * library_id_is_yet_read_main(Main *mainvar, const char *idname)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static const char * library_parent_filepath(Library *lib)
void BKE_asset_metadata_read(BlendDataReader *reader, AssetMetaData *asset_data)
static ID * library_id_is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
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 BLO_readfile_id_runtime_data_free(ID &id)
static BHead * read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void version_system_idprops_children_bones_generate(Main *bmain)
int BLO_read_fileversion_get(BlendDataReader *reader)
@ USER_MENU_TYPE_OPERATOR
static const void * peek_struct_undo(FileData *fd, BHead *bhead)
static bool library_filepath_is_valid(const Library *lib)
void blo_do_versions_402(FileData *fd, Library *lib, Main *bmain)
static void lib_link_scenes_check_set(Main *bmain)
short blo_bhead_id_flag(const FileData *fd, const BHead *bhead)
ID_Type GS(const char *name)
void BKE_main_idmap_insert_id(IDNameLib_Map *id_map, ID *id) ATTR_NONNULL()
void blo_do_versions_260(FileData *fd, Library *lib, Main *bmain)
IDNameLib_Map * BKE_main_idmap_create(Main *bmain, bool create_valid_ids_set, Main *old_bmain, int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void fix_relpaths_library(const char *basepath, Main *main)
static bool read_libblock_undo_restore(FileData *fd, Main *main, BHead *bhead, const eID_Tag id_tag, ID **r_id_old)
static bool direct_link_id(FileData *fd, Main *main, const eID_Tag id_tag, const ID_Readfile_Data::Tags id_read_tags, ID *id, ID *id_old)
@ ID_TAG_LIBOVERRIDE_NEED_RESYNC
@ ID_TAG_UNDO_OLD_ID_REREAD_IN_PLACE
@ ID_TAG_UNDO_OLD_ID_REUSED_NOUNDO
@ ID_TAG_UNDO_OLD_ID_REUSED_UNCHANGED
static void direct_link_id_common(BlendDataReader *reader, Library *current_library, ID *id, ID *id_old, eID_Tag id_tag, ID_Readfile_Data::Tags id_read_tags)
static bool oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, const int nr, const int64_t alloc_len=0)
static BHead * read_libblock(FileData *fd, Main *main, BHead *bhead, eID_Tag id_tag, ID_Readfile_Data::Tags id_read_tags, const bool placeholder_set_indirect_extern, ID **r_id)
FileData * blo_filedata_from_memory(const void *mem, const int memsize, BlendFileReadReport *reports)
static void readfile_id_runtime_data_ensure(ID &id)
static void long_id_names_process_action_slots_identifiers(Main *bmain)
bool BKE_idtype_cache_key_cmp(const void *key_a_v, const void *key_b_v)
static void convert_pointer_array_32_to_64(BlendDataReader *, const int64_t array_size, const uint32_t *src, uint64_t *dst)
double BLI_time_now_seconds()
bool BLO_read_lib_is_undo(BlendLibReader *reader)
static BHead * find_bhead(FileData *fd, void *old)
int DNA_struct_alignment(const struct SDNA *sdna, int struct_index)
bool BLI_remlink_safe(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * blo_read_struct_no_us_nonnull_impl(BlendDataReader *reader, const void *old_address, size_t expected_size)
static ID * link_named_part(Main *mainl, FileData *fd, const short idcode, const char *name, const int flag)
void blo_do_versions_404(FileData *fd, Library *lib, Main *bmain)
@ ID_FLAG_INDIRECT_WEAK_LINK
@ ID_FLAG_LINKED_AND_PACKED
static void direct_link_id_embedded_id(BlendDataReader *reader, Library *current_library, ID *id, ID *id_old)
void BKE_packedfile_blend_read(BlendDataReader *reader, PackedFile **pf_p, StringRefNull filepath)
static bool blo_read_verify_type_size(FileData *fd, NewAddress &entry, const void *old_address, FunctionRef< size_t(const void *data)> type_size_fn)
static void link_glob_list(FileData *fd, ListBase *lb)
static void convert_pointer_array_64_to_32(BlendDataReader *reader, const int64_t array_size, const uint64_t *src, uint32_t *dst)
static void do_versions_after_linking(FileData *fd, Main *main)
const SDNA * DNA_sdna_current_get()
static BHead * read_data_into_datamap(FileData *fd, BHead *bhead, const char *allocname, const int id_type_index)
void do_versions_after_linking_250(Main *bmain)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void do_versions_after_linking_405(FileData *fd, Main *bmain)
int DNA_struct_member_offset_by_name_with_alias(const struct SDNA *sdna, StringRef stype, StringRef vartype, StringRef name)
static void link_global(FileData *fd, BlendFileData *bfd)
@ IDWALK_CB_DIRECT_WEAK_LINK
@ IDWALK_CB_EMBEDDED_NOT_OWNING
@ IDWALK_CB_OVERRIDE_LIBRARY_HIERARCHY_ROOT
@ IDWALK_CB_READFILE_IGNORE
void BKE_main_id_indirect_linked_update(Main &bmain, std::optional< Span< ID * > > local_ids=std::nullopt)
static bool blo_bhead_read_data(FileData *fd, BHead *thisblock, void *buf)
void blo_make_old_idmap_from_main(FileData *fd, Main *bmain)
static FileData * blo_filedata_from_file_descriptor(const char *filepath, BlendFileReadReport *reports, const int filedes)
static void read_library_linked_id(FileData *basefd, FileData *fd, Main *mainvar, ID *id, ID **r_id)
void BKE_main_idmap_remove_id(IDNameLib_Map *id_map, const ID *id) ATTR_NONNULL()
static bool blo_bhead_is_id_valid_type(const BHead *bhead)
void BKE_blender_version_blendfile_string_from_values(char *str_buff, const size_t str_buff_maxncpy, const short file_version, const short file_subversion)
static void * oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, const bool increase_users, int64_t *r_alloc_len=nullptr)
void * blo_read_struct_impl(BlendDataReader *reader, const void *old_address, size_t expected_size)
void BLO_readfile_id_runtime_data_free_all(Main &bmain)
BHead * blo_bhead_next(FileData *fd, BHead *thisblock)
static bool read_libblock_undo_restore_library(FileData *fd, const ID *id, ID *id_old, BHead *bhead)
void do_versions_after_linking_290(FileData *fd, Main *bmain)
ID ID ID * BKE_main_idmap_lookup_uid(IDNameLib_Map *id_map, uint session_uid) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static int direct_link_id_restore_recalc(const FileData *fd, const ID *id_target, const ID *id_current, const bool is_identical)
void blo_do_versions_280(FileData *fd, Library *lib, Main *bmain)
void BKE_preferences_asset_library_read_data(struct BlendDataReader *reader, struct bUserAssetLibrary *library)
bool BKE_main_is_empty(Main *bmain)
static void oldnewmap_lib_insert(FileData *fd, const void *oldaddr, ID *newaddr, const int id_code)
void blo_cache_storage_end(FileData *fd)
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
static bool read_libblock_is_identical(FileData *fd, BHead *bhead)
void BKE_library_foreach_ID_link(Main *bmain, ID *id, FunctionRef< LibraryIDLinkCallback > callback, void *user_data, LibraryForeachIDFlag flag)
ID * BLO_read_get_new_id_address_from_session_uid(BlendLibReader *reader, uint session_uid) ATTR_NONNULL(1)
void * BKE_id_new(Main *bmain, short type, const char *name)
short do_versions_new_to_old_idcode_get(const short id_code_new)
Main * BKE_main_idmap_main_get(IDNameLib_Map *id_map) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
BHead * blo_bhead_first(FileData *fd)
static const char * blo_bhead_string_at(const BHead *bhead, const int offset, const size_t maxsize)
static NewAddress * newdataadr_entry(FileData *fd, const void *adr)
bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports)
void blo_do_versions_400(FileData *fd, Library *lib, Main *bmain)
@ FD_FLAGS_FILE_POINTSIZE_IS_4
@ FD_FLAGS_POINTSIZE_DIFFERS
@ FD_FLAGS_HAS_INVALID_ID_NAMES
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void blo_join_main(Main *bmain)
void blo_filedata_free(FileData *fd)
void BKE_collection_blend_read_data(BlendDataReader *reader, Collection *collection, ID *owner_id)
void blo_do_versions_503(FileData *fd, Library *lib, Main *bmain)
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)
static void read_blender_header(FileData *fd)
std::unique_ptr< SDNA > DNA_sdna_from_data(const void *data, int data_len, bool data_alloc, bool do_alias, const char **r_error_message)
BlenderHeaderVariant BLO_readfile_blender_header_decode(FileReader *file)
ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(const ID &id)
void blo_do_versions_405(FileData *fd, Library *lib, Main *bmain)
ListBaseT< ID > * which_libbase(Main *bmain, short type)
static void sort_bhead_old_map(FileData *fd)
void do_versions_after_linking_300(FileData *fd, Main *bmain)
static int expand_cb(LibraryIDLinkCallbackData *cb_data)
void BKE_main_idmap_destroy(IDNameLib_Map *id_map) ATTR_NONNULL()
static BHead * read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
@ IDTYPE_FLAGS_NO_MEMFILE_UNDO
static void long_id_names_ensure_unique_id_names(Main *bmain)
void version_system_idprops_generate(Main *bmain)
AllocStringStorage< keyT, hashT > & alloc_string_storage_get(const std::string &storage_identifier)
#define BHEADN_FROM_BHEAD(bh)
#define BHEAD_USE_READ_ON_DEMAND(bhead)
char tmp_last_slot_identifier[258]
char last_slot_identifier[258]
bool is_memchunk_identical
Map< uint64_t, ImplicitSharingInfoAndData > shared_data_by_stored_address
std::queue< ID * > ids_to_expand
BLOExpandDoitCallback callback
ViewLayer * cur_view_layer
struct blender::BlendFileReadReport::@140003175311343306107257242277261221002217304000 count
struct blender::BlendFileReadReport::@070156237370130334241363347365056360307125257043 duration
BlenderHeader blender_header
std::shared_ptr< Map< IDHash, ID * > > id_by_deep_hash
BLOCacheStorage * cache_storage
std::optional< Map< StringRefNull, BHead * > > bhead_idname_map
ListBaseT< BHeadN > bhead_list
std::optional< BLI_stat_t > file_stat
bool need_preview_render_restart
IDNameLib_Map * new_idmap_uid
DNA_ReconstructInfo * reconstruct_info
int library_filepath_offset
BlendFileReadReport * reports
std::unique_ptr< SDNA > filesdna
IDNameLib_Map * old_idmap_uid
struct bScreen * curscreen
uint64_t build_commit_timestamp
char colorspace_scene_linear_name[64]
float colorspace_scene_linear_to_xyz[3][3]
struct ViewLayer * cur_view_layer
unsigned int id_session_uid
char * subitem_reference_name
eID_OverrideLib_PropTag tag
char * subitem_local_name
ListBaseT< IDOverrideLibraryPropertyOperation > operations
eID_OverrideLib_PropTag tag
IDTypeBlendReadAfterLiblinkFunction blend_read_after_liblink
IDTypeForeachCacheFunction foreach_cache
AssetTypeInfo * asset_type_info
IDTypeBlendReadUndoPreserve blend_read_undo_preserve
IDTypeBlendReadDataFunction blend_read_data
bke::id::ID_Runtime * runtime
unsigned int recalc_up_to_undo_push
unsigned int recalc_after_undo_push
ListBaseT< KeyBlock > block
LibraryForeachIDCallbackFlag cb_flag
struct blender::LibraryLink_Params::@175256100055375060246026064001141305302247133361 context
struct Library * archive_parent_library
struct PackedFile * packedfile
bke::library::LibraryRuntime * runtime
float3x3 scene_linear_to_xyz
char scene_linear_name[64]
ListBaseT< wmWindowManager > wm
MainColorspace colorspace
std::shared_ptr< VectorSet< Main * > > split_mains
bool need_preview_render_restart
ListBaseT< Library > libraries
ListBaseT< Object > objects
bool has_forward_compatibility_issues
uint64_t build_commit_timestamp
ListBaseT< Scene > scenes
BlendThumbnail * blen_thumb
Map< uint64_t, ImplicitSharingInfoAndData > sharing_info_by_address_id
MemFileSharedStorage * shared_storage
char last_slot_identifier[258]
Map< const void *, NewAddress > map
struct Collection * master_collection
DNA_DEPRECATED struct bNodeTree * compositing_node_group
DNA_DEPRECATED struct bNodeTree * nodetree
ListBaseT< bUserExtensionRepo > extension_repos
ListBaseT< bTheme > themes
ListBaseT< struct wmKeyMap > user_keymaps
ListBaseT< struct wmKeyConfigPref > user_keyconfig_prefs
ListBaseT< bUserAssetLibrary > asset_libraries
ListBaseT< bAddon > addons
ListBaseT< bPathCompare > autoexec_paths
ListBaseT< bUserScriptDirectory > script_directories
ListBaseT< uiStyle > uistyles
ListBaseT< bUserAssetShelfSettings > asset_shelves_settings
ListBaseT< uiFont > uifonts
ListBaseT< bUserMenu > user_menus
char last_slot_identifier[258]
struct ActionSlot ** slot_array
ListBaseT< struct bConstraint > constraints
DNA_DEPRECATED struct Scene * scene
ListBaseT< AssetCatalogPathLink > enabled_catalog_paths
ID_Readfile_Data * readfile_data
Vector< Library * > archived_libraries
MainColorspace colorspace
Set< ID * > unused_ids_on_undo
wmKeyMapItem * remove_item
ListBaseT< wmKeyMapDiffItem > diff_items
bool(*) poll(struct bContext *)
ListBaseT< wmKeyMapItem > items
DNA_DEPRECATED struct bScreen * screen