[Bf-blender-cvs] [24c6137] alembic_pointcache: Cache read result enum in DNA mirroring the internal pointcache results.

Lukas Tönne noreply at git.blender.org
Tue Mar 3 13:57:44 CET 2015


Commit: 24c6137d46a8fdd1b28262707b4d4b85c67ea33d
Author: Lukas Tönne
Date:   Tue Mar 3 12:30:11 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB24c6137d46a8fdd1b28262707b4d4b85c67ea33d

Cache read result enum in DNA mirroring the internal pointcache results.

This can be stored in cache library items as an indicator of cache
reading state.

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

M	source/blender/blenkernel/BKE_cache_library.h
M	source/blender/blenkernel/intern/cache_library.c
M	source/blender/makesdna/DNA_cache_library_types.h

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

diff --git a/source/blender/blenkernel/BKE_cache_library.h b/source/blender/blenkernel/BKE_cache_library.h
index 4231595..4936368 100644
--- a/source/blender/blenkernel/BKE_cache_library.h
+++ b/source/blender/blenkernel/BKE_cache_library.h
@@ -81,6 +81,7 @@ void BKE_cache_library_walk(struct CacheLibrary *cachelib, CacheGroupWalkFunc wa
 const char *BKE_cache_item_name_prefix(int type);
 void BKE_cache_item_name(struct Object *ob, int type, int index, char *name);
 int BKE_cache_item_name_length(struct Object *ob, int type, int index);
+eCacheReadSampleResult BKE_cache_read_result(int ptc_result);
 
 struct CacheItem *BKE_cache_library_find_item(struct CacheLibrary *cachelib, struct Object *ob, int type, int index);
 struct CacheItem *BKE_cache_library_add_item(struct CacheLibrary *cachelib, struct Object *ob, int type, int index);
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index bcd573f..a61b49d 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -386,6 +386,18 @@ int BKE_cache_item_name_length(Object *ob, int type, int index)
 		return snprintf(NULL, 0, "%s_%s", BKE_cache_item_name_prefix(type), ob->id.name+2);
 }
 
+eCacheReadSampleResult BKE_cache_read_result(int ptc_result)
+{
+	switch (ptc_result) {
+		case PTC_READ_SAMPLE_INVALID: return CACHE_READ_SAMPLE_INVALID;
+		case PTC_READ_SAMPLE_EARLY: return CACHE_READ_SAMPLE_EARLY;
+		case PTC_READ_SAMPLE_LATE: return CACHE_READ_SAMPLE_LATE;
+		case PTC_READ_SAMPLE_EXACT: return CACHE_READ_SAMPLE_EXACT;
+		case PTC_READ_SAMPLE_INTERPOLATED: return CACHE_READ_SAMPLE_INTERPOLATED;
+		default: BLI_assert(false); break; /* should never happen, enums out of sync? */
+	}
+}
+
 static void cache_library_insert_item_hash(CacheLibrary *cachelib, CacheItem *item, bool replace)
 {
 	CacheItem *exist = BLI_ghash_lookup(cachelib->items_hash, item);
diff --git a/source/blender/makesdna/DNA_cache_library_types.h b/source/blender/makesdna/DNA_cache_library_types.h
index d31956a..434b7c2 100644
--- a/source/blender/makesdna/DNA_cache_library_types.h
+++ b/source/blender/makesdna/DNA_cache_library_types.h
@@ -46,6 +46,14 @@ typedef enum eCacheItemType {
 	CACHE_TYPE_PARTICLES            = 4,
 } eCacheItemType;
 
+typedef enum eCacheReadSampleResult {
+	CACHE_READ_SAMPLE_INVALID         = 0,	/* no valid result can be retrieved */
+	CACHE_READ_SAMPLE_EARLY           = 1,	/* request time before first sample */
+	CACHE_READ_SAMPLE_LATE            = 2,	/* request time after last sample */
+	CACHE_READ_SAMPLE_EXACT           = 3,	/* found sample for requested frame */
+	CACHE_READ_SAMPLE_INTERPOLATED    = 4,	/* no exact sample, but found enclosing samples for interpolation */
+} eCacheReadSampleResult;
+
 typedef struct CacheItem {
 	struct CacheItem *next, *prev;
 	
@@ -54,7 +62,8 @@ typedef struct CacheItem {
 	int index;
 	
 	int flag;
-	int pad;
+	short read_result;
+	short pad;
 } CacheItem;
 
 typedef enum eCacheItem_Flag {




More information about the Bf-blender-cvs mailing list