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 | |
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')
-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 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_collections.cc | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_path.cc | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 2 |
9 files changed, 11 insertions, 16 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; diff --git a/source/blender/editors/space_outliner/outliner_collections.cc b/source/blender/editors/space_outliner/outliner_collections.cc index b56c7548386..0ded4654c80 100644 --- a/source/blender/editors/space_outliner/outliner_collections.cc +++ b/source/blender/editors/space_outliner/outliner_collections.cc @@ -380,7 +380,7 @@ void outliner_collection_delete( const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(&parent->id); BLI_assert(id_type->owner_get != nullptr); - ID *scene_owner = id_type->owner_get(bmain, &parent->id, nullptr); + ID *scene_owner = id_type->owner_get(&parent->id); BLI_assert(GS(scene_owner->name) == ID_SCE); if (ID_IS_LINKED(scene_owner) || ID_IS_OVERRIDE_LIBRARY(scene_owner)) { skip = true; @@ -613,7 +613,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op) const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(&parent->id); BLI_assert(id_type->owner_get != nullptr); - Scene *scene_owner = (Scene *)id_type->owner_get(bmain, &parent->id, nullptr); + Scene *scene_owner = (Scene *)id_type->owner_get(&parent->id); BLI_assert(scene_owner != nullptr); BLI_assert(GS(scene_owner->id.name) == ID_SCE); diff --git a/source/blender/makesrna/intern/rna_path.cc b/source/blender/makesrna/intern/rna_path.cc index 72416401344..4f5e852a12c 100644 --- a/source/blender/makesrna/intern/rna_path.cc +++ b/source/blender/makesrna/intern/rna_path.cc @@ -944,7 +944,7 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path) BLI_assert_msg(0, "Missing handling of embedded id type."); return id; } - return id_type->owner_get(bmain, id, nullptr); + return id_type->owner_get(id); } static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_real_id) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bedf823656a..61eb2a11c02 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1483,7 +1483,7 @@ static void rna_ImageFormatSettings_color_management_set(PointerRNA *ptr, int va if (owner_id && GS(owner_id->name) == ID_NT) { /* For compositing nodes, find the corresponding scene. */ const IDTypeInfo *type_info = BKE_idtype_get_info_from_id(owner_id); - owner_id = type_info->owner_get(G_MAIN, owner_id, NULL); + owner_id = type_info->owner_get(owner_id); } if (owner_id && GS(owner_id->name) == ID_SCE) { BKE_image_format_color_management_copy_from_scene(imf, (Scene *)owner_id); |