22#include <fmt/format.h>
121#define MAKE_ID(a, b, c, d) (int(d) << 24 | int(c) << 16 | (b) << 8 | (a))
169 return (
name[0] ==
'*' || (
name[0] ==
'(' &&
name[1] ==
'*'));
174 const char *cp = sdna->
members[member_index];
191static void printstruct(
SDNA *sdna,
short struct_index)
196 printf(
"struct %s\n", sdna->
types[struct_info->type]);
198 for (
int b = 0;
b < struct_info->members_len;
b++) {
200 printf(
" %s %s\n", sdna->
types[struct_member->type], sdna->names[struct_member->name]);
219 uint *struct_index_last)
224 return *struct_index_last;
231 if (struct_index_p) {
233 *struct_index_last = struct_index;
239 for (
int struct_index = 0; struct_index <
types_num; struct_index++) {
242 *struct_index_last = struct_index;
253 uint *struct_index_last)
314 return (
const char *)((uintptr_t(
ptr) + 3) & ~3);
322 int member_index_gravity_fix = -1;
327 sdna->
types =
nullptr;
345 *r_error_message =
"SDNA error in SDNA file";
364 *r_error_message =
"NAME error in SDNA file";
369 for (
int member_index = 0; member_index < sdna->
members_num; member_index++) {
370 sdna->
members[member_index] = cp;
375 if (*cp ==
'[' &&
STREQ(cp,
"[3]")) {
376 if (member_index &&
STREQ(sdna->
members[member_index - 1],
"Cvi")) {
377 sdna->
members[member_index] =
"gravity[3]";
378 member_index_gravity_fix = member_index;
401 *r_error_message =
"TYPE error in SDNA file";
406 for (
int type_index = 0; type_index < sdna->
types_num; type_index++) {
429 *r_error_message =
"TLEN error in SDNA file";
449 *r_error_message =
"STRC error in SDNA file";
456 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
459 sdna->
structs[struct_index] = struct_info;
462 *r_error_message =
"Invalid duplicate struct type index in SDNA file";
471 if (member_index_gravity_fix > -1) {
472 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
473 sp = (
short *)sdna->
structs[struct_index];
474 if (
STREQ(sdna->
types[sp[0]],
"ClothSimSettings")) {
486 for (intptr_t struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
506 *r_error_message =
"ListBase struct error! Not found.";
516 *r_error_message =
"ListBase struct error: invalid computed pointer-size.";
524 for (
int member_index = 0; member_index < sdna->
members_num; member_index++) {
531 for (
int type_index = 0; type_index < sdna->
types_num; type_index++) {
532 sdna->
types_alignment[type_index] = int(__STDCPP_DEFAULT_NEW_ALIGNMENT__);
537 uint dummy_index = 0;
539 sdna,
"mat4x4f", &dummy_index);
540 if (mat4x4f_struct_index > 0) {
542 const int mat4x4f_type_index = struct_info->
type_index;
554 const char **r_error_message)
557 const char *error_message =
nullptr;
562 memcpy(data_copy,
data, data_len);
563 sdna->
data = data_copy;
566 sdna->
data =
static_cast<const char *
>(
data);
577 if (r_error_message ==
nullptr) {
578 fprintf(stderr,
"Error decoding blend file SDNA: %s\n", error_message);
581 *r_error_message = error_message;
623 const int old_struct_index)
634 if (new_struct_index == -1) {
653 for (
int member_index = 0; member_index < old_struct->
members_num; member_index++) {
659 if (!
STREQ(old_type_name, new_type_name)) {
667 if (!
STREQ(old_member_name, new_member_name)) {
684 if (old_member_struct_index >= 0) {
701 printf(
"error: file without SDNA\n");
709 for (
int old_struct_index = 0; old_struct_index < oldsdna->
structs_num; old_struct_index++) {
742 for (
int a = 0; a < oldsdna->structs_len; a++) {
745 printf(
"changed: %s\n", oldsdna->
types[struct_info->type]);
750 return compare_flags;
768 const char *old_data,
775 double old_value_f = 0.0;
780 for (
int a = 0; a < array_len; a++) {
783 const char value = *old_data;
785 old_value_f = double(value);
789 const uchar value = *
reinterpret_cast<const uchar *
>(old_data);
791 old_value_f = double(value);
795 const short value = *
reinterpret_cast<const short *
>(old_data);
797 old_value_f = double(value);
801 const ushort value = *
reinterpret_cast<const ushort *
>(old_data);
803 old_value_f = double(value);
807 const int value = *
reinterpret_cast<const int *
>(old_data);
809 old_value_f = double(value);
813 const float value = *
reinterpret_cast<const float *
>(old_data);
820 const double value = *
reinterpret_cast<const double *
>(old_data);
827 const int64_t value = *
reinterpret_cast<const int64_t *
>(old_data);
829 old_value_f = double(value);
835 old_value_f = double(value);
839 const int8_t value = *
reinterpret_cast<const int8_t *
>(old_data);
841 old_value_f = double(value);
845 BLI_assert_msg(
false,
"Conversion from SDNA_TYPE_RAW_DATA is not supported");
851 *new_data = char(old_value_i);
854 *
reinterpret_cast<uchar *
>(new_data) =
uchar(old_value_i);
857 *
reinterpret_cast<short *
>(new_data) =
short(old_value_i);
860 *
reinterpret_cast<ushort *
>(new_data) =
ushort(old_value_i);
863 *
reinterpret_cast<int *
>(new_data) =
int(old_value_i);
867 old_value_f /= 255.0;
869 *
reinterpret_cast<float *
>(new_data) = old_value_f;
873 old_value_f /= 255.0;
875 *
reinterpret_cast<double *
>(new_data) = old_value_f;
881 *
reinterpret_cast<uint64_t *
>(new_data) = old_value_i;
884 *
reinterpret_cast<int8_t *
>(new_data) = int8_t(old_value_i);
887 BLI_assert_msg(
false,
"Conversion to SDNA_TYPE_RAW_DATA is not supported");
897 const uint32_t *old_data,
900 for (
int a = 0; a < array_len; a++) {
901 new_data[a] = old_data[a];
912 for (
int a = 0; a < array_len; a++) {
913 new_data[a] = old_data[a] >> 3;
925 if (
name[a] != oname[a]) {
928 if (
name[a] ==
'[' || oname[a] ==
'[') {
931 if (
name[a] == 0 || oname[a] == 0) {
964 return STREQ(type, otype);
1019 if (
STREQ(type, otype)) {
1092 return type_size * array_length;
1145 const int old_struct_index,
1146 const int new_struct_index,
1147 const char *old_blocks,
1160 const int new_struct_index,
1161 const char *old_block,
1165 const int step_count = reconstruct_info->
step_counts[new_struct_index];
1168 for (
int a = 0; a < step_count; a++) {
1170 switch (
step->type) {
1172 memcpy(new_block +
step->data.memcpy.new_offset,
1173 old_block +
step->data.memcpy.old_offset,
1174 step->data.memcpy.size);
1178 step->data.cast_primitive.new_type,
1179 step->data.cast_primitive.array_len,
1180 old_block +
step->data.cast_primitive.old_offset,
1181 new_block +
step->data.cast_primitive.new_offset);
1185 (
const uint64_t *)(old_block +
step->data.cast_pointer.old_offset),
1186 (uint32_t *)(new_block +
step->data.cast_pointer.new_offset));
1190 (
const uint32_t *)(old_block +
step->data.cast_pointer.old_offset),
1191 (
uint64_t *)(new_block +
step->data.cast_pointer.new_offset));
1195 step->data.substruct.array_len,
1196 step->data.substruct.old_struct_index,
1197 step->data.substruct.new_struct_index,
1198 old_block +
step->data.substruct.old_offset,
1199 new_block +
step->data.substruct.new_offset);
1214 const int old_struct_index,
1215 const int new_struct_index,
1216 const char *old_blocks,
1225 for (
int a = 0; a < blocks; a++) {
1226 const char *old_block = old_blocks + a * old_block_size;
1227 char *new_block = new_blocks + a * new_block_size;
1233 int old_struct_index,
1235 const void *old_blocks,
1236 const char *alloc_name)
1245 if (new_struct_index == -1) {
1253 char *new_blocks =
static_cast<char *
>(
1259 static_cast<const char *
>(old_blocks),
1271 for (
int a = 0; a < struct_info->
members_num; a++) {
1285 const SDNA *newsdna,
1286 const char *compare_flags,
1289 const int new_member_offset,
1294 int old_member_offset;
1297 oldsdna, old_struct, new_name, &old_member_offset);
1299 if (old_member ==
nullptr) {
1309 if (new_category != old_category) {
1318 const int shared_array_length = std::min(new_array_length, old_array_length);
1323 switch (new_category) {
1325 if (
STREQ(new_type_name, old_type_name)) {
1329 compare_flags[old_struct_index]);
1337 shared_array_length;
1361 if (
STREQ(new_type_name, old_type_name)) {
1367 shared_array_length;
1413 const SDNA *oldsdna,
1414 const SDNA *newsdna)
1416 switch (
step->type) {
1418 printf(
"initialize zero");
1422 printf(
"memcpy, size: %d, old offset: %d, new offset: %d",
1423 step->data.memcpy.size,
1424 step->data.memcpy.old_offset,
1425 step->data.memcpy.new_offset);
1430 "cast element, old type: %d ('%s'), new type: %d ('%s'), old offset: %d, new offset: "
1432 int(
step->data.cast_primitive.old_type),
1433 oldsdna->
types[
step->data.cast_primitive.old_type],
1434 int(
step->data.cast_primitive.new_type),
1435 newsdna->
types[
step->data.cast_primitive.new_type],
1436 step->data.cast_primitive.old_offset,
1437 step->data.cast_primitive.new_offset,
1438 step->data.cast_primitive.array_len);
1442 printf(
"pointer to 32, old offset: %d, new offset: %d, length: %d",
1443 step->data.cast_pointer.old_offset,
1444 step->data.cast_pointer.new_offset,
1445 step->data.cast_pointer.array_len);
1449 printf(
"pointer to 64, old offset: %d, new offset: %d, length: %d",
1450 step->data.cast_pointer.old_offset,
1451 step->data.cast_pointer.new_offset,
1452 step->data.cast_pointer.array_len);
1457 "substruct, old offset: %d, new offset: %d, new struct: %d ('%s', size per struct: %d), "
1459 step->data.substruct.old_offset,
1460 step->data.substruct.new_offset,
1461 step->data.substruct.new_struct_index,
1464 step->data.substruct.array_len);
1475 const SDNA *newsdna,
1476 const char *compare_flags,
1482 int new_member_offset = 0;
1483 for (
int new_member_index = 0; new_member_index < new_struct->
members_num; new_member_index++) {
1491 &steps[new_member_index]);
1501 int new_step_count = 0;
1502 for (
int a = 0; a < old_step_count; a++) {
1504 switch (
step->type) {
1509 if (new_step_count > 0) {
1515 step->data.memcpy.old_offset &&
1517 step->data.memcpy.new_offset)
1524 steps[new_step_count] = *
step;
1533 steps[new_step_count] = *
step;
1538 return new_step_count;
1542 const SDNA *newsdna,
1543 const char *compare_flags)
1546 reconstruct_info->
oldsdna = oldsdna;
1547 reconstruct_info->
newsdna = newsdna;
1554 for (
int new_struct_index = 0; new_struct_index < newsdna->
structs_num; new_struct_index++) {
1558 if (old_struct_index < 0) {
1559 reconstruct_info->
steps[new_struct_index] =
nullptr;
1560 reconstruct_info->
step_counts[new_struct_index] = 0;
1565 oldsdna, newsdna, compare_flags, old_struct, new_struct);
1570 reconstruct_info->
steps[new_struct_index] = steps;
1571 reconstruct_info->
step_counts[new_struct_index] = steps_len;
1575 printf(
"%s: \n", new_struct_name);
1576 for (
int a = 0; a < steps_len; a++) {
1584 return reconstruct_info;
1589 for (
int new_struct_index = 0; new_struct_index < reconstruct_info->
newsdna->
structs_num;
1592 if (reconstruct_info->
steps[new_struct_index] !=
nullptr) {
1603 const char *vartype,
1614 const char *vartype,
1630 const char *vartype,
1635 if (struct_index != -1) {
1648 const char *vartype,
1683 BLI_assert_msg(
false,
"Operations on the size of SDNA_TYPE_RAW_DATA is not supported");
1711#ifdef WITH_DNA_GHASH
1721 const char *old_type_name,
1722 const char *new_type_name)
1725 if (struct_index != -1) {
1733 const int struct_index,
1734 const char *old_member_name,
1735 const char *new_member_name)
1740 const int old_member_name_len = strlen(old_member_name);
1741 const int new_member_name_len = strlen(new_member_name);
1744 for (
int struct_member_index = struct_info->
members_num; struct_member_index > 0;
1745 struct_member_index--)
1750 uint old_member_name_full_offset_start;
1752 old_member_name_len,
1753 old_member_name_full,
1754 &old_member_name_full_offset_start))
1761 old_member_name_len,
1763 new_member_name_len,
1764 old_member_name_full,
1765 strlen(old_member_name_full),
1766 old_member_name_full_offset_start);
1776 const short old_member_index = member_info->
member_index;
1788 const char *type_name,
1789 const char *old_member_name,
1790 const char *new_member_name)
1793 if (struct_index != -1) {
1815 int names_expand_len = 0;
1816 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
1823 int names_expand_index = 0;
1824 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
1831 memcpy(struct_new, struct_old, array_size);
1832 sdna->
structs[struct_index] = struct_new;
1839 names_array_len_expand[names_expand_index] =
1844 names_expand_index++;
1857 GHash *elem_map_alias_from_static,
1858 const char *struct_name_static,
1859 const char *elem_static_full)
1861 const int elem_static_full_len = strlen(elem_static_full);
1862 char *elem_static =
static_cast<char *
>(alloca(elem_static_full_len + 1));
1864 const char *str_pair[2] = {struct_name_static, elem_static};
1865 const char *elem_alias =
static_cast<const char *
>(
1874 elem_static_full_len,
1887 const bool use_legacy_hack =
true;
1901 for (
int type_index = 0; type_index < sdna->
types_num; type_index++) {
1902 const char *type_name_static = sdna->
types[type_index];
1904 if (use_legacy_hack) {
1916 for (
int struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
1918 const char *struct_name_static = sdna->
types[struct_info->
type_index];
1920 if (use_legacy_hack) {
1924 for (
int a = 0; a < struct_info->
members_num; a++) {
1931 if (member_alias_full !=
nullptr) {
1951#ifdef WITH_DNA_GHASH
1954 for (intptr_t struct_index = 0; struct_index < sdna->
structs_num; struct_index++) {
1972 const SDNA_Struct &sdna_struct = *sdna.structs[struct_i];
1973 StructInfo &struct_info = structs_[struct_i];
1975 struct_info.size_in_bytes = 0;
1976 for (const int member_i : IndexRange(sdna_struct.members_num)) {
1977 struct_info.size_in_bytes += get_member_size_in_bytes(&sdna_,
1978 &sdna_struct.members[member_i]);
1981 this->gather_pointer_members_recursive(sdna_struct, 0, structs_[struct_i]);
1985void PointersInDNA::gather_pointer_members_recursive(
const SDNA_Struct &sdna_struct,
1987 StructInfo &r_struct_info)
const
1989 int offset = initial_offset;
1992 const char *member_type_name = sdna_.types[member.
type_index];
1994 const int array_elem_num = sdna_.members_array_num[member.
member_index];
1997 for (
int elem_i = 0; elem_i < array_elem_num; elem_i++) {
1998 const char *member_name = sdna_.members[member.
member_index];
1999 r_struct_info.pointers.append(
2000 {offset + elem_i * sdna_.pointer_size, member_type_name, member_name});
2005 const SDNA_Struct &sub_sdna_struct = *sdna_.structs[substruct_i];
2006 int substruct_size = sdna_.types_size[member.
type_index];
2007 for (
int elem_i = 0; elem_i < array_elem_num; elem_i++) {
2008 this->gather_pointer_members_recursive(
2009 sub_sdna_struct, offset + elem_i * substruct_size, r_struct_info);
2025namespace blender::dna {
2029 const void *initial_data,
2032 fmt::appender &dst);
2035 const void *initial_data,
2037 fmt::appender &dst);
2044 const int string_length = strnlen(
data, array_len);
2045 if (string_length == array_len) {
2053 if (!std::isprint(c)) {
2067 if (element_num == 1) {
2076 fmt::format_to(dst,
"{:{}}{}: <{}>\n",
"", indent,
i, struct_name);
2083 const void *initial_data,
2088 const void *
data = initial_data;
2097 fmt::format_to(dst,
"{:{}}{} {}:",
"", indent, member_type_name, member_name);
2102 const char *str_data =
static_cast<const char *
>(
data);
2103 fmt::format_to(dst,
" ");
2105 fmt::format_to(dst,
"'{}'", str_data);
2108 for (
const int i :
IndexRange(member_array_len)) {
2109 fmt::format_to(dst,
"{} ",
int(str_data[
i]));
2112 fmt::format_to(dst,
"\n");
2115 switch (member_category) {
2117 fmt::format_to(dst,
"\n");
2121 sdna, sub_sdna_struct,
data, member_array_len, indent + 2, dst);
2125 fmt::format_to(dst,
" ");
2128 for ([[maybe_unused]]
const int elem_i :
IndexRange(member_array_len)) {
2132 const char value = *
reinterpret_cast<const char *
>(current_data);
2133 fmt::format_to(dst,
"{}",
int(value));
2137 const uchar value = *
reinterpret_cast<const uchar *
>(current_data);
2138 fmt::format_to(dst,
"{}",
int(value));
2142 fmt::format_to(dst,
"{}", *
reinterpret_cast<const int8_t *
>(current_data));
2146 fmt::format_to(dst,
"{}", *
reinterpret_cast<const short *
>(current_data));
2150 fmt::format_to(dst,
"{}", *
reinterpret_cast<const ushort *
>(current_data));
2154 fmt::format_to(dst,
"{}", *
reinterpret_cast<const int *
>(current_data));
2158 fmt::format_to(dst,
"{}", *
reinterpret_cast<const float *
>(current_data));
2162 fmt::format_to(dst,
"{}", *
reinterpret_cast<const double *
>(current_data));
2166 fmt::format_to(dst,
"{}", *
reinterpret_cast<const int64_t *
>(current_data));
2170 fmt::format_to(dst,
"{}", *
reinterpret_cast<const uint64_t *
>(current_data));
2178 fmt::format_to(dst,
" ");
2180 fmt::format_to(dst,
"\n");
2184 for ([[maybe_unused]]
const int elem_i :
IndexRange(member_array_len)) {
2186 fmt::format_to(dst,
" {}", *
reinterpret_cast<const void *
const *
>(current_data));
2188 fmt::format_to(dst,
"\n");
2199 const int struct_id,
2200 const void *initial_data,
2201 const void *address,
2203 std::ostream &stream)
2207 fmt::memory_buffer buf;
2208 fmt::appender dst{buf};
2211 fmt::format_to(dst,
"<{}> {}x at {}\n", struct_name, element_num, address);
2214 stream << fmt::to_string(buf);
#define BLI_assert_unreachable()
#define BLI_STATIC_ASSERT(a, msg)
#define BLI_assert_msg(a, msg)
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.
#define MEM_recallocN(vmemh, len)
BMesh const char void * data
unsigned long long int uint64_t
PointersInDNA(const SDNA &sdna)
SDNA * DNA_sdna_from_data(const void *data, const int data_len, bool data_alloc, const bool do_alias, const char **r_error_message)
bool DNA_struct_member_exists_with_alias(const SDNA *sdna, const char *stype, const char *vartype, const char *name)
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)
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)
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)
static bool init_structDNA(SDNA *sdna, const char **r_error_message)
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
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::@070214117165123021005026120246266015116247230365::@351271042175133212223171142267006177214106006367 substruct
union ReconstructStep::@070214117165123021005026120246266015116247230365 data
eReconstructStepType type
struct ReconstructStep::@070214117165123021005026120246266015116247230365::@221247067137127234270352111361234055247370066242 cast_primitive
struct ReconstructStep::@070214117165123021005026120246266015116247230365::@174261126310021233011270100126316371343304103071 cast_pointer
struct ReconstructStep::@070214117165123021005026120246266015116247230365::@344246050342044300060073214144026246245055225201 memcpy
SDNA_StructMember members[]
struct GHash * types_to_structs_map
struct MemArena * mem_arena
struct SDNA::@324261063051035105003300060127223210155361202367 alias
short * members_array_num