diff options
author | Bastien Montagne <bastien@blender.org> | 2022-09-06 19:21:16 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-09-06 19:21:16 +0300 |
commit | 0c242ff72b15fd21d4d2d9af0e3382c9197d4ab5 (patch) | |
tree | 17f0af0a941be6ff1c3f31b1f329fdcdb02673d1 /source/blender/blenkernel | |
parent | e46687c3aacfd69bde83187233e73a8cc6fa5d8d (diff) |
Cleanup: IDManagement: Simplify `owner_get` calllback of IDTypeInfo.
Now that all embedded IDs have a loopback pointer to their owner, we do
need anymore extra parameters for this accessor.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_idtype.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.cc | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 2 |
6 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 95f4c8f6dce..7e2cd87cb0d 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -85,11 +85,7 @@ typedef void (*IDTypeForeachCacheFunction)(struct ID *id, typedef void (*IDTypeForeachPathFunction)(struct ID *id, struct BPathForeachPathData *bpath_data); -/** \param owner_id_hint: If non-NULL, a potential owner of the given embedded ID. Can speed up - * look-up of the owner ID in some cases. */ -typedef struct ID *(*IDTypeEmbeddedOwnerGetFunction)(struct Main *bmain, - struct ID *id, - struct ID *owner_id_hint); +typedef struct ID *(*IDTypeEmbeddedOwnerGetFunction)(struct ID *id); typedef void (*IDTypeBlendWriteFunction)(struct BlendWriter *writer, struct ID *id, diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 9795dafa6b9..b3254794fa7 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -169,7 +169,7 @@ static void collection_foreach_id(ID *id, LibraryForeachIDData *data) } } -static ID *collection_owner_get(Main *bmain, ID *id, ID *UNUSED(owner_id_hint)) +static ID *collection_owner_get(ID *id) { if ((id->flag & LIB_EMBEDDED_DATA) == 0) { return id; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 1abb2416b9f..97269a235c3 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -91,7 +91,7 @@ static void shapekey_foreach_id(ID *id, LibraryForeachIDData *data) BKE_LIB_FOREACHID_PROCESS_ID(data, key->from, IDWALK_CB_LOOPBACK); } -static ID *shapekey_owner_get(Main *UNUSED(bmain), ID *id, ID *UNUSED(owner_id_hint)) +static ID *shapekey_owner_get(ID *id) { Key *key = (Key *)id; diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc index 3c77573dc41..a6f41868453 100644 --- a/source/blender/blenkernel/intern/lib_override.cc +++ b/source/blender/blenkernel/intern/lib_override.cc @@ -105,8 +105,7 @@ BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main *bma if (id_type->owner_get != nullptr) { /* The #IDTypeInfo::owner_get callback should not modify the arguments, so casting away const * is okay. */ - const ID *owner_id = id_type->owner_get( - const_cast<Main *>(bmain), const_cast<ID *>(id), const_cast<ID *>(owner_id_hint)); + const ID *owner_id = id_type->owner_get(const_cast<ID *>(id)); if (r_owner_id != nullptr) { *r_owner_id = owner_id; } @@ -2214,7 +2213,7 @@ static ID *lib_override_library_main_resync_root_get(Main *bmain, ID *id) if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) { const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id); if (id_type->owner_get != nullptr) { - id = id_type->owner_get(bmain, id, nullptr); + id = id_type->owner_get(id); } BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id)); } diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index 38d1a30592d..e51f3c524fa 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -713,7 +713,7 @@ static void lib_query_unused_ids_tag_recurse(Main *bmain, /* Directly 'by-pass' to actual real ID owner. */ const IDTypeInfo *type_info_from = BKE_idtype_get_info_from_id(id_from); BLI_assert(type_info_from->owner_get != NULL); - id_from = type_info_from->owner_get(bmain, id_from, NULL); + id_from = type_info_from->owner_get(id_from); } lib_query_unused_ids_tag_recurse( diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 97512c9a84e..f97e8df4387 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -401,7 +401,7 @@ static void node_foreach_path(ID *id, BPathForeachPathData *bpath_data) } } -static ID *node_owner_get(Main *UNUSED(bmain), ID *id, ID *UNUSED(owner_id_hint)) +static ID *node_owner_get(ID *id) { if ((id->flag & LIB_EMBEDDED_DATA) == 0) { return id; |