From 39cd872acbcc913f9df4f6620680a2e7f89c5098 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 13 Nov 2018 17:51:58 +0100 Subject: Add function to query whether object has any point cache --- source/blender/blenkernel/BKE_pointcache.h | 5 +++++ source/blender/blenkernel/intern/pointcache.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 7456a4bfb15..f13f84e4eb2 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -293,6 +293,11 @@ PTCacheID BKE_ptcache_id_find(struct Object *ob, struct Scene *scene, struct Poi void BKE_ptcache_ids_from_object( struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis); +/****************** Query funcs ****************************/ + +/* Check whether object has a point cache. */ +bool BKE_ptcache_object_has(struct Scene *scene, struct Object *ob, int duplis); + /***************** Global funcs ****************************/ void BKE_ptcache_remove(void); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 60defc575f4..0dc192db8f0 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1829,6 +1829,18 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup scene, ob, duplis, ptcache_ids_from_object_cb, &data); } +static bool ptcache_object_has_cb(PTCacheID *UNUSED(pid), + void *UNUSED(userdata)) +{ + return false; +} + +bool BKE_ptcache_object_has(struct Scene *scene, struct Object *ob, int duplis) +{ + return !foreach_object_ptcache( + scene, ob, duplis, ptcache_object_has_cb, NULL); +} + /* File handling */ static const char *ptcache_file_extension(const PTCacheID *pid) -- cgit v1.2.3