From 762d93a26b973b61ef52e7326aa8f272ccbe7007 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 29 Sep 2020 12:12:09 +0200 Subject: DNA: use better type for SDNA->structs The data layout remains exactly the same.. This change just gives all the elements in `SDNA->structs` names, making it more comfortable to work with the data. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D8926 --- source/blender/blenloader/intern/readblenentry.c | 4 ++-- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/blenloader/intern/writefile.c | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'source/blender/blenloader/intern') diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 888863dda06..7a527b82e9f 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -103,8 +103,8 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) break; } - const short *sp = fd->filesdna->structs[bhead->SDNAnr]; - const char *name = fd->filesdna->types[sp[0]]; + const SDNA_Struct *struct_info = fd->filesdna->structs[bhead->SDNAnr]; + const char *name = fd->filesdna->types[struct_info->type]; char buf[4]; buf[0] = (bhead->code >> 24) & 0xFF; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2b68c5ea203..19fab73b259 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2133,7 +2133,7 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead) char *data; data = (char *)(bhead + 1); - blocksize = filesdna->types_size[filesdna->structs[bhead->SDNAnr][0]]; + blocksize = filesdna->types_size[filesdna->structs[bhead->SDNAnr]->type]; nblocks = bhead->nr; while (nblocks--) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 336276bdd40..74a4ddfd8f3 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -539,7 +539,6 @@ static void writestruct_at_address_nr( WriteData *wd, int filecode, const int struct_nr, int nr, const void *adr, const void *data) { BHead bh; - const short *sp; BLI_assert(struct_nr > 0 && struct_nr < SDNA_TYPE_MAX); @@ -553,9 +552,9 @@ static void writestruct_at_address_nr( bh.nr = nr; bh.SDNAnr = struct_nr; - sp = wd->sdna->structs[bh.SDNAnr]; + const SDNA_Struct *struct_info = wd->sdna->structs[bh.SDNAnr]; - bh.len = nr * wd->sdna->types_size[sp[0]]; + bh.len = nr * wd->sdna->types_size[struct_info->type]; if (bh.len == 0) { return; -- cgit v1.2.3