[Bf-blender-cvs] [0798382] alembic_pointcache: Record and display the last result of cache reading in the cache library items.

Lukas Tönne noreply at git.blender.org
Tue Mar 3 17:30:52 CET 2015


Commit: 0798382397b167ef54e1ce3d6f877b37bbce5b34
Author: Lukas Tönne
Date:   Tue Mar 3 17:26:52 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB0798382397b167ef54e1ce3d6f877b37bbce5b34

Record and display the last result of cache reading in the cache library
items.

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

M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/blenkernel/intern/cache_library.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/rna_cache_library.c

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

diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 2dbf144..218ccb1 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -427,23 +427,23 @@ def cachelib_objects(cachelib, filter_string = ""):
     else:
         return cachelib.group.objects
 
-# Yields (item, type, index, indent, enabled)
+# Yields (item, type, index, enabled)
 # Note that item can be None when not included in the cache yet
 def cachelib_object_items(cachelib, ob, filter_types = []):
     def items_desc():
-        yield 'OBJECT', -1, 0
+        yield 'OBJECT', -1
         
         if (ob.type == 'MESH'):
-            yield 'DERIVED_MESH', -1, 1
+            yield 'DERIVED_MESH', -1
 
         for index, psys in enumerate(ob.particle_systems):
             if psys.settings.type == 'EMITTER':
-                yield 'PARTICLES', index, 1
+                yield 'PARTICLES', index
             if psys.settings.type == 'HAIR':
-                yield 'HAIR', index, 1
-                yield 'HAIR_PATHS', index, 1
+                yield 'HAIR', index
+                yield 'HAIR_PATHS', index
 
-    for item_type, item_index, indent in items_desc():
+    for item_type, item_index in items_desc():
         item = cachelib.cache_item_find(ob, item_type, item_index)
         show = False
         enable = False
@@ -463,7 +463,7 @@ def cachelib_object_items(cachelib, ob, filter_types = []):
             enable = False
         
         if show:
-            yield item, item_type, item_index, indent, enable
+            yield item, item_type, item_index, enable
 
 class SCENE_PT_cache_manager(SceneButtonsPanel, Panel):
     bl_label = "Cache Manager"
@@ -512,12 +512,9 @@ class SCENE_PT_cache_manager(SceneButtonsPanel, Panel):
                 layout.separator()
                 first = False
 
-            for item, item_type, item_index, indent, enable in cachelib_object_items(cachelib, ob, cachelib.filter_types):
+            for item, item_type, item_index, enable in cachelib_object_items(cachelib, ob, cachelib.filter_types):
                 row = layout.row(align=True)
                 row.alignment = 'LEFT'
-                if indent:
-                    row.label("  " * indent)
-
                 row.template_cache_library_item(cachelib, ob, item_type, item_index, enable)
 
 
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 00be247..279118b 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -736,13 +736,13 @@ void BKE_cache_library_writers_free(struct PTCWriterArchive *archive, ListBase *
 }
 
 
-static struct PTCReader *cache_library_reader_derived_mesh(CacheLibrary *cachelib, Object *ob)
+static struct PTCReader *cache_library_reader_derived_mesh(CacheLibrary *cachelib, Object *ob, CacheItem **r_item)
 {
 	CacheItem *item;
 	
 	if (!(cachelib->flag & CACHE_LIBRARY_READ))
 		return NULL;
-	item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_DERIVED_MESH, -1);
+	*r_item = item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_DERIVED_MESH, -1);
 	if (item && (item->flag & CACHE_ITEM_ENABLED)) {
 		char name[2*MAX_NAME];
 		BKE_cache_item_name(ob, CACHE_TYPE_DERIVED_MESH, -1, name);
@@ -753,7 +753,7 @@ static struct PTCReader *cache_library_reader_derived_mesh(CacheLibrary *cacheli
 	return NULL;
 }
 
-static struct PTCReader *cache_library_reader_hair_dynamics(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
+static struct PTCReader *cache_library_reader_hair_dynamics(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys, CacheItem **r_item)
 {
 	CacheItem *item;
 	int index;
@@ -764,7 +764,7 @@ static struct PTCReader *cache_library_reader_hair_dynamics(CacheLibrary *cachel
 		return NULL;
 	
 	index = BLI_findindex(&ob->particlesystem, psys);
-	item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_HAIR, index);
+	*r_item = item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_HAIR, index);
 	if (item && (item->flag & CACHE_ITEM_ENABLED)) {
 		char name[2*MAX_NAME];
 		BKE_cache_item_name(ob, CACHE_TYPE_HAIR, index, name);
@@ -775,7 +775,7 @@ static struct PTCReader *cache_library_reader_hair_dynamics(CacheLibrary *cachel
 	return NULL;
 }
 
-static struct PTCReader *cache_library_reader_particles(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
+static struct PTCReader *cache_library_reader_particles(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys, CacheItem **r_item)
 {
 	CacheItem *item;
 	int index;
@@ -786,7 +786,7 @@ static struct PTCReader *cache_library_reader_particles(CacheLibrary *cachelib,
 		return NULL;
 	
 	index = BLI_findindex(&ob->particlesystem, psys);
-	item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_PARTICLES, index);
+	*r_item = item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_PARTICLES, index);
 	if (item && (item->flag & CACHE_ITEM_ENABLED)) {
 		char name[2*MAX_NAME];
 		BKE_cache_item_name(ob, CACHE_TYPE_PARTICLES, index, name);
@@ -797,7 +797,7 @@ static struct PTCReader *cache_library_reader_particles(CacheLibrary *cachelib,
 	return NULL;
 }
 
-static struct PTCReader *cache_library_reader_particles_pathcache_parents(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
+static struct PTCReader *cache_library_reader_particles_pathcache_parents(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys, CacheItem **r_item)
 {
 	CacheItem *item;
 	int index;
@@ -808,7 +808,7 @@ static struct PTCReader *cache_library_reader_particles_pathcache_parents(CacheL
 		return NULL;
 	
 	index = BLI_findindex(&ob->particlesystem, psys);
-	item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_HAIR_PATHS, index);
+	*r_item = item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_HAIR_PATHS, index);
 	if (item && (item->flag & CACHE_ITEM_ENABLED)) {
 		char name[2*MAX_NAME];
 		BKE_cache_item_name(ob, CACHE_TYPE_HAIR_PATHS, index, name);
@@ -819,7 +819,7 @@ static struct PTCReader *cache_library_reader_particles_pathcache_parents(CacheL
 	return NULL;
 }
 
-static struct PTCReader *cache_library_reader_particles_pathcache_children(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
+static struct PTCReader *cache_library_reader_particles_pathcache_children(CacheLibrary *cachelib, Object *ob, ParticleSystem *psys, CacheItem **r_item)
 {
 	CacheItem *item;
 	int index;
@@ -830,7 +830,7 @@ static struct PTCReader *cache_library_reader_particles_pathcache_children(Cache
 		return NULL;
 	
 	index = BLI_findindex(&ob->particlesystem, psys);
-	item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_HAIR_PATHS, index);
+	*r_item = item = BKE_cache_library_find_item(cachelib, ob, CACHE_TYPE_HAIR_PATHS, index);
 	if (item && (item->flag & CACHE_ITEM_ENABLED)) {
 		char name[2*MAX_NAME];
 		BKE_cache_item_name(ob, CACHE_TYPE_HAIR_PATHS, index, name);
@@ -845,12 +845,13 @@ static struct PTCReader *cache_library_reader_particles_pathcache_children(Cache
 eCacheReadSampleResult BKE_cache_library_read_derived_mesh(Scene *scene, float frame, CacheLibrary *cachelib, struct Object *ob, struct DerivedMesh **r_dm)
 {
 	struct PTCReader *reader;
+	CacheItem *item;
 	eCacheReadSampleResult result = CACHE_READ_SAMPLE_INVALID;
 	
 	if (!(cachelib->flag & CACHE_LIBRARY_READ))
 		return result;
 	
-	reader = cache_library_reader_derived_mesh(cachelib, ob);
+	reader = cache_library_reader_derived_mesh(cachelib, ob, &item);
 	if (reader) {
 		char filename[FILE_MAX];
 		struct PTCReaderArchive *archive;
@@ -860,6 +861,7 @@ eCacheReadSampleResult BKE_cache_library_read_derived_mesh(Scene *scene, float f
 		PTC_reader_set_archive(reader, archive);
 		
 		result = BKE_cache_read_result(PTC_read_sample(reader, frame));
+		item->read_result = result;
 		if (result != CACHE_READ_SAMPLE_INVALID)
 			*r_dm = PTC_reader_derived_mesh_acquire_result(reader);
 		
@@ -873,12 +875,13 @@ eCacheReadSampleResult BKE_cache_library_read_derived_mesh(Scene *scene, float f
 eCacheReadSampleResult BKE_cache_library_read_hair_dynamics(Scene *scene, float frame, CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
 {
 	struct PTCReader *reader;
+	CacheItem *item;
 	eCacheReadSampleResult result = CACHE_READ_SAMPLE_INVALID;
 	
 	if (!(cachelib->flag & CACHE_LIBRARY_READ))
 		return result;
 	
-	reader = cache_library_reader_hair_dynamics(cachelib, ob, psys);
+	reader = cache_library_reader_hair_dynamics(cachelib, ob, psys, &item);
 	if (reader) {
 		char filename[FILE_MAX];
 		struct PTCReaderArchive *archive;
@@ -888,6 +891,7 @@ eCacheReadSampleResult BKE_cache_library_read_hair_dynamics(Scene *scene, float
 		PTC_reader_set_archive(reader, archive);
 		
 		result = BKE_cache_read_result(PTC_read_sample(reader, frame));
+		item->read_result = result;
 		
 		PTC_close_reader_archive(archive);
 		PTC_reader_free(reader);
@@ -899,12 +903,13 @@ eCacheReadSampleResult BKE_cache_library_read_hair_dynamics(Scene *scene, float
 eCacheReadSampleResult BKE_cache_library_read_particles(Scene *scene, float frame, CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
 {
 	struct PTCReader *reader;
+	CacheItem *item;
 	eCacheReadSampleResult result = CACHE_READ_SAMPLE_INVALID;
 	
 	if (!(cachelib->flag & CACHE_LIBRARY_READ))
 		return result;
 	
-	reader = cache_library_reader_particles(cachelib, ob, psys);
+	reader = cache_library_reader_particles(cachelib, ob, psys, &item);
 	if (reader) {
 		char filename[FILE_MAX];
 		struct PTCReaderArchive *archive;
@@ -914,6 +919,7 @@ eCacheReadSampleResult BKE_cache_library_read_particles(Scene *scene, float fram
 		PTC_reader_set_archive(reader, archive);
 		
 		result = BKE_cache_read_result(PTC_read_sample(reader, frame));
+		item->read_result = result;
 		
 		PTC_close_reader_archive(archive);
 		PTC_reader_free(reader);
@@ -925,12 +931,13 @@ eCacheReadSampleResult BKE_cache_library_read_particles(Scene *scene, float fram
 eCacheReadSampleResult BKE_cache_library_read_particles_pathcache_parents(Scene *scene, float frame, CacheLibrary *cachelib, Object *ob, ParticleSystem *psys)
 {
 	struct PTCReader *r

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list