[Bf-blender-cvs] [e47c49c8728] functions: remove redundant information

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


Commit: e47c49c87286fd4466a5bed8aff749330a90051f
Author: Jacques Lucke
Date:   Thu Jul 18 13:40:36 2019 +0200
Branches: functions
https://developer.blender.org/rBe47c49c87286fd4466a5bed8aff749330a90051f

remove redundant information

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

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

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

diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index 04319249dab..95815cd08b4 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -365,9 +365,9 @@ IntegratorInterface::IntegratorInterface(ParticlesBlock &block,
  ****************************************************/
 
 ForwardingListenerInterface::ForwardingListenerInterface(BlockStepData &step_data,
-                                                         ParticleSet &particles,
+                                                         ArrayRef<uint> pindices,
                                                          ArrayRef<float> time_factors)
-    : m_step_data(step_data), m_particles(particles), m_time_factors(time_factors)
+    : m_step_data(step_data), m_pindices(pindices), m_time_factors(time_factors)
 {
 }
 
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 6ac297c0937..ece6e18fb07 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -587,15 +587,15 @@ class IntegratorInterface {
 class ForwardingListenerInterface {
  private:
   BlockStepData &m_step_data;
-  ParticleSet m_particles;
+  ArrayRef<uint> m_pindices;
   ArrayRef<float> m_time_factors;
 
  public:
   ForwardingListenerInterface(BlockStepData &step_data,
-                              ParticleSet &particles,
+                              ArrayRef<uint> pindices,
                               ArrayRef<float> time_factors);
 
-  ParticleSet &particles();
+  ParticleSet particles();
   ParticleAllocator &particle_allocator();
   AttributeArrays &offsets();
   ArrayRef<float> time_factors();
@@ -895,9 +895,9 @@ inline AttributeArrays IntegratorInterface::offset_targets()
 /* ForwardingListenerInterface inline functions
  **********************************************/
 
-inline ParticleSet &ForwardingListenerInterface::particles()
+inline ParticleSet ForwardingListenerInterface::particles()
 {
-  return m_particles;
+  return ParticleSet(m_step_data.block, m_pindices);
 }
 
 inline ParticleAllocator &ForwardingListenerInterface::particle_allocator()
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index fe7457807c8..20659e2a6bf 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -65,13 +65,15 @@ BLI_NOINLINE static void find_next_event_per_particle(BlockStepData &step_data,
 }
 
 BLI_NOINLINE static void forward_particles_to_next_event_or_end(
-    BlockStepData &step_data, ParticleSet particles, ArrayRef<float> time_factors_to_next_event)
+    BlockStepData &step_data, ArrayRef<uint> pindices, ArrayRef<float> time_factors_to_next_event)
 {
-  ForwardingListenerInterface interface(step_data, particles, time_factors_to_next_event);
+  ForwardingListenerInterface interface(step_data, pindices, time_factors_to_next_event);
   for (ForwardingListener *listener : step_data.particle_type.forwarding_listeners()) {
     listener->listen(interface);
   }
 
+  ParticleSet particles(step_data.block, pindices);
+
   auto attribute_offsets = step_data.attribute_offsets;
   for (uint attribute_index : attribute_offsets.info().float3_attributes()) {
     StringRef name = attribute_offsets.info().name_of(attribute_index);
@@ -197,7 +199,8 @@ BLI_NOINLINE static void simulate_to_next_event(BlockStepData &step_data,
                                time_factors_to_next_event,
                                pindices_with_event);
 
-  forward_particles_to_next_event_or_end(step_data, particles, time_factors_to_next_event);
+  forward_particles_to_next_event_or_end(
+      step_data, particles.pindices(), time_factors_to_next_event);
 
   update_remaining_attribute_offsets(
       pindices_with_event, time_factors_to_next_event, step_data.attribute_offsets);
@@ -291,7 +294,7 @@ BLI_NOINLINE static void apply_remaining_offsets(BlockStepData &step_data, Parti
       time_factors[pindex] = 1.0f;
     }
 
-    ForwardingListenerInterface interface(step_data, particles, time_factors);
+    ForwardingListenerInterface interface(step_data, particles.pindices(), time_factors);
     for (ForwardingListener *listener : step_data.particle_type.forwarding_listeners()) {
       listener->listen(interface);
     }



More information about the Bf-blender-cvs mailing list