fix killing particles
This commit is contained in:
@@ -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__ */
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user