[Bf-blender-cvs] [234f5d9407f] functions: make ParticleType class non-virtual
Jacques Lucke
noreply at git.blender.org
Thu Jul 18 18:19:35 CEST 2019
Commit: 234f5d9407ff795e9e82ab7e111fcfa788563985
Author: Jacques Lucke
Date: Thu Jul 18 15:28:08 2019 +0200
Branches: functions
https://developer.blender.org/rB234f5d9407ff795e9e82ab7e111fcfa788563985
make ParticleType class non-virtual
===================================================================
M source/blender/simulations/bparticles/core.cpp
M source/blender/simulations/bparticles/core.hpp
M source/blender/simulations/bparticles/step_description.hpp
===================================================================
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index ee666c130dc..a81e7707aaa 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -24,16 +24,14 @@ OffsetHandler::~OffsetHandler()
ParticleType::~ParticleType()
{
-}
-
-ArrayRef<OffsetHandler *> ParticleType::offset_handlers()
-{
- return {};
-}
+ delete m_integrator;
-ArrayRef<Event *> ParticleType::events()
-{
- return {};
+ for (Event *event : m_events) {
+ delete event;
+ }
+ for (OffsetHandler *handler : m_offset_handlers) {
+ delete handler;
+ }
}
StepDescription::~StepDescription()
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 414322d3205..06c15089742 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -131,24 +131,32 @@ class OffsetHandler {
*/
class ParticleType {
public:
- virtual ~ParticleType();
+ SmallVector<Event *> m_events;
+ SmallVector<OffsetHandler *> m_offset_handlers;
+ Integrator *m_integrator;
+ AttributesDeclaration m_attributes;
- /**
- * Return the integrator to be used with particles of this type.
- */
- virtual Integrator &integrator() = 0;
+ ~ParticleType();
- virtual ArrayRef<OffsetHandler *> offset_handlers();
+ Integrator &integrator()
+ {
+ return *m_integrator;
+ }
- /**
- * Return the events that particles of this type can trigger.
- */
- virtual ArrayRef<Event *> events();
+ ArrayRef<OffsetHandler *> offset_handlers()
+ {
+ return m_offset_handlers;
+ }
- /**
- * Allows to define which attributes should exist for the type.
- */
- virtual AttributesDeclaration &attributes() = 0;
+ ArrayRef<Event *> events()
+ {
+ return m_events;
+ }
+
+ AttributesDeclaration &attributes()
+ {
+ return m_attributes;
+ }
};
/**
diff --git a/source/blender/simulations/bparticles/step_description.hpp b/source/blender/simulations/bparticles/step_description.hpp
index fa61ae5b3da..2f1f169a2af 100644
--- a/source/blender/simulations/bparticles/step_description.hpp
+++ b/source/blender/simulations/bparticles/step_description.hpp
@@ -4,43 +4,6 @@
namespace BParticles {
-class ModifierParticleType : public ParticleType {
- public:
- SmallVector<Event *> m_events;
- SmallVector<OffsetHandler *> m_offset_handlers;
- Integrator *m_integrator;
- AttributesDeclaration m_attributes;
-
- ~ModifierParticleType()
- {
- delete m_integrator;
-
- for (Event *event : m_events) {
- delete event;
- }
- }
-
- ArrayRef<Event *> events() override
- {
- return m_events;
- }
-
- ArrayRef<OffsetHandler *> offset_handlers() override
- {
- return m_offset_handlers;
- }
-
- Integrator &integrator() override
- {
- return *m_integrator;
- }
-
- AttributesDeclaration &attributes() override
- {
- return m_attributes;
- }
-};
-
class ModifierStepDescription : public StepDescription {
public:
float m_duration;
@@ -106,7 +69,7 @@ class ParticleTypeBuilder {
ParticleType *build()
{
BLI_assert(m_integrator);
- ModifierParticleType *type = new ModifierParticleType();
+ ParticleType *type = new ParticleType();
type->m_integrator = m_integrator;
type->m_events = m_events;
type->m_offset_handlers = m_offset_handlers;
More information about the Bf-blender-cvs
mailing list