Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-11-13 19:51:58 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-11-14 16:08:39 +0300
commit39cd872acbcc913f9df4f6620680a2e7f89c5098 (patch)
treede85e6e2c3790e41798a5a05e29bd0c5056923e3
parentec2fea733bda8c83ef1e7585ff5d99ce7407fb25 (diff)
Add function to query whether object has any point cache
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h5
-rw-r--r--source/blender/blenkernel/intern/pointcache.c12
2 files changed, 17 insertions, 0 deletions
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)