[Bf-blender-cvs] [ac57332ddfd] functions: access current simulation time through accessor

Jacques Lucke noreply at git.blender.org
Mon Jul 1 13:44:16 CEST 2019


Commit: ac57332ddfd8660eeab994e3ada960b56140eee1
Author: Jacques Lucke
Date:   Mon Jul 1 12:42:08 2019 +0200
Branches: functions
https://developer.blender.org/rBac57332ddfd8660eeab994e3ada960b56140eee1

access current simulation time through accessor

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

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

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

diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index c29945d090c..ec94cd79ee2 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -168,14 +168,15 @@ class StepDescription {
 class ParticlesState {
  private:
   SmallMap<uint, ParticlesContainer *> m_container_by_id;
-
- public:
   float m_current_time = 0.0f;
 
+ public:
   ParticlesState() = default;
   ParticlesState(ParticlesState &other) = delete;
   ~ParticlesState();
 
+  float &current_time();
+
   SmallMap<uint, ParticlesContainer *> &particle_containers();
 
   ParticlesContainer &particle_container(uint type_id);
@@ -441,6 +442,11 @@ inline uint ParticlesState::particle_container_id(ParticlesContainer &container)
   return 0;
 }
 
+inline float &ParticlesState::current_time()
+{
+  return m_current_time;
+}
+
 /* BlockAllocator inline functions
  ********************************************/
 
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 6e8572e8d48..bdf032c0d10 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -764,8 +764,8 @@ BLI_NOINLINE static void emit_and_simulate_particles(ParticlesState &state,
 
 void simulate_step(ParticlesState &state, StepDescription &step_description)
 {
-  TimeSpan time_span(state.m_current_time, step_description.step_duration());
-  state.m_current_time = time_span.end();
+  TimeSpan time_span(state.current_time(), step_description.step_duration());
+  state.current_time() = time_span.end();
 
   ensure_required_containers_exist(state, step_description);
   ensure_required_attributes_exist(state, step_description);



More information about the Bf-blender-cvs mailing list