[Bf-blender-cvs] [f2737b927d5] functions: rename ForwardListener to OffsetHandler

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


Commit: f2737b927d5286a7f68d2ba93ffeaf6385128abd
Author: Jacques Lucke
Date:   Thu Jul 18 14:04:38 2019 +0200
Branches: functions
https://developer.blender.org/rBf2737b927d5286a7f68d2ba93ffeaf6385128abd

rename ForwardListener to OffsetHandler

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

M	source/blender/simulations/bparticles/core.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/forces.cpp
M	source/blender/simulations/bparticles/forces.hpp
M	source/blender/simulations/bparticles/inserters.cpp
M	source/blender/simulations/bparticles/inserters.hpp
M	source/blender/simulations/bparticles/node_frontend.cpp
M	source/blender/simulations/bparticles/simulate.cpp
M	source/blender/simulations/bparticles/step_description.hpp

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

diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index 43af3939bcb..e66ba6373c6 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -14,7 +14,7 @@ Event::~Event()
 {
 }
 
-ForwardingListener::~ForwardingListener()
+OffsetHandler::~OffsetHandler()
 {
 }
 
@@ -22,7 +22,7 @@ ParticleType::~ParticleType()
 {
 }
 
-ArrayRef<ForwardingListener *> ParticleType::forwarding_listeners()
+ArrayRef<OffsetHandler *> ParticleType::offset_handlers()
 {
   return {};
 }
@@ -361,12 +361,12 @@ IntegratorInterface::IntegratorInterface(ParticlesBlock &block,
 {
 }
 
-/* ForwardingListenerInterface
+/* OffsetHandlerInterface
  ****************************************************/
 
-ForwardingListenerInterface::ForwardingListenerInterface(BlockStepData &step_data,
-                                                         ArrayRef<uint> pindices,
-                                                         ArrayRef<float> time_factors)
+OffsetHandlerInterface::OffsetHandlerInterface(BlockStepData &step_data,
+                                               ArrayRef<uint> pindices,
+                                               ArrayRef<float> 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 5f827c7f058..625266df706 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -25,7 +25,7 @@ class EventFilterInterface;
 class EventExecuteInterface;
 class EmitterInterface;
 class IntegratorInterface;
-class ForwardingListenerInterface;
+class OffsetHandlerInterface;
 
 /* Main API for the particle simulation. These classes have to be subclassed to define how the
  * particles should behave.
@@ -119,11 +119,11 @@ class Integrator {
   virtual void integrate(IntegratorInterface &interface) = 0;
 };
 
-class ForwardingListener {
+class OffsetHandler {
  public:
-  virtual ~ForwardingListener();
+  virtual ~OffsetHandler();
 
-  virtual void listen(ForwardingListenerInterface &interface) = 0;
+  virtual void execute(OffsetHandlerInterface &interface) = 0;
 };
 
 /**
@@ -138,7 +138,7 @@ class ParticleType {
    */
   virtual Integrator &integrator() = 0;
 
-  virtual ArrayRef<ForwardingListener *> forwarding_listeners();
+  virtual ArrayRef<OffsetHandler *> offset_handlers();
 
   /**
    * Return the events that particles of this type can trigger.
@@ -584,16 +584,16 @@ class IntegratorInterface {
   AttributeArrays offset_targets();
 };
 
-class ForwardingListenerInterface {
+class OffsetHandlerInterface {
  private:
   BlockStepData &m_step_data;
   ArrayRef<uint> m_pindices;
   ArrayRef<float> m_time_factors;
 
  public:
-  ForwardingListenerInterface(BlockStepData &step_data,
-                              ArrayRef<uint> pindices,
-                              ArrayRef<float> time_factors);
+  OffsetHandlerInterface(BlockStepData &step_data,
+                         ArrayRef<uint> pindices,
+                         ArrayRef<float> time_factors);
 
   ParticleSet particles();
   ParticleAllocator &particle_allocator();
@@ -892,40 +892,40 @@ inline AttributeArrays IntegratorInterface::offset_targets()
   return m_offsets;
 }
 
-/* ForwardingListenerInterface inline functions
+/* OffsetHandlerInterface inline functions
  **********************************************/
 
-inline ParticleSet ForwardingListenerInterface::particles()
+inline ParticleSet OffsetHandlerInterface::particles()
 {
   return ParticleSet(m_step_data.block, m_pindices);
 }
 
-inline ParticleAllocator &ForwardingListenerInterface::particle_allocator()
+inline ParticleAllocator &OffsetHandlerInterface::particle_allocator()
 {
   return m_step_data.particle_allocator;
 }
 
-inline AttributeArrays &ForwardingListenerInterface::offsets()
+inline AttributeArrays &OffsetHandlerInterface::offsets()
 {
   return m_step_data.attribute_offsets;
 }
 
-inline ArrayRef<float> ForwardingListenerInterface::time_factors()
+inline ArrayRef<float> OffsetHandlerInterface::time_factors()
 {
   return m_time_factors;
 }
 
-inline float ForwardingListenerInterface::step_end_time()
+inline float OffsetHandlerInterface::step_end_time()
 {
   return m_step_data.step_end_time;
 }
 
-inline ArrayRef<float> ForwardingListenerInterface::durations()
+inline ArrayRef<float> OffsetHandlerInterface::durations()
 {
   return m_step_data.remaining_durations;
 }
 
-inline TimeSpan ForwardingListenerInterface::time_span(uint pindex)
+inline TimeSpan OffsetHandlerInterface::time_span(uint pindex)
 {
   float duration = m_step_data.remaining_durations[pindex];
   return TimeSpan(m_step_data.step_end_time - duration, duration);
diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp
index 7e39e512cd8..8c6bfe1b963 100644
--- a/source/blender/simulations/bparticles/forces.cpp
+++ b/source/blender/simulations/bparticles/forces.cpp
@@ -44,7 +44,7 @@ void TurbulenceForce::add_force(ParticlesBlock &block, ArrayRef<float3> r_force)
   }
 }
 
-void TrailListener::listen(ForwardingListenerInterface &interface)
+void CreateTrailHandler::execute(OffsetHandlerInterface &interface)
 {
   ParticleSet particles = interface.particles();
   auto positions = particles.attributes().get_float3("Position");
diff --git a/source/blender/simulations/bparticles/forces.hpp b/source/blender/simulations/bparticles/forces.hpp
index f9c3b21ed5c..365c27ff07a 100644
--- a/source/blender/simulations/bparticles/forces.hpp
+++ b/source/blender/simulations/bparticles/forces.hpp
@@ -40,17 +40,17 @@ class TurbulenceForce : public Force {
   void add_force(ParticlesBlock &block, ArrayRef<float3> r_force) override;
 };
 
-class TrailListener : public ForwardingListener {
+class CreateTrailHandler : public OffsetHandler {
  private:
   std::string m_particle_type_name;
 
  public:
-  TrailListener(StringRef particle_type_name)
+  CreateTrailHandler(StringRef particle_type_name)
       : m_particle_type_name(particle_type_name.to_std_string())
   {
   }
 
-  void listen(ForwardingListenerInterface &interface) override;
+  void execute(OffsetHandlerInterface &interface) override;
 };
 
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/inserters.cpp b/source/blender/simulations/bparticles/inserters.cpp
index 7ca19b297f7..417ad7131e2 100644
--- a/source/blender/simulations/bparticles/inserters.cpp
+++ b/source/blender/simulations/bparticles/inserters.cpp
@@ -397,15 +397,14 @@ static std::unique_ptr<Emitter> BUILD_EMITTER_initial_grid(BuildContext &ctx,
                              body->get_output<float>(fn_out, 4, "Size")));
 }
 
-static std::unique_ptr<ForwardingListener> BUILD_FORWARDING_LISTENER_trails(BuildContext &ctx,
-                                                                            bNode *bnode)
+static std::unique_ptr<OffsetHandler> BUILD_OFFSET_HANDLER_trails(BuildContext &ctx, bNode *bnode)
 {
   PointerRNA rna = ctx.indexed_tree.get_rna(bnode);
   char name[65];
   RNA_string_get(&rna, "particle_type_name", name);
 
   if (ctx.step_description.m_types.contains(name)) {
-    return std::unique_ptr<ForwardingListener>(new TrailListener(name));
+    return std::unique_ptr<OffsetHandler>(new CreateTrailHandler(name));
   }
   else {
     return {};
@@ -439,10 +438,10 @@ BLI_LAZY_INIT(StringMap<EmitterFromNodeCallback>, get_emitter_builders)
   return map;
 }
 
-BLI_LAZY_INIT(StringMap<ForwardingListenerFromNodeCallback>, get_forwarding_listener_builders)
+BLI_LAZY_INIT(StringMap<OffsetHandlerFromNodeCallback>, get_offset_handler_builders)
 {
-  StringMap<ForwardingListenerFromNodeCallback> map;
-  map.add_new("bp_ParticleTrailsNode", BUILD_FORWARDING_LISTENER_trails);
+  StringMap<OffsetHandlerFromNodeCallback> map;
+  map.add_new("bp_ParticleTrailsNode", BUILD_OFFSET_HANDLER_trails);
   return map;
 }
 
diff --git a/source/blender/simulations/bparticles/inserters.hpp b/source/blender/simulations/bparticles/inserters.hpp
index 845a5a961e7..1395c32623a 100644
--- a/source/blender/simulations/bparticles/inserters.hpp
+++ b/source/blender/simulations/bparticles/inserters.hpp
@@ -40,9 +40,9 @@ using EmitterFromNodeCallback = std::function<std::unique_ptr<Emitter>(
 
 StringMap<EmitterFromNodeCallback> &get_emitter_builders();
 
-using ForwardingListenerFromNodeCallback =
-    std::function<std::unique_ptr<ForwardingListener>(BuildContext &ctx, bNode *bnode)>;
+using OffsetHandlerFromNodeCallback =
+    std::function<std::unique_ptr<OffsetHandler>(BuildContext &ctx, bNode *bnode)>;
 
-StringMap<ForwardingListenerFromNodeCallback> &get_forwarding_listener_builders();
+StringMap<OffsetHandlerFromNodeCallback> &get_offset_handler_builders();
 
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index 185c61cb535..b259f66a4fd 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -60,7 +60,7 @@ std::unique_ptr<StepDescription> step_description_from_node_tree(IndexedNodeTree
     }
   }
 
-  for (auto item : get_forwarding_listener_builders().items()) {
+  for (auto item : get_offset_handler_builders().items()) {
     for (bNode *bnode : indexed_tree.nodes_with_idname(item.key)) {
       bNodeSocket *listener_output = bSocketList(bnode->outputs).get(0);
       for (SocketWithNode linked : indexed_tree.linked(listener_output)) {
@@ -68,7 +68,7 @@ std::unique_ptr<StepDescription> step_description_from_node_tree(IndexedNodeTree
           auto listener = item.value(ctx, bnode);
           if (listener) {
             step_description->m_types.lookup_ref(linked.node->name)
-                ->m_forwarding_listeners.append(listener.release());
+                ->m_offset_handlers.append(listener.release());
           }
         }
       }
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 2d1ab632c61..f3f62

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list