diff options
author | Bastien Montagne <bastien@blender.org> | 2021-02-25 12:17:31 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-02-25 13:39:10 +0300 |
commit | de25b79ff5c4da7d2d604eaa33b8c520c246679b (patch) | |
tree | cf5f47ff016802ca3c90171d290ad0a2edb9a361 /source/blender/blenkernel/BKE_idtype.h | |
parent | b5d39f9b469e6a1688bb4498f6635bd5e23a35ef (diff) |
Refactor: IDTypeInfo: Add `owner_get` to get owner of embedded IDs.
This concerns currently only collections (`master_collection` of scenes)
and root node trees. It removes the matching type-specific helpers
(`BKE_collection_master_scene_search` and `BKE_node_tree_find_owner_ID`).
No functional change expected here.
NOTE: Current implementation of `owner_get` is far from optimal, we
could probably do it better, see {T69169}.
NOTE: While it could also have it, shapekeys IDTypeInfo was left out of
this change for now. Mainly because it sould not be used currently, and
we ultimately want to demote shape keys from ID status anyway.
Diffstat (limited to 'source/blender/blenkernel/BKE_idtype.h')
-rw-r--r-- | source/blender/blenkernel/BKE_idtype.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index edfc96f3059..4578f1c3ca5 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -95,6 +95,8 @@ typedef void (*IDTypeForeachCacheFunction)(struct ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data); +typedef struct ID *(*IDTypeEmbeddedOwnerGetFunction)(struct Main *bmain, struct ID *id); + typedef void (*IDTypeBlendWriteFunction)(struct BlendWriter *writer, struct ID *id, const void *id_address); @@ -181,6 +183,11 @@ typedef struct IDTypeInfo { */ IDTypeForeachCacheFunction foreach_cache; + /** + * For embedded IDs, return their owner ID. + */ + IDTypeEmbeddedOwnerGetFunction owner_get; + /* ********** Callbacks for reading and writing .blend files. ********** */ /** |