[Bf-blender-cvs] [af02fe2] alembic_pointcache: Cleanup and restructuring: New 'state' struct in PointCache of type PointCacheState, which holds all the non-user-defined state variables for baking and validity. This has its own flags, so the state flags are conceptually separated from the user-defined options.
Lukas Tönne
noreply at git.blender.org
Thu Oct 16 16:53:50 CEST 2014
Commit: af02fe2d2f8b2deb658312eae3f2386492ac13b0
Author: Lukas Tönne
Date: Sat Nov 30 15:59:28 2013 +0100
Branches: alembic_pointcache
https://developer.blender.org/rBaf02fe2d2f8b2deb658312eae3f2386492ac13b0
Cleanup and restructuring: New 'state' struct in PointCache of type
PointCacheState, which holds all the non-user-defined state variables
for baking and validity. This has its own flags, so the state flags are
conceptually separated from the user-defined options.
The old flags are still in the DNA for backward compatibility mapping,
with an underscore prefix and _DEPRECATED suffix so they are not used
accidentally and name collision is avoided.
===================================================================
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/blenloader/intern/writefile.c
M source/blender/editors/object/object_edit.c
M source/blender/editors/physics/particle_edit.c
M source/blender/editors/physics/physics_pointcache.c
M source/blender/editors/space_time/space_time.c
M source/blender/editors/transform/transform_conversions.c
M source/blender/makesdna/DNA_pointcache_types.h
M source/blender/makesrna/intern/rna_pointcache.c
M source/blender/makesrna/intern/rna_smoke.c
M source/blender/modifiers/intern/MOD_particleinstance.c
M source/blender/pointcache/PTC_api.cpp
===================================================================
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index cab4adf..6a9e488 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -473,11 +473,11 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
(clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
{
clmd->sim_parms->reset = 0;
- cache->flag |= PTCACHE_OUTDATED;
+ cache->state.flag |= PTC_STATE_OUTDATED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
BKE_ptcache_validate(cache, 0);
cache->last_exact= 0;
- cache->flag &= ~PTCACHE_REDO_NEEDED;
+ cache->state.flag &= ~PTC_STATE_REDO_NEEDED;
}
// unused in the moment, calculated separately in implicit.c
@@ -516,7 +516,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
do_init_cloth(ob, clmd, dm, framenr);
BKE_ptcache_validate(cache, framenr);
- cache->flag &= ~PTCACHE_REDO_NEEDED;
+ cache->state.flag &= ~PTC_STATE_REDO_NEEDED;
clmd->clothObject->last_frame= framenr;
return;
}
@@ -530,7 +530,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
BKE_ptcache_validate(cache, framenr);
- if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+ if (cache_result == PTCACHE_READ_INTERPOLATED && cache->state.flag & PTC_STATE_REDO_NEEDED)
BKE_ptcache_write(&pid, framenr);
clmd->clothObject->last_frame= framenr;
@@ -540,7 +540,7 @@ 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->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
+ 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;
@@ -550,7 +550,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
return;
/* if on second frame, write cache for first frame */
- if (cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+ if (cache->simframe == startframe && (cache->state.flag & PTC_STATE_OUTDATED || cache->last_exact==0))
BKE_ptcache_write(&pid, startframe);
clmd->sim_parms->timescale *= framenr - cache->simframe;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 4b97607..d0768c3 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -506,9 +506,9 @@ static void object_cacheIgnoreClear(Object *ob, int state)
for (pid = pidlist.first; pid; pid = pid->next) {
if (pid->cache) {
if (state)
- pid->cache->flag |= PTCACHE_IGNORE_CLEAR;
+ pid->cache->flag |= PTC_IGNORE_CLEAR;
else
- pid->cache->flag &= ~PTCACHE_IGNORE_CLEAR;
+ pid->cache->flag &= ~PTC_IGNORE_CLEAR;
}
}
@@ -940,7 +940,7 @@ static void surface_freeUnusedData(DynamicPaintSurface *surface)
/* free bakedata if not active or surface is baked */
if (!(surface->flags & MOD_DPAINT_ACTIVE) ||
- (surface->pointcache && surface->pointcache->flag & PTCACHE_BAKED))
+ (surface->pointcache && surface->pointcache->state.flag & PTC_STATE_BAKED))
{
free_bakeData(surface->data);
}
@@ -1978,10 +1978,10 @@ 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->flag & PTCACHE_BAKED)) {
- cache->flag |= PTCACHE_REDO_NEEDED;
+ if ((int)scene->r.cfra == surface->start_frame && !(cache->state.flag & PTC_STATE_BAKED)) {
+ cache->state.flag |= PTC_STATE_REDO_NEEDED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
- cache->flag &= ~PTCACHE_REDO_NEEDED;
+ cache->state.flag &= ~PTC_STATE_REDO_NEEDED;
}
/* try to read from cache */
@@ -1989,7 +1989,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->flag & PTCACHE_BAKED)) {
+ else if ((int)scene->r.cfra == current_frame && !(cache->state.flag & PTC_STATE_BAKED)) {
/* 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 af87ef2..a36159f 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -117,7 +117,7 @@
static int particles_are_dynamic(ParticleSystem *psys)
{
- if (psys->pointcache->flag & PTCACHE_BAKED)
+ if (psys->pointcache->state.flag & PTC_STATE_BAKED)
return 0;
if (psys->part->type == PART_HAIR)
@@ -132,7 +132,7 @@ float psys_get_current_display_percentage(ParticleSystem *psys)
if ((psys->renderdata && !particles_are_dynamic(psys)) || /* non-dynamic particles can be rendered fully */
(part->child_nbr && part->childtype) || /* display percentage applies to children */
- (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
+ (psys->pointcache->state.flag & PTC_STATE_BAKING)) /* baking is always done with full amount */
{
return 1.0f;
}
@@ -2023,7 +2023,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
pa->dietime = pa->time + pa->lifetime;
- if (sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
+ 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);
@@ -3900,19 +3900,19 @@ 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->flag & PTCACHE_BAKED)==0)
+ 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 */
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) {
if (part->draw_as != PART_DRAW_REND)
skip = 1; /* draw visualization */
- else if (psys->pointcache->flag & PTCACHE_BAKING)
+ else if (psys->pointcache->state.flag & PTC_STATE_BAKING)
skip = 1; /* no need to cache paths while baking dynamics */
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->flag & PTCACHE_BAKED)==0)
+ else if (part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->state.flag & PTC_STATE_BAKED)==0)
skip = 1; /* in edit mode paths are needed for child particles and dynamic hair */
}
}
@@ -4491,7 +4491,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
/* update alive status and push events */
if (pa->time > cfra) {
pa->alive = PARS_UNBORN;
- if (part->flag & PART_UNBORN && (psys->pointcache->flag & PTCACHE_EXTERNAL) == 0)
+ if (part->flag & PART_UNBORN && (psys->pointcache->flag & PTC_EXTERNAL) == 0)
reset_particle(sim, pa, 0.0f, cfra);
}
else if (dietime <= cfra)
@@ -4622,7 +4622,7 @@ static int emit_particles(ParticleSimulationData *sim, struct PTCReader *cache_r
{
ParticleSystem *psys = sim->psys;
int oldtotpart = psys->totpart;
- int totpart = (cache_reader && psys->pointcache->flag & PTCACHE_EXTERNAL) ? PTC_reader_particles_totpoint(cache_reader) : tot_particles(psys);
+ int totpart = (cache_reader && psys->pointcache->flag & PTC_EXTERNAL) ? PTC_reader_particles_totpoint(cache_reader) : tot_particles(psys);
if (totpart != oldtotpart)
realloc_particles(sim, totpart);
@@ -4651,7 +4651,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
psys_clear_temp_pointcache(psys);
/* set suitable cache range automatically */
- if ((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0)
+ if ((cache->state.flag & (PTC_STATE_BAKING|PTC_STATE_BAKED))==0)
psys_get_pointcache_start_end(sim->scene, psys, &cache->startframe, &cache->endframe);
cache_reader = PTC_reader_particles(sim->scene, sim->ob, psys);
@@ -4663,7 +4663,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* XXX anything to do here? */
// BKE_ptcache_id_reset(sim->scene, pid, PTCACHE_RESET_OUTDATED);
// BKE_ptcache_validate(cache, startframe);
- cache->flag &= ~PTCACHE_REDO_NEEDED;
+ cache->state.flag &= ~PTC_STATE_REDO_NEEDED;
}
CLAMP(cache_cfra, startframe, endframe);
@@ -4703,13 +4703,13 @@ static void system_step(ParticleSimulationData *sim, float cfra)
BKE_ptcache_validate(cache, (int)cache_cfra);
/* XXX TODO */
-// if (cache_result == PTC_READ_SAMPLE_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+// if (cache_result == PTC_READ_SAMPLE_INTERPOLATED && cache->state.flag & PTC_STATE_REDO_NEEDED)
// BKE_ptcache_write(pid, (int)cache_cfra);
return;
}
/* Cache is supposed to be baked, but no data was found so bail out */
- else if (cache->flag & PTCACHE_BAKED) {
+ else if (cache->state.flag & PTC_STATE_BAKED) {
psys_reset(psys, PSYS_RESET_CACHE_MISS);
return;
}
@@ -4720,7 +4720,7 @@ static void
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list