diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-29 13:12:09 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-29 13:12:09 +0300 |
commit | 762d93a26b973b61ef52e7326aa8f272ccbe7007 (patch) | |
tree | 608e44f29ac506d31a12214261b96841534f85b6 /source/blender/makesdna/DNA_sdna_types.h | |
parent | 32d4a67017ecf4af75a9bfde885526550a6534ba (diff) |
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
Diffstat (limited to 'source/blender/makesdna/DNA_sdna_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_sdna_types.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index cfb65860b8e..3af12ae791f 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -26,6 +26,30 @@ struct MemArena; # # +typedef struct SDNA_StructMember { + /** This struct must not change, it's only a convenience view for raw data stored in SDNA. */ + + /** An index into SDNA->types. */ + short type; + /** An index into SDNA->names. */ + short name; +} SDNA_StructMember; + +# +# +typedef struct SDNA_Struct { + /** This struct must not change, it's only a convenience view for raw data stored in SDNA. */ + + /** An index into SDNA->types. */ + short type; + /** The amount of members in this struct. */ + short members_len; + /** "Flexible array member" that contains information about all members of this struct. */ + SDNA_StructMember members[]; +} SDNA_Struct; + +# +# typedef struct SDNA { /** Full copy of 'encoded' data (when data_alloc is set, otherwise borrowed). */ const char *data; @@ -51,14 +75,8 @@ typedef struct SDNA { /** Type lengths. */ short *types_size; - /** - * sp = structs[a] is the address of a struct definition - * sp[0] is struct type number, sp[1] amount of members - * - * (sp[2], sp[3]), (sp[4], sp[5]), .. are the member - * type and name numbers respectively. - */ - short **structs; + /** Information about structs and their members. */ + SDNA_Struct **structs; /** Number of struct types. */ int structs_len; |