[Bf-blender-cvs] [67e23b4b296] master: Fix T84369: Fluid: Missing cache invalidation when properties on non-domain objects change
Germano Cavalcante
noreply at git.blender.org
Mon Jun 27 21:54:57 CEST 2022
Commit: 67e23b4b29676e7cbc039eba96e3edd78a632997
Author: Germano Cavalcante
Date: Mon Jun 27 16:50:13 2022 -0300
Branches: master
https://developer.blender.org/rB67e23b4b29676e7cbc039eba96e3edd78a632997
Fix T84369: Fluid: Missing cache invalidation when properties on non-domain objects change
The `DEG_OB_COMP_TRANSFORM` and `DEG_OB_COMP_GEOMETRY` relations between
the **Domain** object and the **Flow**, **Effector** and **Force Field** objects
are added in the `updateDepsgraph` callback of the Fluid modifier, more
specifically in `DEG_add_collision_relations`.
The node linked to these components is the `POINT_CACHE` whose assigned
function is `BKE_ptcache_object_reset`.
So include the `eModifierType_Fluid` modifier in outdated cache checks.
Reviewed By: sergey, zeddb
Maniphest Tasks: T84369
Differential Revision: https://developer.blender.org/D15210
===================================================================
M source/blender/blenkernel/intern/fluid.c
M source/blender/blenkernel/intern/pointcache.c
===================================================================
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 5cd5a699dec..8e95bf18c6b 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3761,16 +3761,16 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd,
MEM_freeN(objs);
}
- /* TODO(sebbas): Cache reset for when flow / effector object need update flag is set. */
-# if 0
- /* If the just updated flags now carry the 'outdated' flag, reset the cache here!
- * Plus sanity check: Do not clear cache on file load. */
- if (fds->cache_flag & FLUID_DOMAIN_OUTDATED_DATA &&
- ((fds->flags & FLUID_DOMAIN_FILE_LOAD) == 0)) {
- BKE_fluid_cache_free_all(fds, ob);
- BKE_fluid_modifier_reset_ex(fmd, false);
+ /* If 'outdated', reset the cache here. */
+ if (is_startframe && mode == FLUID_DOMAIN_CACHE_REPLAY) {
+ PTCacheID pid;
+ BKE_ptcache_id_from_smoke(&pid, ob, fmd);
+ if (pid.cache->flag & PTCACHE_OUTDATED) {
+ BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
+ BKE_fluid_cache_free_all(fds, ob);
+ BKE_fluid_modifier_reset_ex(fmd, false);
+ }
}
-# endif
/* Fluid domain init must not fail in order to continue modifier evaluation. */
if (!fds->fluid && !BKE_fluid_modifier_init(fmd, depsgraph, ob, scene, me)) {
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index d7bdfe08ab9..21217a7f9bf 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2980,6 +2980,15 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
}
}
}
+ if (md->type == eModifierType_Fluid) {
+ FluidModifierData *fmd = (FluidModifierData *)md;
+ FluidDomainSettings *fds = fmd->domain;
+ if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fds &&
+ fds->cache_type == FLUID_DOMAIN_CACHE_REPLAY) {
+ BKE_ptcache_id_from_smoke(&pid, ob, fmd);
+ reset |= BKE_ptcache_id_reset(scene, &pid, mode);
+ }
+ }
}
if (scene->rigidbody_world && (ob->rigidbody_object || ob->rigidbody_constraint)) {
More information about the Bf-blender-cvs
mailing list