Commit: 4d8c66ddc16aed0b7ad55cb30dcb0ae54e7847af
Author: Lukas Tönne
Date: Wed Feb 25 16:59:51 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB4d8c66ddc16aed0b7ad55cb30dcb0ae54e7847af
Take NULL object pointers in cache items into account.
This can happen if an object gets deleted or isn't loaded for some
reason. The item should just be ignored in that case and removed at the
next opportunity (cleanup function).
===================================================================
M source/blender/blenkernel/intern/cache_library.c
M source/blender/pointcache/PTC_api.cpp
===================================================================
diff --git a/source/blender/blenkernel/intern/cache_library.c
b/source/blender/blenkernel/intern/cache_library.c
index 7a02897..2a4956f 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -302,7 +302,8 @@ static unsigned int cache_item_hash(const void *key)
hash = BLI_ghashutil_inthash(item->type);
- hash = hash_int_2d(hash, BLI_ghashutil_ptrhash(item->ob));
+ if (item->ob)
+ hash = hash_int_2d(hash, BLI_ghashutil_ptrhash(item->ob));
if (item->index >= 0)
hash = hash_int_2d(hash, BLI_ghashutil_inthash(item->index));
@@ -458,9 +459,7 @@ void BKE_cache_library_group_update(Main *bmain,
CacheLibrary *cachelib)
for (item = cachelib->items.first; item; item = item_next) {
item_next = item->next;
- BLI_assert(item->ob != NULL);
-
- if (!(item->ob->id.flag & LIB_DOIT)) {
+ if (!item->ob || !(item->ob->id.flag & LIB_DOIT)) {
BKE_cache_library_remove_item(cachelib, item);
}
}
diff --git a/source/blender/pointcache/PTC_api.cpp
b/source/blender/pointcache/PTC_api.cpp
index a5155a2..b57aa74 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -367,7 +367,7 @@ PTCWriterArchive *PTC_cachelib_writers(Scene *scene,
CacheLibrary *cachelib, Lis
for (CacheItem *item = (CacheItem *)cachelib->items.first; item; item =
item->next) {
char name[2*MAX_NAME];
- if (!(item->flag & CACHE_ITEM_ENABLED))
+ if (!item->ob || !(item->flag & CACHE_ITEM_ENABLED))
continue;
BKE_cache_item_name(item->ob, item->type, item->index, name);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs