[Bf-blender-cvs] [39cd872acbc] blender2.8: Add function to query whether object has any point cache

Sergey Sharybin noreply at git.blender.org
Wed Nov 14 14:09:21 CET 2018


Commit: 39cd872acbcc913f9df4f6620680a2e7f89c5098
Author: Sergey Sharybin
Date:   Tue Nov 13 17:51:58 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB39cd872acbcc913f9df4f6620680a2e7f89c5098

Add function to query whether object has any point cache

===================================================================

M	source/blender/blenkernel/BKE_pointcache.h
M	source/blender/blenkernel/intern/pointcache.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list