22#include <fmt/format.h>
122# define MAKE_ID(a, b, c, d) (int(a) << 24 | int(b) << 16 | (c) << 8 | (d))
125# define MAKE_ID(a, b, c, d) (int(d) << 24 | int(c) << 16 | (b) << 8 | (a))
174 return (name[0] ==
'*' || (name[0] ==
'(' && name[1] ==
'*'));
179 const char *cp = sdna->
members[member_index];
196static void printstruct(
SDNA *sdna,
short struct_index)
201 printf(
"struct %s\n", sdna->
types[struct_info->type]);
203 for (
int b = 0;
b < struct_info->members_len;
b++) {
205 printf(
" %s %s\n", sdna->
types[struct_member->type], sdna->names[struct_member->name]);
224 uint *struct_index_last)
229 return *struct_index_last;
236 if (struct_index_p) {
238 *struct_index_last = struct_index;
244 for (
int struct_index = 0; struct_index <
types_num; struct_index++) {
247 *struct_index_last = struct_index;
258 uint *struct_index_last)
319 return (
const char *)((uintptr_t(
ptr) + 3) & ~3);
327 int member_index_gravity_fix = -1;
332 sdna->
types =
nullptr;
350 *r_error_message =
"SDNA error in SDNA file";
362 if (do_endian_swap) {
371 *r_error_message =
"NAME error in SDNA file";
376 for (
int member_index = 0; member_index < sdna->
members_num; member_index++) {
377 sdna->
members[member_index] = cp;
382 if (*cp ==
'[' &&
STREQ(cp,
"[3]")) {
383 if (member_index &&
STREQ(sdna->
members[member_index - 1],
"Cvi")) {
384 sdna->
members[member_index] =
"gravity[3]";
385 member_index_gravity_fix = member_index;
402 if (do_endian_swap) {
410 *r_error_message =
"TYPE error in SDNA file";
415 for (
int type_index = 0; type_index < sdna->
types_num; type_index++) {
434 if (do_endian_swap) {
441 *r_error_message =
"TLEN error in SDNA file";
455 if (do_endian_swap) {
463 *r_error_message =
"STRC error in SDNA file";
470 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
472 sdna->
structs[struct_index] = struct_info;
474 if (do_endian_swap) {
478 for (
short a = 0; a < struct_info->
members_num; a++) {
485 *r_error_message =
"Invalid duplicate struct type index in SDNA file";
494 if (member_index_gravity_fix > -1) {
495 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
496 sp = (
short *)sdna->
structs[struct_index];
497 if (
STREQ(sdna->
types[sp[0]],
"ClothSimSettings")) {
509 for (intptr_t struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
529 *r_error_message =
"ListBase struct error! Not found.";
539 *r_error_message =
"ListBase struct error: invalid computed pointer-size.";
547 for (
int member_index = 0; member_index < sdna->
members_num; member_index++) {
554 for (
int type_index = 0; type_index < sdna->
types_num; type_index++) {
555 sdna->
types_alignment[type_index] = int(__STDCPP_DEFAULT_NEW_ALIGNMENT__);
560 uint dummy_index = 0;
562 sdna,
"mat4x4f", &dummy_index);
563 if (mat4x4f_struct_index > 0) {
565 const int mat4x4f_type_index = struct_info->
type_index;
578 const char **r_error_message)
581 const char *error_message =
nullptr;
586 memcpy(data_copy,
data, data_len);
587 sdna->
data = data_copy;
590 sdna->
data =
static_cast<const char *
>(
data);
601 if (r_error_message ==
nullptr) {
602 fprintf(stderr,
"Error decoding blend file SDNA: %s\n", error_message);
605 *r_error_message = error_message;
647 const int old_struct_index)
658 if (new_struct_index == -1) {
677 for (
int member_index = 0; member_index < old_struct->
members_num; member_index++) {
683 if (!
STREQ(old_type_name, new_type_name)) {
691 if (!
STREQ(old_member_name, new_member_name)) {
708 if (old_member_struct_index >= 0) {
725 printf(
"error: file without SDNA\n");
733 for (
int old_struct_index = 0; old_struct_index < oldsdna->
structs_num; old_struct_index++) {
765 for (
int a = 0; a < oldsdna->structs_len; a++) {
768 printf(
"changed: %s\n", oldsdna->
types[struct_info->type]);
773 return compare_flags;
791 const char *old_data,
798 double old_value_f = 0.0;
803 for (
int a = 0; a < array_len; a++) {
806 const char value = *old_data;
808 old_value_f = double(value);
812 const uchar value = *
reinterpret_cast<const uchar *
>(old_data);
814 old_value_f = double(value);
818 const short value = *
reinterpret_cast<const short *
>(old_data);
820 old_value_f = double(value);
824 const ushort value = *
reinterpret_cast<const ushort *
>(old_data);
826 old_value_f = double(value);
830 const int value = *
reinterpret_cast<const int *
>(old_data);
832 old_value_f = double(value);
836 const float value = *
reinterpret_cast<const float *
>(old_data);
843 const double value = *
reinterpret_cast<const double *
>(old_data);
850 const int64_t value = *
reinterpret_cast<const int64_t *
>(old_data);
852 old_value_f = double(value);
858 old_value_f = double(value);
862 const int8_t value = *
reinterpret_cast<const int8_t *
>(old_data);
864 old_value_f = double(value);
868 BLI_assert_msg(
false,
"Conversion from SDNA_TYPE_RAW_DATA is not supported");
874 *new_data = char(old_value_i);
877 *
reinterpret_cast<uchar *
>(new_data) =
uchar(old_value_i);
880 *
reinterpret_cast<short *
>(new_data) =
short(old_value_i);
883 *
reinterpret_cast<ushort *
>(new_data) =
ushort(old_value_i);
886 *
reinterpret_cast<int *
>(new_data) =
int(old_value_i);
890 old_value_f /= 255.0;
892 *
reinterpret_cast<float *
>(new_data) = old_value_f;
896 old_value_f /= 255.0;
898 *
reinterpret_cast<double *
>(new_data) = old_value_f;
904 *
reinterpret_cast<uint64_t *
>(new_data) = old_value_i;
907 *
reinterpret_cast<int8_t *
>(new_data) = int8_t(old_value_i);
910 BLI_assert_msg(
false,
"Conversion to SDNA_TYPE_RAW_DATA is not supported");
920 const uint32_t *old_data,
923 for (
int a = 0; a < array_len; a++) {
924 new_data[a] = old_data[a];
935 for (
int a = 0; a < array_len; a++) {
936 new_data[a] = old_data[a] >> 3;
948 if (name[a] != oname[a]) {
951 if (name[a] ==
'[' || oname[a] ==
'[') {
954 if (name[a] == 0 || oname[a] == 0) {
987 return STREQ(type, otype);
1042 if (
STREQ(type, otype)) {
1115 return type_size * array_length;
1120 if (struct_index == -1) {
1126 int offset_in_bytes = 0;
1127 for (
int member_index = 0; member_index < struct_info->
members_num; member_index++) {
1130 char *member_data =
data + offset_in_bytes;
1134 switch (member_category) {
1139 for (
int a = 0; a < member_array_length; a++) {
1174 if (
sizeof(
void *) < 8) {
1236 const int old_struct_index,
1237 const int new_struct_index,
1238 const char *old_blocks,
1251 const int new_struct_index,
1252 const char *old_block,
1256 const int step_count = reconstruct_info->
step_counts[new_struct_index];
1259 for (
int a = 0; a < step_count; a++) {
1261 switch (
step->type) {
1263 memcpy(new_block +
step->data.memcpy.new_offset,
1264 old_block +
step->data.memcpy.old_offset,
1265 step->data.memcpy.size);
1269 step->data.cast_primitive.new_type,
1270 step->data.cast_primitive.array_len,
1271 old_block +
step->data.cast_primitive.old_offset,
1272 new_block +
step->data.cast_primitive.new_offset);
1276 (
const uint64_t *)(old_block +
step->data.cast_pointer.old_offset),
1277 (uint32_t *)(new_block +
step->data.cast_pointer.new_offset));
1281 (
const uint32_t *)(old_block +
step->data.cast_pointer.old_offset),
1282 (
uint64_t *)(new_block +
step->data.cast_pointer.new_offset));
1286 step->data.substruct.array_len,
1287 step->data.substruct.old_struct_index,
1288 step->data.substruct.new_struct_index,
1289 old_block +
step->data.substruct.old_offset,
1290 new_block +
step->data.substruct.new_offset);
1305 const int old_struct_index,
1306 const int new_struct_index,
1307 const char *old_blocks,
1316 for (
int a = 0; a < blocks; a++) {
1317 const char *old_block = old_blocks + a * old_block_size;
1318 char *new_block = new_blocks + a * new_block_size;
1324 int old_struct_index,
1326 const void *old_blocks,
1327 const char *alloc_name)
1336 if (new_struct_index == -1) {
1344 char *new_blocks =
static_cast<char *
>(
1350 static_cast<const char *
>(old_blocks),
1362 for (
int a = 0; a < struct_info->
members_num; a++) {
1376 const SDNA *newsdna,
1377 const char *compare_flags,
1380 const int new_member_offset,
1385 int old_member_offset;
1388 oldsdna, old_struct, new_name, &old_member_offset);
1390 if (old_member ==
nullptr) {
1400 if (new_category != old_category) {
1409 const int shared_array_length = std::min(new_array_length, old_array_length);
1414 switch (new_category) {
1416 if (
STREQ(new_type_name, old_type_name)) {
1420 compare_flags[old_struct_index]);
1428 shared_array_length;
1452 if (
STREQ(new_type_name, old_type_name)) {
1458 shared_array_length;
1504 const SDNA *oldsdna,
1505 const SDNA *newsdna)
1507 switch (
step->type) {
1509 printf(
"initialize zero");
1513 printf(
"memcpy, size: %d, old offset: %d, new offset: %d",
1514 step->data.memcpy.size,
1515 step->data.memcpy.old_offset,
1516 step->data.memcpy.new_offset);
1521 "cast element, old type: %d ('%s'), new type: %d ('%s'), old offset: %d, new offset: "
1523 int(
step->data.cast_primitive.old_type),
1524 oldsdna->
types[
step->data.cast_primitive.old_type],
1525 int(
step->data.cast_primitive.new_type),
1526 newsdna->
types[
step->data.cast_primitive.new_type],
1527 step->data.cast_primitive.old_offset,
1528 step->data.cast_primitive.new_offset,
1529 step->data.cast_primitive.array_len);
1533 printf(
"pointer to 32, old offset: %d, new offset: %d, length: %d",
1534 step->data.cast_pointer.old_offset,
1535 step->data.cast_pointer.new_offset,
1536 step->data.cast_pointer.array_len);
1540 printf(
"pointer to 64, old offset: %d, new offset: %d, length: %d",
1541 step->data.cast_pointer.old_offset,
1542 step->data.cast_pointer.new_offset,
1543 step->data.cast_pointer.array_len);
1548 "substruct, old offset: %d, new offset: %d, new struct: %d ('%s', size per struct: %d), "
1550 step->data.substruct.old_offset,
1551 step->data.substruct.new_offset,
1552 step->data.substruct.new_struct_index,
1555 step->data.substruct.array_len);
1566 const SDNA *newsdna,
1567 const char *compare_flags,
1573 int new_member_offset = 0;
1574 for (
int new_member_index = 0; new_member_index < new_struct->
members_num; new_member_index++) {
1582 &
steps[new_member_index]);
1592 int new_step_count = 0;
1593 for (
int a = 0; a < old_step_count; a++) {
1595 switch (
step->type) {
1600 if (new_step_count > 0) {
1606 step->data.memcpy.old_offset &&
1608 step->data.memcpy.new_offset)
1629 return new_step_count;
1633 const SDNA *newsdna,
1634 const char *compare_flags)
1637 reconstruct_info->
oldsdna = oldsdna;
1638 reconstruct_info->
newsdna = newsdna;
1645 for (
int new_struct_index = 0; new_struct_index < newsdna->
structs_num; new_struct_index++) {
1649 if (old_struct_index < 0) {
1650 reconstruct_info->
steps[new_struct_index] =
nullptr;
1651 reconstruct_info->
step_counts[new_struct_index] = 0;
1656 oldsdna, newsdna, compare_flags, old_struct, new_struct);
1661 reconstruct_info->
steps[new_struct_index] =
steps;
1662 reconstruct_info->
step_counts[new_struct_index] = steps_len;
1666 printf(
"%s: \n", new_struct_name);
1667 for (
int a = 0; a < steps_len; a++) {
1675 return reconstruct_info;
1680 for (
int new_struct_index = 0; new_struct_index < reconstruct_info->
newsdna->
structs_num;
1683 if (reconstruct_info->
steps[new_struct_index] !=
nullptr) {
1694 const char *vartype,
1705 const char *vartype,
1721 const char *vartype,
1726 if (struct_index != -1) {
1739 const char *vartype,
1774 BLI_assert_msg(
false,
"Operations on the size of SDNA_TYPE_RAW_DATA is not supported");
1802#ifdef WITH_DNA_GHASH
1812 const char *old_type_name,
1813 const char *new_type_name)
1816 if (struct_index != -1) {
1824 const int struct_index,
1825 const char *old_member_name,
1826 const char *new_member_name)
1831 const int old_member_name_len = strlen(old_member_name);
1832 const int new_member_name_len = strlen(new_member_name);
1835 for (
int struct_member_index = struct_info->
members_num; struct_member_index > 0;
1836 struct_member_index--)
1841 uint old_member_name_full_offset_start;
1843 old_member_name_len,
1844 old_member_name_full,
1845 &old_member_name_full_offset_start))
1852 old_member_name_len,
1854 new_member_name_len,
1855 old_member_name_full,
1856 strlen(old_member_name_full),
1857 old_member_name_full_offset_start);
1867 const short old_member_index = member_info->
member_index;
1879 const char *type_name,
1880 const char *old_member_name,
1881 const char *new_member_name)
1884 if (struct_index != -1) {
1906 int names_expand_len = 0;
1907 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
1914 int names_expand_index = 0;
1915 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
1922 memcpy(struct_new, struct_old, array_size);
1923 sdna->
structs[struct_index] = struct_new;
1930 names_array_len_expand[names_expand_index] =
1935 names_expand_index++;
1948 GHash *elem_map_alias_from_static,
1949 const char *struct_name_static,
1950 const char *elem_static_full)
1952 const int elem_static_full_len = strlen(elem_static_full);
1953 char *elem_static =
static_cast<char *
>(alloca(elem_static_full_len + 1));
1955 const char *str_pair[2] = {struct_name_static, elem_static};
1956 const char *elem_alias =
static_cast<const char *
>(
1965 elem_static_full_len,
1978 const bool use_legacy_hack =
true;
1992 for (
int type_index = 0; type_index < sdna->
types_num; type_index++) {
1993 const char *type_name_static = sdna->
types[type_index];
1995 if (use_legacy_hack) {
2007 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
2009 const char *struct_name_static = sdna->
types[struct_info->
type_index];
2011 if (use_legacy_hack) {
2015 for (
int a = 0; a < struct_info->
members_num; a++) {
2022 if (member_alias_full !=
nullptr) {
2042#ifdef WITH_DNA_GHASH
2045 for (intptr_t struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
2068 const void *initial_data,
2071 fmt::appender &dst);
2074 const void *initial_data,
2076 fmt::appender &dst);
2083 const int string_length = strnlen(
data, array_len);
2084 if (string_length == array_len) {
2092 if (!std::isprint(c)) {
2106 if (element_num == 1) {
2115 fmt::format_to(dst,
"{:{}}{}: <{}>\n",
"", indent,
i, struct_name);
2122 const void *initial_data,
2127 const void *
data = initial_data;
2136 fmt::format_to(dst,
"{:{}}{} {}:",
"", indent, member_type_name, member_name);
2141 const char *str_data =
static_cast<const char *
>(
data);
2142 fmt::format_to(dst,
" ");
2144 fmt::format_to(dst,
"'{}'", str_data);
2147 for (
const int i :
IndexRange(member_array_len)) {
2148 fmt::format_to(dst,
"{} ",
int(str_data[
i]));
2151 fmt::format_to(dst,
"\n");
2154 switch (member_category) {
2156 fmt::format_to(dst,
"\n");
2160 sdna, sub_sdna_struct,
data, member_array_len, indent + 2, dst);
2164 fmt::format_to(dst,
" ");
2167 for ([[maybe_unused]]
const int elem_i :
IndexRange(member_array_len)) {
2171 const char value = *
reinterpret_cast<const char *
>(current_data);
2172 fmt::format_to(dst,
"{}",
int(value));
2176 const uchar value = *
reinterpret_cast<const uchar *
>(current_data);
2177 fmt::format_to(dst,
"{}",
int(value));
2181 fmt::format_to(dst,
"{}", *
reinterpret_cast<const int8_t *
>(current_data));
2185 fmt::format_to(dst,
"{}", *
reinterpret_cast<const short *
>(current_data));
2189 fmt::format_to(dst,
"{}", *
reinterpret_cast<const ushort *
>(current_data));
2193 fmt::format_to(dst,
"{}", *
reinterpret_cast<const int *
>(current_data));
2197 fmt::format_to(dst,
"{}", *
reinterpret_cast<const float *
>(current_data));
2201 fmt::format_to(dst,
"{}", *
reinterpret_cast<const double *
>(current_data));
2205 fmt::format_to(dst,
"{}", *
reinterpret_cast<const int64_t *
>(current_data));
2209 fmt::format_to(dst,
"{}", *
reinterpret_cast<const uint64_t *
>(current_data));
2217 fmt::format_to(dst,
" ");
2219 fmt::format_to(dst,
"\n");
2223 for ([[maybe_unused]]
const int elem_i :
IndexRange(member_array_len)) {
2225 fmt::format_to(dst,
" {}", *
reinterpret_cast<const void *
const *
>(current_data));
2227 fmt::format_to(dst,
"\n");
2238 const int struct_id,
2239 const void *initial_data,
2240 const void *address,
2242 std::ostream &stream)
2246 fmt::memory_buffer buf;
2247 fmt::appender dst{buf};
2250 fmt::format_to(dst,
"<{}> {}x at {}\n", struct_name, element_num, address);
2253 stream << fmt::to_string(buf);
#define BLI_assert_unreachable()
#define BLI_STATIC_ASSERT(a, msg)
#define BLI_assert_msg(a, msg)
BLI_INLINE void BLI_endian_switch_int32(int *val) ATTR_NONNULL(1)
void BLI_endian_switch_int32_array(int *val, int size) ATTR_NONNULL(1)
void BLI_endian_switch_uint64_array(uint64_t *val, int size) ATTR_NONNULL(1)
void BLI_endian_switch_int64_array(int64_t *val, int size) ATTR_NONNULL(1)
void BLI_endian_switch_int16_array(short *val, int size) ATTR_NONNULL(1)
BLI_INLINE void BLI_endian_switch_int16(short *val) ATTR_NONNULL(1)
void * BLI_ghash_lookup_default(const GHash *gh, const void *key, void *val_default) ATTR_WARN_UNUSED_RESULT
void ** BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_str_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
#define BLI_MEMARENA_STD_BUFSIZE
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define POINTER_OFFSET(v, ofs)
blenloader genfile private function prototypes
const struct SDNA * DNA_sdna_current_get(void)
const unsigned char DNAstr[]
int DNA_struct_find_index_without_alias(const struct SDNA *sdna, const char *str)
#define SDNA_RAW_DATA_STRUCT_INDEX
struct SDNA_Struct SDNA_Struct
Read Guarded memory(de)allocation.
BMesh const char void * data
unsigned long long int uint64_t
bool DNA_struct_member_exists_with_alias(const SDNA *sdna, const char *stype, const char *vartype, const char *name)
static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error_message)
static void print_reconstruct_step(const ReconstructStep *step, const SDNA *oldsdna, const SDNA *newsdna)
static void reconstruct_struct(const DNA_ReconstructInfo *reconstruct_info, const int new_struct_index, const char *old_block, char *new_block)
static void reconstruct_structs(const DNA_ReconstructInfo *reconstruct_info, const int blocks, const int old_struct_index, const int new_struct_index, const char *old_blocks, char *new_blocks)
int DNA_struct_find_index_without_alias_ex(const SDNA *sdna, const char *str, uint *struct_index_last)
const char * DNA_struct_identifier(SDNA *sdna, const int struct_index)
void DNA_sdna_current_free()
int DNA_struct_find_with_alias(const SDNA *sdna, const char *str)
SDNA * DNA_sdna_from_data(const void *data, const int data_len, bool do_endian_swap, bool data_alloc, const bool do_alias, const char **r_error_message)
DNA_ReconstructInfo * DNA_reconstruct_info_create(const SDNA *oldsdna, const SDNA *newsdna, const char *compare_flags)
@ RECONSTRUCT_STEP_CAST_POINTER_TO_32
@ RECONSTRUCT_STEP_CAST_POINTER_TO_64
@ RECONSTRUCT_STEP_INIT_ZERO
@ RECONSTRUCT_STEP_SUBSTRUCT
@ RECONSTRUCT_STEP_CAST_PRIMITIVE
@ RECONSTRUCT_STEP_MEMCPY
int DNA_elem_type_size(const eSDNA_Type elem_nr)
static bool ispointer(const char *name)
static bool DNA_sdna_patch_struct_member(SDNA *sdna, const int struct_index, const char *old_member_name, const char *new_member_name)
int DNA_struct_member_size(const SDNA *sdna, short type, short member_index)
static bool elem_exists_impl(const char **types, const char **names, const char *type, const char *name, const SDNA_Struct *old)
static bool DNA_sdna_patch_struct(SDNA *sdna, const int struct_index, const char *new_type_name)
static int elem_offset_with_alias(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
static void cast_primitive_type(const eSDNA_Type old_type, const eSDNA_Type new_type, const int array_len, const char *old_data, char *new_data)
BLI_INLINE const char * pad_up_4(const char *ptr)
bool DNA_struct_exists_without_alias(const SDNA *sdna, const char *stype)
static void init_reconstruct_step_for_member(const SDNA *oldsdna, const SDNA *newsdna, const char *compare_flags, const SDNA_Struct *old_struct, const SDNA_StructMember *new_member, const int new_member_offset, ReconstructStep *r_step)
static void cast_pointer_64_to_32(const int array_len, const uint64_t *old_data, uint32_t *new_data)
void DNA_struct_switch_endian(const SDNA *sdna, int struct_index, char *data)
static void sdna_expand_names(SDNA *sdna)
static int get_member_size_in_bytes(const SDNA *sdna, const SDNA_StructMember *member)
static int dna_struct_find_index_ex_impl(const char **types, const int, SDNA_Struct **const structs, const int structs_num, const char *str, uint *struct_index_last)
int DNA_struct_alignment(const SDNA *sdna, const int struct_index)
const SDNA * DNA_sdna_current_get()
static const char * dna_sdna_alias_from_static_elem_full(SDNA *sdna, GHash *elem_map_alias_from_static, const char *struct_name_static, const char *elem_static_full)
static bool elem_exists_without_alias(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
#define MAKE_ID(a, b, c, d)
int DNA_struct_size(const SDNA *sdna, int struct_index)
static eStructMemberCategory get_struct_member_category(const SDNA *sdna, const SDNA_StructMember *member)
static bool elem_exists_with_alias(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
static void set_compare_flags_for_struct(const SDNA *oldsdna, const SDNA *newsdna, char *compare_flags, const int old_struct_index)
void DNA_reconstruct_info_free(DNA_ReconstructInfo *reconstruct_info)
int DNA_struct_member_offset_by_name_with_alias(const SDNA *sdna, const char *stype, const char *vartype, const char *name)
static const SDNA_StructMember * find_member_with_matching_name(const SDNA *sdna, const SDNA_Struct *struct_info, const char *name, int *r_offset)
static ReconstructStep * create_reconstruct_steps_for_struct(const SDNA *oldsdna, const SDNA *newsdna, const char *compare_flags, const SDNA_Struct *old_struct, const SDNA_Struct *new_struct)
const char * DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna)
static int elem_offset_without_alias(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
void DNA_sdna_alias_data_ensure(SDNA *sdna)
static int elem_offset_impl(const SDNA *sdna, const char **types, const char **names, const char *type, const char *name, const SDNA_Struct *old)
@ STRUCT_MEMBER_CATEGORY_STRUCT
@ STRUCT_MEMBER_CATEGORY_POINTER
@ STRUCT_MEMBER_CATEGORY_PRIMITIVE
static void cast_pointer_32_to_64(const int array_len, const uint32_t *old_data, uint64_t *new_data)
bool DNA_sdna_patch_struct_member_by_name(SDNA *sdna, const char *type_name, const char *old_member_name, const char *new_member_name)
void DNA_sdna_free(SDNA *sdna)
static bool elem_streq(const char *name, const char *oname)
void * DNA_struct_reconstruct(const DNA_ReconstructInfo *reconstruct_info, int old_struct_index, int blocks, const void *old_blocks, const char *alloc_name)
bool DNA_struct_exists_with_alias(const SDNA *sdna, const char *str)
void DNA_sdna_current_init()
void DNA_sdna_alias_data_ensure_structs_map(SDNA *sdna)
int DNA_struct_find_index_with_alias_ex(const SDNA *sdna, const char *str, uint *struct_index_last)
int DNA_struct_member_offset_by_name_without_alias(const SDNA *sdna, const char *stype, const char *vartype, const char *name)
bool DNA_struct_member_exists_without_alias(const SDNA *sdna, const char *stype, const char *vartype, const char *name)
static int compress_reconstruct_steps(ReconstructStep *steps, const int old_step_count)
int DNA_struct_find_index_without_alias(const SDNA *sdna, const char *str)
bool DNA_sdna_patch_struct_by_name(SDNA *sdna, const char *old_type_name, const char *new_type_name)
const char * DNA_struct_rename_legacy_hack_static_from_alias(const char *name)
const char * DNA_struct_rename_legacy_hack_alias_from_static(const char *name)
int DNA_member_array_num(const char *str)
bool DNA_member_id_match(const char *member_id, const int member_id_len, const char *member_full, uint *r_member_full_offset)
uint DNA_member_id_offset_start(const char *member_full)
uint DNA_member_id_strip_copy(char *member_id_dst, const char *member_full_src)
char * DNA_member_id_rename(MemArena *mem_arena, const char *member_id_src, const int member_id_src_len, const char *member_id_dst, const int member_id_dst_len, const char *member_full_src, const int member_full_src_len, const uint member_full_src_offset_len)
@ DNA_RENAME_ALIAS_FROM_STATIC
void DNA_alias_maps(enum eDNA_RenameDir version_dir, struct GHash **r_type_map, struct GHash **r_member_map)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define MEM_recallocN(vmemh, len)
GHash * type_map_alias_from_static
GHash * member_map_alias_from_static
void * MEM_mallocN(size_t len, const char *str)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void *(* MEM_calloc_arrayN_aligned)(size_t len, size_t size, size_t alignment, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
static void print_struct_array_recursive(const SDNA &sdna, const SDNA_Struct &sdna_struct, const void *initial_data, const int64_t element_num, const int indent, fmt::appender &dst)
static bool char_array_startswith_simple_name(const char *data, const int array_len)
static void print_single_struct_recursive(const SDNA &sdna, const SDNA_Struct &sdna_struct, const void *initial_data, const int indent, fmt::appender &dst)
void print_struct_by_id(int struct_id, const void *data)
void print_structs_at_address(const SDNA &sdna, int struct_id, const void *data, const void *address, int64_t element_num, std::ostream &stream)
MatBase< float, 4, 4 > float4x4
const char * compare_flags
struct ReconstructStep::@332110250224351340114004343245205211200320137365::@350114174017351317045101150024117026004004302312 memcpy
struct ReconstructStep::@332110250224351340114004343245205211200320137365::@332334340307002171224027040005067310015115145047 cast_primitive
union ReconstructStep::@332110250224351340114004343245205211200320137365 data
eReconstructStepType type
struct ReconstructStep::@332110250224351340114004343245205211200320137365::@237213150310236005216075265033176306357004203276 substruct
struct ReconstructStep::@332110250224351340114004343245205211200320137365::@370367163343105027161022040014030035137310377010 cast_pointer
SDNA_StructMember members[]
struct GHash * types_to_structs_map
struct MemArena * mem_arena
struct SDNA::@167207020263072271112041172377010264047103154346 alias
short * members_array_num