[Bf-blender-cvs] [1272208b2b1] functions: remove redundant information

Jacques Lucke noreply at git.blender.org
Thu Jul 18 18:19:21 CEST 2019


Commit: 1272208b2b14c6b5637210432a04b6ec28d9e2aa
Author: Jacques Lucke
Date:   Thu Jul 18 13:52:58 2019 +0200
Branches: functions
https://developer.blender.org/rB1272208b2b14c6b5637210432a04b6ec28d9e2aa

remove redundant information

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

M	source/blender/simulations/bparticles/core.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/events.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 95815cd08b4..43af3939bcb 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -337,11 +337,11 @@ EventFilterInterface::EventFilterInterface(BlockStepData &step_data,
  *************************************************/
 
 EventExecuteInterface::EventExecuteInterface(BlockStepData &step_data,
-                                             ParticleSet particles,
+                                             ArrayRef<uint> pindices,
                                              ArrayRef<float> current_times,
                                              EventStorage &event_storage)
     : m_step_data(step_data),
-      m_particles(particles),
+      m_pindices(pindices),
       m_current_times(current_times),
       m_event_storage(event_storage)
 {
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index ece6e18fb07..5f827c7f058 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -494,13 +494,13 @@ class EventFilterInterface {
 class EventExecuteInterface {
  private:
   BlockStepData &m_step_data;
-  ParticleSet m_particles;
+  ArrayRef<uint> m_pindices;
   ArrayRef<float> m_current_times;
   EventStorage &m_event_storage;
 
  public:
   EventExecuteInterface(BlockStepData &step_data,
-                        ParticleSet particles,
+                        ArrayRef<uint> pindices,
                         ArrayRef<float> current_times,
                         EventStorage &event_storage);
 
@@ -509,7 +509,7 @@ class EventExecuteInterface {
   /**
    * Access the set of particles that should be modified by this event.
    */
-  ParticleSet &particles();
+  ParticleSet particles();
 
   /**
    * Get the time at which every particle is modified by this event.
@@ -847,9 +847,9 @@ inline EventStorage &EventExecuteInterface::event_storage()
   return m_event_storage;
 }
 
-inline ParticleSet &EventExecuteInterface::particles()
+inline ParticleSet EventExecuteInterface::particles()
 {
-  return m_particles;
+  return ParticleSet(m_step_data.block, m_pindices);
 }
 
 inline ArrayRef<float> EventExecuteInterface::current_times()
diff --git a/source/blender/simulations/bparticles/events.cpp b/source/blender/simulations/bparticles/events.cpp
index 0d8aa87ac58..bd2034fe42f 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -115,7 +115,7 @@ MeshCollisionEvent::RayCastResult MeshCollisionEvent::ray_cast(float3 start,
 
 void MeshCollisionEvent::execute(EventExecuteInterface &interface)
 {
-  ParticleSet &particles = interface.particles();
+  ParticleSet particles = interface.particles();
   SmallVector<float3> normals(particles.block().active_amount());
   auto last_collision_times = particles.attributes().get_float(m_identifier);
 
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 3e8137020de..2d1ab632c61 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -168,12 +168,13 @@ BLI_NOINLINE static void execute_events(BlockStepData &step_data,
 
   for (uint event_index = 0; event_index < events.size(); event_index++) {
     Event *event = events[event_index];
-    ParticleSet particles(step_data.block, pindices_per_event[event_index]);
-    if (particles.size() == 0) {
+    ArrayRef<uint> pindices = pindices_per_event[event_index];
+
+    if (pindices.size() == 0) {
       continue;
     }
 
-    EventExecuteInterface interface(step_data, particles, current_times, event_storage);
+    EventExecuteInterface interface(step_data, pindices, current_times, event_storage);
     event->execute(interface);
   }
 }



More information about the Bf-blender-cvs mailing list