[Bf-blender-cvs] [de604e1] alembic_pointcache: Removed the BAKED flag from point cache state. The cached now has a new flag LOCK_SETTINGS instead, which should indicate more clearly that it is about preventing cache modification by disabling user settings changes.

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


Commit: de604e1b6edd4bd1fda8f84928e4b13406b8569b
Author: Lukas Tönne
Date:   Sat Dec 7 14:54:10 2013 +0100
Branches: alembic_pointcache
https://developer.blender.org/rBde604e1b6edd4bd1fda8f84928e4b13406b8569b

Removed the BAKED flag from point cache state. The cached now has a new
flag LOCK_SETTINGS instead, which should indicate more clearly that it
is about preventing cache modification by disabling user settings
changes.

The cache should not have to care about this setting in the first place.
It becomes increasingly difficult to control changed simulation settings
anyway (scripting!), and the cache should not even try to exert control
over sims this way. Eventually this flag should be a feature of
simulations and modifiers, using it as a 3rd option beside
enabled/disabled and using only existing cached data.

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

M	release/scripts/startup/bl_ui/properties_particle.py
M	release/scripts/startup/bl_ui/properties_physics_cloth.py
M	source/blender/blenkernel/intern/cloth.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/rigidbody.c
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/blenkernel/intern/softbody.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/makesdna/DNA_pointcache_types.h
M	source/blender/makesrna/intern/rna_pointcache.c
M	source/blender/modifiers/intern/MOD_particleinstance.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 051bbeb..1968822 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -36,7 +36,7 @@ def particle_panel_enabled(context, psys):
     if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}:
         return True
     else:
-        return (psys.point_cache.state.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
+        return not psys.point_cache.lock_settings and (not psys.is_edited) and (not context.particle_system_editable)
 
 
 def particle_panel_poll(cls, context):
@@ -278,7 +278,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
 
         cloth = psys.cloth.settings
 
-        layout.enabled = psys.use_hair_dynamics and psys.point_cache.state.is_baked is False
+        layout.enabled = psys.use_hair_dynamics and not psys.point_cache.lock_settings
 
         split = layout.split()
 
@@ -319,7 +319,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
         phystype = psys.settings.physics_type
         if phystype == 'NO' or phystype == 'KEYED':
             return False
-        return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.state.is_baked))) and engine in cls.COMPAT_ENGINES
+        return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics)) and engine in cls.COMPAT_ENGINES
 
     def draw(self, context):
         psys = context.particle_system
@@ -840,7 +840,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
             col.label(text="Timing:")
             col.prop(part, "use_absolute_path_time")
 
-            if part.type == 'HAIR' or psys.point_cache.state.is_baked:
+            # XXX first case included baked caches before, this feature has been removed, not sure how it should work
+            if part.type == 'HAIR':
                 col.prop(part, "path_start", text="Start", slider=not part.use_absolute_path_time)
             else:
                 col.prop(part, "trail_count")
@@ -1009,11 +1010,11 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
 
         if part.draw_percentage != 100 and psys is not None:
             if part.type == 'HAIR':
-                if psys.use_hair_dynamics and psys.point_cache.state.is_baked is False:
+                if psys.use_hair_dynamics:
                     layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
             else:
                 phystype = part.physics_type
-                if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.state.is_baked is False:
+                if phystype != 'NO' and phystype != 'KEYED':
                     layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
 
         row = layout.row()
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index 915a5b5..1753d98 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -25,7 +25,7 @@ from bl_ui.properties_physics_common import (point_cache_ui,
 
 
 def cloth_panel_enabled(md):
-    return md.point_cache.state.is_baked is False
+    return not md.point_cache.lock_settings
 
 
 class CLOTH_MT_presets(Menu):
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index ea183f4..4455a43 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -540,11 +540,6 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
 	else if (cache_result==PTCACHE_READ_OLD) {
 		implicit_set_positions(clmd);
 	}
-	else if ( /*ob->id.lib ||*/ (cache->state.flag & PTC_STATE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
-		/* if baked and nothing in cache, do nothing */
-		BKE_ptcache_invalidate(cache);
-		return;
-	}
 
 	if (framenr!=clmd->clothObject->last_frame+1)
 		return;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index d0768c3..3512505 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -939,8 +939,7 @@ static void surface_freeUnusedData(DynamicPaintSurface *surface)
 	if (!surface->data) return;
 
 	/* free bakedata if not active or surface is baked */
-	if (!(surface->flags & MOD_DPAINT_ACTIVE) ||
-	    (surface->pointcache && surface->pointcache->state.flag & PTC_STATE_BAKED))
+	if (!(surface->flags & MOD_DPAINT_ACTIVE))
 	{
 		free_bakeData(surface->data);
 	}
@@ -1978,7 +1977,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
 				BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL);
 
 				/* reset non-baked cache at first frame */
-				if ((int)scene->r.cfra == surface->start_frame && !(cache->state.flag & PTC_STATE_BAKED)) {
+				if ((int)scene->r.cfra == surface->start_frame) {
 					cache->state.flag |= PTC_STATE_REDO_NEEDED;
 					BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
 					cache->state.flag &= ~PTC_STATE_REDO_NEEDED;
@@ -1989,7 +1988,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
 					BKE_ptcache_validate(cache, (int)scene->r.cfra);
 				}
 				/* if read failed and we're on surface range do recalculate */
-				else if ((int)scene->r.cfra == current_frame && !(cache->state.flag & PTC_STATE_BAKED)) {
+				else if ((int)scene->r.cfra == current_frame) {
 					/* calculate surface frame */
 					canvas->flags |= MOD_DPAINT_BAKING;
 					dynamicPaint_calculateFrame(surface, scene, ob, current_frame);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 7831f08..da7507c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -117,9 +117,6 @@
 
 static int particles_are_dynamic(ParticleSystem *psys)
 {
-	if (psys->pointcache->state.flag & PTC_STATE_BAKED)
-		return 0;
-
 	if (psys->part->type == PART_HAIR)
 		return psys->flag & PSYS_HAIR_DYNAMICS;
 	else
@@ -2023,12 +2020,6 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
 
 	pa->dietime = pa->time + pa->lifetime;
 
-	if (sim->psys->pointcache && sim->psys->pointcache->state.flag & PTC_STATE_BAKED &&
-		sim->psys->mem_pointcache.first) {
-		float dietime = psys_get_dietime_from_cache(&sim->psys->mem_pointcache, p);
-		pa->dietime = MIN2(pa->dietime, dietime);
-	}
-
 	if (pa->time > cfra)
 		pa->alive = PARS_UNBORN;
 	else if (pa->dietime <= cfra)
@@ -3902,8 +3893,8 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
 			psys_free_children(psys);
 	}
 
-	if ((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->state.flag & PTC_STATE_BAKED)==0)
-		skip = 1; /* only hair, keyed and baked stuff can have paths */
+	if ((part->type==PART_HAIR || psys->flag&PSYS_KEYED)==0)
+		skip = 1; /* only hair and keyed can have paths */
 	else if (part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)))
 		skip = 1; /* particle visualization must be set as path */
 	else if (!psys->renderdata) {
@@ -3914,7 +3905,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
 		else if (psys_in_edit_mode(sim->scene, psys)) {
 			if ((pset->flag & PE_DRAW_PART)==0)
 				skip = 1;
-			else if (part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->state.flag & PTC_STATE_BAKED)==0)
+			else if (part->childtype==0 && !(psys->flag & PSYS_HAIR_DYNAMICS))
 				skip = 1; /* in edit mode paths are needed for child particles and dynamic hair */
 		}
 	}
@@ -4653,7 +4644,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 		psys_clear_temp_pointcache(psys);
 
 		/* set suitable cache range automatically */
-		if ((cache->state.flag & (PTC_STATE_BAKING|PTC_STATE_BAKED))==0)
+		if ((cache->state.flag & PTC_STATE_BAKING)==0)
 			psys_get_pointcache_start_end(sim->scene, psys, &cache->startframe, &cache->endframe);
 
 		cache_reader = PTC_reader_particles(sim->scene, sim->ob, psys);
@@ -4710,11 +4701,6 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 
 			return;
 		}
-		/* Cache is supposed to be baked, but no data was found so bail out */
-		else if (cache->state.flag & PTC_STATE_BAKED) {
-			psys_reset(psys, PSYS_RESET_CACHE_MISS);
-			return;
-		}
 		else if (cache_result == PTC_READ_SAMPLE_EARLY) {
 			psys->cfra = (float)cache->state.simframe;
 			cached_step(sim, psys->cfra);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 4335b98..8178145 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2472,7 +2472,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 	char path_full[MAX_PTCACHE_FILE];
 	char ext[MAX_PTCACHE_PATH];
 
-	if (!pid || !pid->cache || pid->cache->state.flag & PTC_STATE_BAKED)
+	if (!pid || !pid->cache)
 		return;
 
 	if (pid->cache->flag & PTC_IGNORE_CLEAR)
@@ -2683,10 +2683,7 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 	after= 0;
 
 	if (mode == PTCACHE_RESET_DEPSGRAPH) {
-		if (!(cache->state.flag & PTC_STATE_BAKED)) {
-
-			after= 1;
-		}
+		after= 1;
 
 		cache->state.flag |= PTC_STATE_OUTDATED;
 	}
@@ -2696,7 +2693,7 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 	else if (mode == PTCACHE_RESET_OUTDATED) {
 		reset = 1;
 
-		if (cache->state.flag & PTC_STATE_OUTDATED && !(cache->state.flag & PTC_STATE_BAKED)) {
+		if (cache->state.flag & PTC_STATE_OUTDATED) {
 			clear= 1;
 			cache->state.flag &= ~PTC_STATE_OUTDATED;
 		}
@@ -2751,7 +2748,7 @@ in

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list