[Bf-blender-cvs] [3d939672928] functions: take event execute interface out of action interface
Jacques Lucke
noreply at git.blender.org
Wed Jul 10 17:17:54 CEST 2019
Commit: 3d939672928e403e1c53cd337667f6af06193fca
Author: Jacques Lucke
Date: Wed Jul 10 14:35:57 2019 +0200
Branches: functions
https://developer.blender.org/rB3d939672928e403e1c53cd337667f6af06193fca
take event execute interface out of action interface
===================================================================
M source/blender/simulations/bparticles/action_interface.cpp
M source/blender/simulations/bparticles/action_interface.hpp
M source/blender/simulations/bparticles/core.cpp
M source/blender/simulations/bparticles/core.hpp
===================================================================
diff --git a/source/blender/simulations/bparticles/action_interface.cpp b/source/blender/simulations/bparticles/action_interface.cpp
index 8d28f3c94f9..2c19e91cb74 100644
--- a/source/blender/simulations/bparticles/action_interface.cpp
+++ b/source/blender/simulations/bparticles/action_interface.cpp
@@ -9,26 +9,20 @@ Action::~Action()
void ActionInterface::execute_action_for_subset(ArrayRef<uint> indices,
std::unique_ptr<Action> &action)
{
- EventExecuteInterface &interface = m_event_execute_interface;
-
- ParticleSet &particles = interface.particles();
- auto current_times = interface.current_times();
-
SmallVector<float> sub_current_times;
SmallVector<uint> particle_indices;
for (uint i : indices) {
- particle_indices.append(particles.get_particle_index(i));
- sub_current_times.append(current_times[i]);
+ particle_indices.append(m_particles.get_particle_index(i));
+ sub_current_times.append(m_current_times[i]);
}
- ParticleSet sub_particles(particles.block(), particle_indices);
- EventExecuteInterface sub_execute_interface(sub_particles,
- interface.particle_allocator(),
- sub_current_times,
- interface.event_storage(),
- interface.attribute_offsets(),
- interface.step_end_time());
- ActionInterface sub_interface(sub_execute_interface, m_event_info);
+ ParticleSet sub_particles(m_particles.block(), particle_indices);
+ ActionInterface sub_interface(m_particle_allocator,
+ sub_particles,
+ m_attribute_offsets,
+ sub_current_times,
+ m_step_end_time,
+ m_event_info);
action->execute(sub_interface);
}
diff --git a/source/blender/simulations/bparticles/action_interface.hpp b/source/blender/simulations/bparticles/action_interface.hpp
index b0a28e46a32..b65fe4b2f6b 100644
--- a/source/blender/simulations/bparticles/action_interface.hpp
+++ b/source/blender/simulations/bparticles/action_interface.hpp
@@ -63,11 +63,20 @@ class ParticleFunction {
class ActionInterface {
private:
- EventExecuteInterface &m_event_execute_interface;
+ ParticleAllocator &m_particle_allocator;
+ ParticleSet m_particles;
+ AttributeArrays m_attribute_offsets;
EventInfo &m_event_info;
+ ArrayRef<float> m_current_times;
+ float m_step_end_time;
public:
- ActionInterface(EventExecuteInterface &event_execute_interface, EventInfo &event_info);
+ ActionInterface(ParticleAllocator &particle_allocator,
+ ParticleSet particles,
+ AttributeArrays attribute_offsets,
+ ArrayRef<float> current_times,
+ float step_end_time,
+ EventInfo &event_info);
EventInfo &event_info();
@@ -90,9 +99,18 @@ class Action {
/* ActionInterface inline functions
*******************************************/
-inline ActionInterface::ActionInterface(EventExecuteInterface &event_execute_interface,
+inline ActionInterface::ActionInterface(ParticleAllocator &particle_allocator,
+ ParticleSet particles,
+ AttributeArrays attribute_offsets,
+ ArrayRef<float> current_times,
+ float step_end_time,
EventInfo &event_info)
- : m_event_execute_interface(event_execute_interface), m_event_info(event_info)
+ : m_particle_allocator(particle_allocator),
+ m_particles(particles),
+ m_attribute_offsets(attribute_offsets),
+ m_current_times(current_times),
+ m_step_end_time(step_end_time),
+ m_event_info(event_info)
{
}
@@ -103,33 +121,35 @@ inline EventInfo &ActionInterface::event_info()
inline ParticleSet &ActionInterface::particles()
{
- return m_event_execute_interface.particles();
+ return m_particles;
}
inline AttributeArrays ActionInterface::attribute_offsets()
{
- return m_event_execute_interface.attribute_offsets();
+ return m_attribute_offsets;
}
inline float ActionInterface::remaining_time_in_step(uint index)
{
- return m_event_execute_interface.step_end_time() -
- m_event_execute_interface.current_times()[index];
+ return m_step_end_time - m_current_times[index];
}
inline ArrayRef<float> ActionInterface::current_times()
{
- return m_event_execute_interface.current_times();
+ return m_current_times;
}
inline void ActionInterface::kill(ArrayRef<uint> particle_indices)
{
- m_event_execute_interface.kill(particle_indices);
+ auto kill_states = m_particles.attributes().get_byte("Kill State");
+ for (uint pindex : particle_indices) {
+ kill_states[pindex] = 1;
+ }
}
inline ParticleAllocator &ActionInterface::particle_allocator()
{
- return m_event_execute_interface.particle_allocator();
+ return m_particle_allocator;
}
} // namespace BParticles
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index 045aa802f35..19044811a2c 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -268,7 +268,6 @@ EventExecuteInterface::EventExecuteInterface(ParticleSet particles,
: m_particles(particles),
m_particle_allocator(particle_allocator),
m_current_times(current_times),
- m_kill_states(m_particles.attributes().get_byte("Kill State")),
m_event_storage(event_storage),
m_attribute_offsets(attribute_offsets),
m_step_end_time(step_end_time)
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index f93d361f286..41612317284 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -461,7 +461,6 @@ class EventExecuteInterface {
ParticleSet m_particles;
ParticleAllocator &m_particle_allocator;
ArrayRef<float> m_current_times;
- ArrayRef<uint8_t> m_kill_states;
EventStorage &m_event_storage;
AttributeArrays m_attribute_offsets;
float m_step_end_time;
@@ -502,11 +501,6 @@ class EventExecuteInterface {
*/
AttributeArrays attribute_offsets();
- /**
- * Kill all particles with the given indices in the current block.
- */
- void kill(ArrayRef<uint> particle_indices);
-
/**
* Get a block allocator. Not that the request_emit_target should usually be used instead.
*/
@@ -814,13 +808,6 @@ inline ParticleSet &EventExecuteInterface::particles()
return m_particles;
}
-inline void EventExecuteInterface::kill(ArrayRef<uint> particle_indices)
-{
- for (uint pindex : particle_indices) {
- m_kill_states[pindex] = 1;
- }
-}
-
inline ArrayRef<float> EventExecuteInterface::current_times()
{
return m_current_times;
More information about the Bf-blender-cvs
mailing list