[Bf-blender-cvs] [357be047aaa] functions: build virtual node tree in constructor
Jacques Lucke
noreply at git.blender.org
Mon Aug 26 15:37:37 CEST 2019
Commit: 357be047aaacd5042f6d3224326d9ce56b359e27
Author: Jacques Lucke
Date: Mon Aug 26 12:17:51 2019 +0200
Branches: functions
https://developer.blender.org/rB357be047aaacd5042f6d3224326d9ce56b359e27
build virtual node tree in constructor
===================================================================
M source/blender/simulations/bparticles/node_frontend.cpp
M source/blender/simulations/bparticles/step_simulator.hpp
===================================================================
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index 586e5a19271..8a05fef7624 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -494,17 +494,17 @@ static void collect_particle_behaviors(
class NodeTreeStepSimulator : public StepSimulator {
private:
bNodeTree *m_btree;
+ VirtualNodeTree m_vtree;
public:
NodeTreeStepSimulator(bNodeTree *btree) : m_btree(btree)
{
+ m_vtree.add_all_of_tree(m_btree);
+ m_vtree.freeze_and_index();
}
- void simulate(SimulationState &simulation_state, float time_step) const override
+ void simulate(SimulationState &simulation_state, float time_step) override
{
- VirtualNodeTree vtree;
- vtree.add_all_of_tree(m_btree);
- vtree.freeze_and_index();
Vector<std::string> type_names;
Vector<Emitter *> emitters;
@@ -513,7 +513,7 @@ class NodeTreeStepSimulator : public StepSimulator {
StringMap<AttributesDeclaration> attributes;
StringMap<Integrator *> integrators;
- collect_particle_behaviors(vtree,
+ collect_particle_behaviors(m_vtree,
simulation_state.world(),
type_names,
emitters,
diff --git a/source/blender/simulations/bparticles/step_simulator.hpp b/source/blender/simulations/bparticles/step_simulator.hpp
index 485ca8beaf3..a302b568b52 100644
--- a/source/blender/simulations/bparticles/step_simulator.hpp
+++ b/source/blender/simulations/bparticles/step_simulator.hpp
@@ -6,7 +6,11 @@ namespace BParticles {
class StepSimulator {
public:
- virtual void simulate(SimulationState &simulation_state, float time_step) const = 0;
+ virtual ~StepSimulator()
+ {
+ }
+
+ virtual void simulate(SimulationState &simulation_state, float time_step) = 0;
};
} // namespace BParticles
More information about the Bf-blender-cvs
mailing list