diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-08 16:41:41 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-08 16:49:17 +0300 |
commit | 6f96dfabe5cbf6966282decd2307ade9aacdeaee (patch) | |
tree | 01529fbad8453faf81a62877d03373eaf0b77b57 /source/blender/depsgraph | |
parent | bf4198cdaf7d4fa1a5f91526fb6bbe84d2fa2a37 (diff) |
Simulations: initial simulation state and cache
The current particle state is stored in a `CustomData` instance and
the cache is stored in `PointCache`.
The current state exists on the copy-on-write copies of the simulation,
while the cache only exists in the original data block.
This patch implements a temporary trivial particle simulation that does not
use the node system yet. It is used for testing and will be replaced soon.
`PointCache` still has some limitations that need to be overcome using
separate refactorings. For example, we need to be able to store the number
of particles in the point cache. Also we need to change which attributes
are stored for a particle system more dynamically than is currently possible afaik.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D7836
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 2f2e05d410e..70a6875f1c0 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -63,6 +63,7 @@ #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_simulation_types.h" #include "DNA_sound_types.h" #include "DRW_engine.h" @@ -709,6 +710,13 @@ void update_modifiers_orig_pointers(const Object *object_orig, Object *object_co &object_orig->modifiers, &object_cow->modifiers, &ModifierData::orig_modifier_data); } +void update_simulation_states_orig_pointers(const Simulation *simulation_orig, + Simulation *simulation_cow) +{ + update_list_orig_pointers( + &simulation_orig->states, &simulation_cow->states, &SimulationState::orig_state); +} + void update_nla_strips_orig_pointers(const ListBase *strips_orig, ListBase *strips_cow) { NlaStrip *strip_orig = reinterpret_cast<NlaStrip *>(strips_orig->first); @@ -808,6 +816,12 @@ void update_id_after_copy(const Depsgraph *depsgraph, update_scene_orig_pointers(scene_orig, scene_cow); break; } + case ID_SIM: { + Simulation *simulation_cow = (Simulation *)id_cow; + const Simulation *simulation_orig = (const Simulation *)id_orig; + update_simulation_states_orig_pointers(simulation_orig, simulation_cow); + break; + } default: break; } |