diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-08-04 12:44:56 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-08-04 12:45:05 +0300 |
commit | 03c2439d96e8f366646bf20095514c057593aa24 (patch) | |
tree | 062967b32fc4f44efe3e46c52ca1928491525c94 /source/blender/blenkernel/intern | |
parent | b38c04aebeae3b359acb2096a68ed30a1ec9940d (diff) |
Fluid: Do not show fluid if frame is out of cache range
Before: If the current frame is out of the cache start/end range, the viewport will show the fluid as it was on the last frame that was still in the cache frame range.
Now: If the current frame is out of the cache start/end range, the viewport will show no fluid at all (even if there are cache files present for this frame).
This fix is related / in response to T79423.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index e807388ef1d..019230572ef 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -1119,7 +1119,7 @@ static void ensure_obstaclefields(FluidDomainSettings *fds) if (fds->active_fields & FLUID_DOMAIN_ACTIVE_GUIDE) { manta_ensure_guiding(fds->fluid, fds->fmd); } - manta_update_pointers(fds->fluid, fds->fmd); + manta_update_pointers(fds->fluid, fds->fmd, false); } static void update_obstacleflags(FluidDomainSettings *fds, @@ -2606,7 +2606,7 @@ static void ensure_flowsfields(FluidDomainSettings *fds) fds->particle_type & FLUID_DOMAIN_PARTICLE_TRACER)) { manta_liquid_ensure_sndparts(fds->fluid, fds->fmd); } - manta_update_pointers(fds->fluid, fds->fmd); + manta_update_pointers(fds->fluid, fds->fmd, false); } static void update_flowsflags(FluidDomainSettings *fds, Object **flowobjs, int numflowobj) @@ -3738,29 +3738,35 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd, int mode = fds->cache_type; /* Do not process modifier if current frame is out of cache range. */ + bool escape = false; switch (mode) { case FLUID_DOMAIN_CACHE_ALL: case FLUID_DOMAIN_CACHE_MODULAR: if (fds->cache_frame_offset > 0) { if (scene_framenr < fds->cache_frame_start || scene_framenr > fds->cache_frame_end + fds->cache_frame_offset) { - return; + escape = true; } } else { if (scene_framenr < fds->cache_frame_start + fds->cache_frame_offset || scene_framenr > fds->cache_frame_end) { - return; + escape = true; } } break; case FLUID_DOMAIN_CACHE_REPLAY: default: if (scene_framenr < fds->cache_frame_start || scene_framenr > fds->cache_frame_end) { - return; + escape = true; } break; } + /* If modifier will not be processed, update/flush pointers from (old) fluid object once more. */ + if (escape && fds->fluid) { + manta_update_pointers(fds->fluid, fmd, true); + return; + } /* Reset fluid if no fluid present. Also resets active fields. */ if (!fds->fluid) { @@ -4096,7 +4102,7 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd, } /* Ensure that fluid pointers are always up to date at the end of modifier processing. */ - manta_update_pointers(fds->fluid, fmd); + manta_update_pointers(fds->fluid, fmd, false); fds->flags &= ~FLUID_DOMAIN_FILE_LOAD; fmd->time = scene_framenr; |