[Bf-blender-cvs] [acb4e9f] alembic_pointcache: Made the PTCACHE_DISK_CACHE flag deprecated and removed all uses. This is assumed to be TRUE always, all caches are disk-based now, which removes a lot of complexity from constant double-checking. Eventually disk caches can be integrated into .blend files, but this will be a secondary feature instead of an alternative format for caches, so we don't have to implement every function in 2 different ways.

Lukas Tönne noreply at git.blender.org
Thu Oct 16 16:53:37 CEST 2014


Commit: acb4e9fe2faa11a897192a51edd4735b38c3d334
Author: Lukas Tönne
Date:   Thu Nov 28 09:40:08 2013 +0100
Branches: alembic_pointcache
https://developer.blender.org/rBacb4e9fe2faa11a897192a51edd4735b38c3d334

Made the PTCACHE_DISK_CACHE flag deprecated and removed all uses. This
is assumed to be TRUE always, all caches are disk-based now, which
removes a lot of complexity from constant double-checking. Eventually
disk caches can be integrated into .blend files, but this will be a
secondary feature instead of an alternative format for caches, so we
don't have to implement every function in 2 different ways.

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

M	source/blender/blenkernel/intern/bpath.c
M	source/blender/blenkernel/intern/dynamicpaint.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/makesdna/DNA_pointcache_types.h
M	source/blender/makesrna/intern/rna_pointcache.c

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

diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index f65d337..9453c84 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -449,7 +449,7 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
 
 #define BPATH_TRAVERSE_POINTCACHE(cache)                                   \
 	{                                                                      \
-		if (cache && cache->flag & PTCACHE_DISK_CACHE) {                            \
+		if (cache) {                            \
 			rewrite_path_fixed(cache->path,                                \
 			                   visit_cb,                                   \
 			                   absbase,                                    \
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 99a21fe..4b97607 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -1039,7 +1039,6 @@ DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSettings *c
 
 	/* cache */
 	surface->pointcache = BKE_ptcache_new();
-	surface->pointcache->flag |= PTCACHE_DISK_CACHE;
 	surface->pointcache->step = 1;
 
 	/* Set initial values */
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index ebdeee5..d4dab07 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2170,20 +2170,15 @@ static void set_keyed_keys(ParticleSimulationData *sim)
 /************************************************/
 void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
 {
-	PointCache *cache = psys->pointcache;
-
-	if (cache->flag & PTCACHE_DISK_CACHE && psys->mem_pointcache.first == NULL) {
+	if (psys->mem_pointcache.first == NULL) {
 		PTCacheID pid;
 		BKE_ptcache_id_from_particles(&pid, ob, psys);
-		cache->flag &= ~PTCACHE_DISK_CACHE;
 		BKE_ptcache_to_mem(&pid, &psys->mem_pointcache);
-		cache->flag |= PTCACHE_DISK_CACHE;
 	}
 }
 static void psys_clear_temp_pointcache(ParticleSystem *psys)
 {
-	if (psys->pointcache->flag & PTCACHE_DISK_CACHE)
-		BKE_ptcache_free_mem(&psys->mem_pointcache);
+	BKE_ptcache_free_mem(&psys->mem_pointcache);
 }
 void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
 {
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 59a374d..a96cc61 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2160,11 +2160,9 @@ static int ptcache_read(PTCacheID *pid, int cfra)
 			pid->read_extra_data(pid->calldata, pm, (float)pm->frame);
 
 		/* clean up temporary memory cache */
-		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
-			ptcache_data_free(pm);
-			ptcache_extra_free(pm);
-			MEM_freeN(pm);
-		}
+		ptcache_data_free(pm);
+		ptcache_extra_free(pm);
+		MEM_freeN(pm);
 	}
 
 	return 1;
@@ -2205,11 +2203,9 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2)
 			pid->interpolate_extra_data(pid->calldata, pm, cfra, (float)cfra1, (float)cfra2);
 
 		/* clean up temporary memory cache */
-		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
-			ptcache_data_free(pm);
-			ptcache_extra_free(pm);
-			MEM_freeN(pm);
-		}
+		ptcache_data_free(pm);
+		ptcache_extra_free(pm);
+		MEM_freeN(pm);
 	}
 
 	return 1;
@@ -2897,7 +2893,7 @@ PointCache *BKE_ptcache_copy(PointCache *cache, int copy_data)
 		ncache->cached_frames = NULL;
 
 		/* flag is a mix of user settings and simulator/baking state */
-		ncache->flag= ncache->flag & (PTCACHE_DISK_CACHE|PTCACHE_EXTERNAL|PTCACHE_IGNORE_LIBPATH);
+		ncache->flag= ncache->flag & (PTCACHE_EXTERNAL|PTCACHE_IGNORE_LIBPATH);
 		ncache->simframe= 0;
 	}
 	else {
@@ -3168,8 +3164,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
 		if (bake) {
 			cache->flag |= PTCACHE_BAKED;
 			/* write info file */
-			if (cache->flag & PTCACHE_DISK_CACHE)
-				BKE_ptcache_write(pid, 0);
+			BKE_ptcache_write(pid, 0);
 		}
 	}
 	else {
@@ -3192,8 +3187,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
 
 				if (bake) {
 					cache->flag |= PTCACHE_BAKED;
-					if (cache->flag & PTCACHE_DISK_CACHE)
-						BKE_ptcache_write(pid, 0);
+					BKE_ptcache_write(pid, 0);
 				}
 			}
 			BLI_freelistN(&pidlist);
@@ -3255,10 +3249,8 @@ void BKE_ptcache_from_mem(PTCacheID *pid, ListBase *mem_cache)
 	cache->flag |= baked;
 
 	for (; pm; pm=pm->next) {
-		if (ptcache_mem_frame_to_disk(pid, pm)==0) {
-			cache->flag &= ~PTCACHE_DISK_CACHE;
+		if (ptcache_mem_frame_to_disk(pid, pm)==0)
 			break;
-		}
 	}
 
 	/* write info file */
@@ -3417,7 +3409,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 				ptcache_file_close(pf);
 			}
 		}
-		cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID);
+		cache->flag |= (PTCACHE_BAKED|PTCACHE_SIMULATION_VALID);
 		cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED);
 	}
 
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 73dbf97..c5175d0 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -518,7 +518,6 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			smd->domain->smd = smd;
 
 			smd->domain->point_cache[0] = BKE_ptcache_new();
-			smd->domain->point_cache[0]->flag |= PTCACHE_DISK_CACHE;
 			smd->domain->point_cache[0]->step = 1;
 
 			/* Deprecated */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 98394fd..30e823d 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1344,7 +1344,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 
 					/* create fake pointcache so that old blender versions can read it */
 					smd->domain->point_cache[1] = BKE_ptcache_new();
-					smd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE|PTCACHE_FAKE_SMOKE;
+					smd->domain->point_cache[1]->flag |= PTCACHE_FAKE_SMOKE;
 					smd->domain->point_cache[1]->step = 1;
 
 					write_pointcache(wd, smd->domain->point_cache[1]);
diff --git a/source/blender/makesdna/DNA_pointcache_types.h b/source/blender/makesdna/DNA_pointcache_types.h
index a61b3a0..1c95ab9 100644
--- a/source/blender/makesdna/DNA_pointcache_types.h
+++ b/source/blender/makesdna/DNA_pointcache_types.h
@@ -130,7 +130,7 @@ typedef struct PointCache {
 #define PTCACHE_BAKING				8
 //#define PTCACHE_BAKE_EDIT			16
 //#define PTCACHE_BAKE_EDIT_ACTIVE	32
-#define PTCACHE_DISK_CACHE			64
+//#define PTCACHE_DISK_CACHE		64 /* DEPRECATED all caches are disk-based now (with optional packing in blend files) */
 //#define PTCACHE_QUICK_CACHE		128  /* removed since 2.64 - [#30974], could be added back in a more useful way */
 #define PTCACHE_FRAMES_SKIPPED		256
 #define PTCACHE_EXTERNAL			512
diff --git a/source/blender/makesrna/intern/rna_pointcache.c b/source/blender/makesrna/intern/rna_pointcache.c
index 55ee7b1..c231db4 100644
--- a/source/blender/makesrna/intern/rna_pointcache.c
+++ b/source/blender/makesrna/intern/rna_pointcache.c
@@ -124,7 +124,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 		}
 
 		if (new_name) {
-			if (pid2 && cache->flag & PTCACHE_DISK_CACHE) {
+			if (pid2) {
 				char old_name[80];
 				char new_name[80];




More information about the Bf-blender-cvs mailing list