[Bf-blender-cvs] [89001688d6f] functions: rename EventInfo to ActionContext

Jacques Lucke noreply at git.blender.org
Wed Jul 24 19:11:46 CEST 2019


Commit: 89001688d6fc85bb5bd457630982c2b2dd7d6f58
Author: Jacques Lucke
Date:   Wed Jul 24 13:56:07 2019 +0200
Branches: functions
https://developer.blender.org/rB89001688d6fc85bb5bd457630982c2b2dd7d6f58

rename EventInfo to ActionContext

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

M	source/blender/simulations/bparticles/action_interface.cpp
M	source/blender/simulations/bparticles/action_interface.hpp
M	source/blender/simulations/bparticles/actions.cpp
M	source/blender/simulations/bparticles/events.cpp
M	source/blender/simulations/bparticles/events.hpp

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

diff --git a/source/blender/simulations/bparticles/action_interface.cpp b/source/blender/simulations/bparticles/action_interface.cpp
index 8a01e3d85d0..a4df084b767 100644
--- a/source/blender/simulations/bparticles/action_interface.cpp
+++ b/source/blender/simulations/bparticles/action_interface.cpp
@@ -7,7 +7,7 @@ Action::~Action()
 }
 
 ParticleFunctionCaller ParticleFunction::get_caller(AttributeArrays attributes,
-                                                    EventInfo &event_info)
+                                                    ActionContext &action_context)
 {
   ParticleFunctionCaller caller;
   caller.m_body = m_tuple_call;
@@ -18,7 +18,7 @@ ParticleFunctionCaller ParticleFunction::get_caller(AttributeArrays attributes,
     uint stride = 0;
     if (input_name.startswith("Event")) {
       StringRef event_attribute_name = input_name.drop_prefix("Event: ");
-      ptr = event_info.get_info_array(event_attribute_name);
+      ptr = action_context.get_info_array(event_attribute_name);
       stride = sizeof(float3); /* TODO make not hardcoded */
     }
     else if (input_name.startswith("Attribute")) {
diff --git a/source/blender/simulations/bparticles/action_interface.hpp b/source/blender/simulations/bparticles/action_interface.hpp
index baf9e60cb03..ad5d7e2d997 100644
--- a/source/blender/simulations/bparticles/action_interface.hpp
+++ b/source/blender/simulations/bparticles/action_interface.hpp
@@ -11,7 +11,7 @@ using FN::SharedFunction;
 using FN::Tuple;
 using FN::TupleCallBody;
 
-class EventInfo {
+class ActionContext {
  public:
   virtual void *get_info_array(StringRef name) = 0;
 };
@@ -58,7 +58,7 @@ class ParticleFunction {
     BLI_assert(m_tuple_call);
   }
 
-  ParticleFunctionCaller get_caller(AttributeArrays attributes, EventInfo &event_info);
+  ParticleFunctionCaller get_caller(AttributeArrays attributes, ActionContext &action_context);
 };
 
 class ActionInterface {
@@ -69,7 +69,7 @@ class ActionInterface {
   AttributeArrays m_attribute_offsets;
   ArrayRef<float> m_current_times;
   ArrayRef<float> m_remaining_durations;
-  EventInfo &m_event_info;
+  ActionContext &m_action_context;
 
  public:
   ActionInterface(ParticleAllocator &particle_allocator,
@@ -78,9 +78,9 @@ class ActionInterface {
                   AttributeArrays attribute_offsets,
                   ArrayRef<float> current_times,
                   ArrayRef<float> remaining_durations,
-                  EventInfo &event_info);
+                  ActionContext &action_context);
 
-  EventInfo &event_info();
+  ActionContext &context();
 
   ParticleSet &particles();
   AttributeArrays attribute_offsets();
@@ -100,8 +100,9 @@ class Action {
 
   void execute_from_emitter(ParticleSets &particle_sets,
                             EmitterInterface &emitter_interface,
-                            EventInfo *event_info = nullptr);
-  void execute_from_event(EventExecuteInterface &event_interface, EventInfo *event_info = nullptr);
+                            ActionContext *action_context = nullptr);
+  void execute_from_event(EventExecuteInterface &event_interface,
+                          ActionContext *action_context = nullptr);
   void execute_for_subset(ArrayRef<uint> pindices, ActionInterface &action_interface);
 };
 
@@ -114,18 +115,18 @@ inline ActionInterface::ActionInterface(ParticleAllocator &particle_allocator,
                                         AttributeArrays attribute_offsets,
                                         ArrayRef<float> current_times,
                                         ArrayRef<float> remaining_durations,
-                                        EventInfo &event_info)
+                                        ActionContext &action_context)
     : m_particle_allocator(particle_allocator),
       m_array_allocator(array_allocator),
       m_particles(particles),
       m_attribute_offsets(attribute_offsets),
       m_current_times(current_times),
       m_remaining_durations(remaining_durations),
-      m_event_info(event_info)
+      m_action_context(action_context)
 {
 }
 
-class EmptyEventInfo : public EventInfo {
+class EmptyEventInfo : public ActionContext {
   void *get_info_array(StringRef UNUSED(name))
   {
     return nullptr;
@@ -134,14 +135,15 @@ class EmptyEventInfo : public EventInfo {
 
 inline void Action::execute_from_emitter(ParticleSets &particle_sets,
                                          EmitterInterface &emitter_interface,
-                                         EventInfo *event_info)
+                                         ActionContext *action_context)
 {
   AttributesInfo info;
   AttributeArraysCore offsets_core(info, {}, 0);
   AttributeArrays offsets = offsets_core.slice_all();
 
-  EmptyEventInfo empty_event_info;
-  EventInfo &used_event_info = (event_info == nullptr) ? empty_event_info : *event_info;
+  EmptyEventInfo empty_action_context;
+  ActionContext &used_action_context = (action_context == nullptr) ? empty_action_context :
+                                                                     *action_context;
 
   for (ParticleSet particles : particle_sets.sets()) {
     ArrayAllocator::Array<float> durations(emitter_interface.array_allocator());
@@ -152,16 +154,17 @@ inline void Action::execute_from_emitter(ParticleSets &particle_sets,
                                      offsets,
                                      particles.attributes().get_float("Birth Time"),
                                      durations,
-                                     used_event_info);
+                                     used_action_context);
     this->execute(action_interface);
   }
 }
 
 inline void Action::execute_from_event(EventExecuteInterface &event_interface,
-                                       EventInfo *event_info)
+                                       ActionContext *action_context)
 {
-  EmptyEventInfo empty_event_info;
-  EventInfo &used_event_info = (event_info == nullptr) ? empty_event_info : *event_info;
+  EmptyEventInfo empty_action_context;
+  ActionContext &used_action_context = (action_context == nullptr) ? empty_action_context :
+                                                                     *action_context;
 
   ActionInterface action_interface(event_interface.particle_allocator(),
                                    event_interface.array_allocator(),
@@ -169,7 +172,7 @@ inline void Action::execute_from_event(EventExecuteInterface &event_interface,
                                    event_interface.attribute_offsets(),
                                    event_interface.current_times(),
                                    event_interface.remaining_durations(),
-                                   used_event_info);
+                                   used_action_context);
   this->execute(action_interface);
 }
 
@@ -181,13 +184,13 @@ inline void Action::execute_for_subset(ArrayRef<uint> pindices, ActionInterface
                                 action_interface.attribute_offsets(),
                                 action_interface.current_times(),
                                 action_interface.remaining_durations(),
-                                action_interface.event_info());
+                                action_interface.context());
   this->execute(sub_interface);
 }
 
-inline EventInfo &ActionInterface::event_info()
+inline ActionContext &ActionInterface::context()
 {
-  return m_event_info;
+  return m_action_context;
 }
 
 inline ParticleSet &ActionInterface::particles()
diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp
index a85bd34b257..d946a8671f2 100644
--- a/source/blender/simulations/bparticles/actions.cpp
+++ b/source/blender/simulations/bparticles/actions.cpp
@@ -15,7 +15,7 @@ void ChangeDirectionAction::execute(ActionInterface &interface)
   auto position_offsets = interface.attribute_offsets().try_get_float3("Position");
   auto velocity_offsets = interface.attribute_offsets().try_get_float3("Velocity");
 
-  auto caller = m_compute_inputs.get_caller(particles.attributes(), interface.event_info());
+  auto caller = m_compute_inputs.get_caller(particles.attributes(), interface.context());
 
   FN_TUPLE_CALL_ALLOC_TUPLES(caller.body(), fn_in, fn_out);
 
@@ -66,7 +66,7 @@ void ExplodeAction::execute(ActionInterface &interface)
   Vector<float3> new_velocities;
   Vector<float> new_birth_times;
 
-  auto caller = m_compute_inputs.get_caller(particles.attributes(), interface.event_info());
+  auto caller = m_compute_inputs.get_caller(particles.attributes(), interface.context());
   FN_TUPLE_CALL_ALLOC_TUPLES(caller.body(), fn_in, fn_out);
 
   FN::ExecutionStack stack;
@@ -119,7 +119,7 @@ void ConditionAction::compute_conditions(ActionInterface &interface, ArrayRef<bo
 {
   ParticleSet particles = interface.particles();
 
-  auto caller = m_compute_inputs.get_caller(particles.attributes(), interface.event_info());
+  auto caller = m_compute_inputs.get_caller(particles.attributes(), interface.context());
   FN_TUPLE_CALL_ALLOC_TUPLES(caller.body(), fn_in, fn_out);
 
   FN::ExecutionStack stack;
diff --git a/source/blender/simulations/bparticles/events.cpp b/source/blender/simulations/bparticles/events.cpp
index 8668c33a67c..ef60b6c9eaf 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -131,8 +131,8 @@ void MeshCollisionEvent::execute(EventExecuteInterface &interface)
     last_collision_times[pindex] = interface.current_times()[pindex];
   }
 
-  CollisionEventInfo event_info(normals);
-  m_action->execute_from_event(interface, &event_info);
+  CollisionEventInfo action_context(normals);
+  m_action->execute_from_event(interface, &action_context);
 }
 
 void CloseByPointsEvent::filter(EventFilterInterface &interface)
diff --git a/source/blender/simulations/bparticles/events.hpp b/source/blender/simulations/bparticles/events.hpp
index 1ef7675d1ab..6cc15c48cd5 100644
--- a/source/blender/simulations/bparticles/events.hpp
+++ b/source/blender/simulations/bparticles/events.hpp
@@ -39,7 +39,7 @@ class AgeReachedEvent : public Event {
   void execute(EventExecuteInterface &interface) override;
 };
 
-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list