diff options
author | Jacques Lucke <jacques@blender.org> | 2020-08-28 14:05:48 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-08-28 14:05:48 +0300 |
commit | a443287908248d0b83f490f0993d857fb1d73fec (patch) | |
tree | 10cbbdfd907bceee6b4c09702da1b7e4bd91b30f /source/blender/blenkernel/BKE_idtype.h | |
parent | 346023b457d3da7056210a8dae78e881e1e8820b (diff) |
IDTypeInfo: add .blend file io callbacks
This is part of T76372.
It adds the `blend_write`, `blend_read_data`, `blend_read_lib`
and `blend_read_expand` which correspond to the various
steps when reading and writing .blend files.
Having these callbacks allows us to decentralize the blenloader
code a lot more. This has the affect that code related to any
specific ID type is less scattered.
Reviewers: mont29
Differential Revision: https://developer.blender.org/D8670
Diffstat (limited to 'source/blender/blenkernel/BKE_idtype.h')
-rw-r--r-- | source/blender/blenkernel/BKE_idtype.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index aefba9ef02a..57b005d1a1e 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -34,6 +34,10 @@ extern "C" { struct ID; struct LibraryForeachIDData; struct Main; +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; +struct BlendExpander; /** IDTypeInfo.flags. */ enum { @@ -89,6 +93,13 @@ typedef void (*IDTypeForeachCacheFunction)(struct ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data); +typedef void (*IDTypeBlendWriteFunction)(struct BlendWriter *writer, + struct ID *id, + const void *id_address); +typedef void (*IDTypeBlendReadDataFunction)(struct BlendDataReader *reader, struct ID *id); +typedef void (*IDTypeBlendReadLibFunction)(struct BlendLibReader *reader, struct ID *id); +typedef void (*IDTypeBlendReadExpandFunction)(struct BlendExpander *expander, struct ID *id); + typedef struct IDTypeInfo { /* ********** General IDType data. ********** */ @@ -161,6 +172,26 @@ typedef struct IDTypeInfo { * Iterator over all cache pointers of given ID. */ IDTypeForeachCacheFunction foreach_cache; + + /** + * Write all structs that should be saved in a .blend file. + */ + IDTypeBlendWriteFunction blend_write; + + /** + * Update pointers for all structs directly owned by this data block. + */ + IDTypeBlendReadDataFunction blend_read_data; + + /** + * Update pointers to other id data blocks. + */ + IDTypeBlendReadLibFunction blend_read_lib; + + /** + * Specify which other id data blocks should be loaded when the current one is loaded. + */ + IDTypeBlendReadExpandFunction blend_read_expand; } IDTypeInfo; /* ********** Declaration of each IDTypeInfo. ********** */ |