From 725a088ef9fce540069b19e9b1346c3d04056f8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 May 2016 01:39:33 +1000 Subject: Correct check for tree being in BVH cache --- source/blender/blenkernel/intern/bvhutils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/blenkernel/intern/bvhutils.c') diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 37392601b4b..88be7328492 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -1162,6 +1162,18 @@ BVHTree *bvhcache_find(BVHCache *cache, int type) return NULL; } +bool bvhcache_has_tree(const BVHCache *cache, const BVHTree *tree) +{ + while (cache) { + const BVHCacheItem *item = cache->link; + if (item->tree == tree) { + return true; + } + cache = cache->next; + } + return false; +} + /** * Inserts a BVHTree of the given type under the cache * After that the caller no longer needs to worry when to free the BVHTree -- cgit v1.2.3