diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 8be441d047e..15b353aeab6 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -9,6 +9,8 @@ * \ingroup bke */ +#include + #include "BLI_buffer.h" #include "BLI_compiler_attrs.h" #include "BLI_map.hh" @@ -85,7 +87,7 @@ typedef struct SPHData { ParticleSystem *psys[10]; ParticleData *pa; float mass; - blender::Map eh; + std::optional> eh; float *gravity; float hfac; /* Average distance to neighbors (other particles in the support domain), diff --git a/source/blender/blenkernel/intern/particle_system.cc b/source/blender/blenkernel/intern/particle_system.cc index a7b8172a0d8..ca26b6a1cbd 100644 --- a/source/blender/blenkernel/intern/particle_system.cc +++ b/source/blender/blenkernel/intern/particle_system.cc @@ -1806,7 +1806,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa SPHRangeData pfr; SPHNeighbor *pfn; float *gravity = sphdata->gravity; - const blender::Map &springhash = sphdata->eh; + const std::optional> &springhash = sphdata->eh; float q, u, rij, dv[3]; float pressure, near_pressure; @@ -1890,9 +1890,9 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa if (spring_constant > 0.0f) { /* Viscoelastic spring force */ - if (pfn->psys == psys[0] && fluid->flag & SPH_VISCOELASTIC_SPRINGS && !springhash.is_empty()) + if (pfn->psys == psys[0] && fluid->flag & SPH_VISCOELASTIC_SPRINGS && springhash.has_value()) { - spring_index = springhash.lookup({index, pfn->index}); + spring_index = springhash->lookup_default({index, pfn->index}, 0); if (spring_index) { spring = psys[0]->fluid_springs + spring_index - 1;