I'd like to use this "thread" to decide how we want to store particle attributes
in the .blend file. The approach I implemented in the patch below is just one of
many possibilities. However, I think it helps to have something that "works" as
a basis for the discussion. I'm fine with trashing all the code below. It's very
work-in-progress anyway.
Some aspects to consider
- Should we use CustomData or the new attribute system from T76659?
- Should we use the existing PointCache system?
- Should the cache be stored on the original data block or on the COW simulation?
Some Context
A Simulation is a container for a "simulation description" (node tree) and
the cached simulation result. A simulation data block can contain multiple
particle simulations and later also other kinds of simulations. Different
types of simulations require different storage types. We can't really make
a lot of assumptions about the data format imo.
Furthermore, it would be good to be able to have the entire cache in the .blend
file or on disk.
The cached simulation data is accessed by a Simulation modifier on e.g. point cloud objects.
This modifier copies the simulation data into the object data for further editing and rendering.
Current Implementation
A Simulation has an arbitrary number of SimulationCaches.
SimulationCache is a "base class" for different kinds of caches.
For now, there is only ParticleSimulationCache.
There could also be FluidSimulationCache, etc.
There can be multiple caches with same type.
Every cache has a name that will be used as identifier by the simulation modifier.
A ParticleSimulationCache has a ParticleSimulationFrameCache for every cached frame.
A ParticleSimulationFrameCache stores how many particles there are and the attributes.
Everything referenced by ParticleSimulationCache could probably be replaced by some
existing functionality like CustomData or PointCache. I'm not sure if there is a
big benefit in using those. Reinventing the wheel does not feel too costly, yet.
Some feedback on the implementation described above is welcome.
Alternatively, I'd like to hear thoughts on a completely different implementation as well.