[Bf-blender-cvs] [8ee05156e64] functions: simulate all particle types with description

Jacques Lucke noreply at git.blender.org
Fri Jun 21 16:56:38 CEST 2019


Commit: 8ee05156e64bbeb28c5607e0ecd35ae096a0e3ce
Author: Jacques Lucke
Date:   Fri Jun 21 16:21:25 2019 +0200
Branches: functions
https://developer.blender.org/rB8ee05156e64bbeb28c5607e0ecd35ae096a0e3ce

simulate all particle types with description

===================================================================

M	source/blender/simulations/bparticles/core.cpp
M	source/blender/simulations/bparticles/simulate.cpp

===================================================================

diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index b6d46be5950..4febe4bf7b7 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -32,6 +32,9 @@ StepDescription::~StepDescription()
 
 ParticlesState::~ParticlesState()
 {
+  for (ParticlesContainer *container : m_particle_containers.values()) {
+    delete container;
+  }
 }
 
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 210129845ca..f82542ce1e4 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -437,14 +437,24 @@ void simulate_step(ParticlesState &state, StepDescription &description)
   TimeSpan time_span{state.m_current_time, description.step_duration()};
   state.m_current_time = time_span.end();
 
-  ParticlesContainer &particles = *state.particle_containers().lookup(0);
-  ParticleType &type = description.particle_type(0);
-
-  step_individual_particles(
-      particles.active_blocks().to_small_vector(), time_span, type.influences());
-  emit_new_particles_from_emitters(particles, type.emitters(), type.influences(), time_span);
-  delete_tagged_particles(particles.active_blocks().to_small_vector());
-  compress_all_blocks(particles);
+  auto &containers = state.particle_containers();
+
+  for (uint type_id : description.particle_type_ids()) {
+    if (!containers.contains(type_id)) {
+      /* TODO: create container */
+    }
+  }
+
+  for (uint type_id : description.particle_type_ids()) {
+    ParticleType &type = description.particle_type(type_id);
+    ParticlesContainer &container = *containers.lookup(type_id);
+
+    step_individual_particles(
+        container.active_blocks().to_small_vector(), time_span, type.influences());
+    emit_new_particles_from_emitters(container, type.emitters(), type.influences(), time_span);
+    delete_tagged_particles(container.active_blocks().to_small_vector());
+    compress_all_blocks(container);
+  }
 }
 
 }  // namespace BParticles



More information about the Bf-blender-cvs mailing list