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.
This commit is contained in:
parent
987c3a3e22
commit
3dd9ab341a
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue