fix killing particles

This commit is contained in:
2020-02-04 16:48:46 +01:00
parent 601ed4061a
commit cf59daf62f
2 changed files with 18 additions and 2 deletions

View File

@@ -134,6 +134,19 @@ void parallel_map_items(const StringMap<ValueT> &string_map, const FuncT &func)
});
}
template<typename ValueT, typename FuncT>
void parallel_map_keys(const StringMap<ValueT> &string_map, const FuncT &func)
{
ScopedVector<StringRefNull> key_vector;
string_map.foreach_item([&](StringRefNull key, const ValueT &value) { key_vector.append(key); });
parallel_for(key_vector.index_range(), [&](uint index) {
StringRefNull key = key_vector[index];
func(key);
});
}
} // namespace BLI
#endif /* __BLI_PARALLEL_H__ */

View File

@@ -484,9 +484,12 @@ void simulate_particles(SimulationState &simulation_state,
main_set.add_particles(*set);
delete set;
}
delete_tagged_particles_and_reorder(main_set);
});
BLI::parallel_map_keys(systems_to_simulate, [&](StringRef name) {
ParticleSet &particles = particles_state.particle_container(name);
delete_tagged_particles_and_reorder(particles);
});
}
} // namespace BParticles