[Bf-blender-cvs] [ed02e1d2526] functions: cleanup interface to solver

Jacques Lucke noreply at git.blender.org
Fri Jun 7 12:34:41 CEST 2019


Commit: ed02e1d2526dd489b42b900ffc84ccf253dc6b1d
Author: Jacques Lucke
Date:   Fri Jun 7 12:30:39 2019 +0200
Branches: functions
https://developer.blender.org/rBed02e1d2526dd489b42b900ffc84ccf253dc6b1d

cleanup interface to solver

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

M	source/blender/simulations/bparticles/c_wrapper.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/playground_solver.cpp

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

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp
index e66d6079ce5..496f6e3f4d3 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -42,7 +42,8 @@ void BParticles_solver_free(BParticlesSolver solver_c)
 BParticlesState BParticles_state_init(BParticlesSolver solver_c)
 {
   Solver *solver = unwrap(solver_c);
-  return wrap(solver->init());
+  StateBase *state = solver->init();
+  return wrap(new WrappedState(solver, std::unique_ptr<StateBase>(state)));
 }
 void BParticles_state_adapt(BParticlesSolver new_solver_c, BParticlesState state_to_adapt_c)
 {
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 7677d3bcc80..9da6b52bd87 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -19,7 +19,7 @@ class Solver {
  public:
   virtual ~Solver();
 
-  virtual WrappedState *init() = 0;
+  virtual StateBase *init() = 0;
   virtual void step(WrappedState &wrapped_state) = 0;
 
   virtual uint particle_amount(WrappedState &wrapped_state) = 0;
diff --git a/source/blender/simulations/bparticles/playground_solver.cpp b/source/blender/simulations/bparticles/playground_solver.cpp
index 9b2e5d70b46..80ff7c506d7 100644
--- a/source/blender/simulations/bparticles/playground_solver.cpp
+++ b/source/blender/simulations/bparticles/playground_solver.cpp
@@ -22,10 +22,9 @@ class SimpleSolver : public Solver {
   {
   }
 
-  WrappedState *init() override
+  StateBase *init() override
   {
-    MyState *state = new MyState();
-    return new WrappedState(this, std::unique_ptr<MyState>(state));
+    return new MyState();
   }
 
   void step(WrappedState &wrapped_state) override



More information about the Bf-blender-cvs mailing list