diff options
author | Bastien Montagne <bastien@blender.org> | 2022-09-06 10:26:39 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-09-06 17:23:06 +0300 |
commit | 3dd9ab341a0535670e9f6a3b3582bbc86c9b7e6a (patch) | |
tree | 0796e77b1960e703676a2f7a2c8a277d4eb331f6 | |
parent | 987c3a3e220b273b9110aaa5fe28a85a5761a54d (diff) |
IDManagement: better debug checks in `owner_get` callbacks.
Simplify and make more efficients checks in collection one (missed
these in yesterday's commit rBcd49fee74114), add some to ShapeKey's one.
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 7 |
2 files changed, 8 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index e0448afdec6..e77525d0cb7 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -175,20 +175,8 @@ static ID *collection_owner_get(Main *bmain, ID *id, ID *UNUSED(owner_id_hint)) Collection *master_collection = (Collection *)id; BLI_assert((master_collection->flag & COLLECTION_IS_MASTER) != 0); BLI_assert(master_collection->owner_id != NULL); - -#ifndef NDEBUG - bool is_owner_found = false; - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - if (scene->master_collection == master_collection) { - BLI_assert(master_collection->owner_id == &scene->id); - BLI_assert(!is_owner_found); - is_owner_found = true; - } - } - BLI_assert(is_owner_found); -#else - UNUSED_VARS(bmain); -#endif + BLI_assert(GS(master_collection->owner_id->name) == ID_SCE); + BLI_assert(((Scene *)master_collection->owner_id)->master_collection == master_collection); return master_collection->owner_id; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index a09f1e70d06..1abb2416b9f 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -93,7 +93,12 @@ static void shapekey_foreach_id(ID *id, LibraryForeachIDData *data) static ID *shapekey_owner_get(Main *UNUSED(bmain), ID *id, ID *UNUSED(owner_id_hint)) { - return ((Key *)id)->from; + Key *key = (Key *)id; + + BLI_assert(key->from != NULL); + BLI_assert(BKE_key_from_id(key->from) == key); + + return key->from; } static void shapekey_blend_write(BlendWriter *writer, ID *id, const void *id_address) |