diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_idtype.h')
-rw-r--r-- | source/blender/blenkernel/BKE_idtype.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index a823693e126..38322427374 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -47,9 +47,9 @@ enum { }; typedef struct IDCacheKey { - /* The session uuid of the ID owning the cached data. */ + /* The session UUID of the ID owning the cached data. */ unsigned int id_session_uuid; - /* Value uniquely indentifying the cache whithin its ID. + /* Value uniquely identifying the cache within its ID. * Typically the offset of its member in the data-block struct, but can be anything. */ size_t offset_in_ID; /* Actual address of the cached data to save and restore. */ @@ -59,7 +59,7 @@ typedef struct IDCacheKey { uint BKE_idtype_cache_key_hash(const void *key_v); bool BKE_idtype_cache_key_cmp(const void *key_a_v, const void *key_b_v); -/* ********** Prototypes for IDTypeInfo callbacks. ********** */ +/* ********** Prototypes for #IDTypeInfo callbacks. ********** */ typedef void (*IDTypeInitDataFunction)(struct ID *id); @@ -76,9 +76,15 @@ typedef void (*IDTypeMakeLocalFunction)(struct Main *bmain, struct ID *id, const typedef void (*IDTypeForeachIDFunction)(struct ID *id, struct LibraryForeachIDData *data); +typedef enum eIDTypeInfoCacheCallbackFlags { + /** Indicates to the callback that that cache may be stored in the .blend file, so its pointer + * should not be cleared at read-time. */ + IDTYPE_CACHE_CB_FLAGS_PERSISTENT = 1 << 0, +} eIDTypeInfoCacheCallbackFlags; typedef void (*IDTypeForeachCacheFunctionCallback)(struct ID *id, const struct IDCacheKey *cache_key, void **cache_p, + uint flags, void *user_data); typedef void (*IDTypeForeachCacheFunction)(struct ID *id, IDTypeForeachCacheFunctionCallback function_callback, @@ -229,6 +235,14 @@ short BKE_idtype_idcode_from_index(const int index); short BKE_idtype_idcode_iter_step(int *index); +/* Some helpers/wrappers around callbacks defined in #IDTypeInfo, dealing e.g. with embedded IDs. + * XXX Ideally those would rather belong to #BKE_lib_id, but using callback function pointers makes + * this hard to do properly if we want to avoid headers includes in headers. */ + +void BKE_idtype_id_foreach_cache(struct ID *id, + IDTypeForeachCacheFunctionCallback function_callback, + void *user_data); + #ifdef __cplusplus } #endif |