diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-14 13:24:54 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-14 16:08:39 +0300 |
commit | d3c08b1aa62d0e6b373621cbd2da7342796f9625 (patch) | |
tree | e15edd7504ebb004611dff1fa2b283d306f88748 /source/blender/depsgraph/intern/depsgraph_physics.cc | |
parent | 1d8db50538c4ba933d0a5faf97807ace1a9f6386 (diff) |
Depsgraph: Fix missing point cache reset when physics changes
Among all the lines moved around, the general idea is quite simple.
Actually, there are two ideas implemented there.
First one, is when object itself is tagged for update, we tag its
point cache component for evaluation, which makes it so point cache
is properly reset. We do it implicitly because otherwise we'll need
to go everywhere and add explicit tag in almost all the properties.
Second thing is, we link all collider and force fields to a point
cache component using special type of link. This type of link only
allows flush if change is caused by a user update. This way reset
does not happen when change is caused due to animation, but will
properly happen when user causes indirect change to the objects
which are part of physics simulation.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_physics.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_physics.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc index 0a54caebace..88d4c25f726 100644 --- a/source/blender/depsgraph/intern/depsgraph_physics.cc +++ b/source/blender/depsgraph/intern/depsgraph_physics.cc @@ -122,8 +122,10 @@ void DEG_add_collision_relations(DepsNodeHandle *handle, ob1, modifiers_findByType(ob1, (ModifierType)modifier_type))) { - DEG_add_object_relation(handle, ob1, DEG_OB_COMP_TRANSFORM, name); - DEG_add_object_relation(handle, ob1, DEG_OB_COMP_GEOMETRY, name); + DEG_add_object_pointcache_relation( + handle, ob1, DEG_OB_COMP_TRANSFORM, name); + DEG_add_object_pointcache_relation( + handle, ob1, DEG_OB_COMP_GEOMETRY, name); } } } @@ -146,26 +148,25 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle, if (relation->pd->forcefield == skip_forcefield) { continue; } - DEG_add_object_relation( + DEG_add_object_pointcache_relation( handle, relation->ob, DEG_OB_COMP_TRANSFORM, name); if (relation->psys) { /* TODO(sergey): Consider going more granular with more dedicated - * particle system operation. - */ - DEG_add_object_relation( + * particle system operation. */ + DEG_add_object_pointcache_relation( handle, relation->ob, DEG_OB_COMP_GEOMETRY, name); } if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source != NULL) { - DEG_add_object_relation(handle, - relation->pd->f_source, - DEG_OB_COMP_TRANSFORM, - "Smoke Force Domain"); - DEG_add_object_relation(handle, - relation->pd->f_source, - DEG_OB_COMP_GEOMETRY, - "Smoke Force Domain"); + DEG_add_object_pointcache_relation(handle, + relation->pd->f_source, + DEG_OB_COMP_TRANSFORM, + "Smoke Force Domain"); + DEG_add_object_pointcache_relation(handle, + relation->pd->f_source, + DEG_OB_COMP_GEOMETRY, + "Smoke Force Domain"); } if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) { DEG_add_collision_relations(handle, |