[Bf-blender-cvs] [20c7fa6bcc1] functions: extract temporary method for old particle deletion

Jacques Lucke noreply at git.blender.org
Wed Jun 19 10:37:31 CEST 2019


Commit: 20c7fa6bcc13c8c67b1e51f8fff9d1ebbb868e78
Author: Jacques Lucke
Date:   Wed Jun 19 10:34:08 2019 +0200
Branches: functions
https://developer.blender.org/rB20c7fa6bcc13c8c67b1e51f8fff9d1ebbb868e78

extract temporary method for old particle deletion

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

M	source/blender/simulations/bparticles/playground_solver.cpp

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

diff --git a/source/blender/simulations/bparticles/playground_solver.cpp b/source/blender/simulations/bparticles/playground_solver.cpp
index 9c6fe145533..eb1ecb7683a 100644
--- a/source/blender/simulations/bparticles/playground_solver.cpp
+++ b/source/blender/simulations/bparticles/playground_solver.cpp
@@ -185,15 +185,7 @@ class SimpleSolver : public Solver {
     }
 
     /* Temporary Kill Code */
-    auto birth_times = attributes.get_float("Birth Time");
-    auto kill_states = attributes.get_byte("Kill State");
-
-    for (uint pindex : indices_mask) {
-      float age = state.seconds_since_start - birth_times[pindex];
-      if (age > 5) {
-        kill_states[pindex] = 1;
-      }
-    }
+    this->tag_old_particles_for_deletion(state, attributes, indices_mask);
   }
 
   struct EventIndexAtTime {
@@ -377,6 +369,21 @@ class SimpleSolver : public Solver {
     }
   }
 
+  BLI_NOINLINE void tag_old_particles_for_deletion(MyState &state,
+                                                   AttributeArrays attributes,
+                                                   ArrayRef<uint> indices_mask)
+  {
+    auto birth_times = attributes.get_float("Birth Time");
+    auto kill_states = attributes.get_byte("Kill State");
+
+    for (uint pindex : indices_mask) {
+      float age = state.seconds_since_start - birth_times[pindex];
+      if (age > 5) {
+        kill_states[pindex] = 1;
+      }
+    }
+  }
+
   BLI_NOINLINE void delete_dead_particles(ArrayRef<ParticlesBlock *> blocks)
   {
     for (auto block : blocks) {



More information about the Bf-blender-cvs mailing list