Commit: ee16f26610134e42d5be089e385641cd9807e4dd Author: Jacques Lucke Date: Sat Jun 29 15:56:25 2019 +0200 Branches: functions https://developer.blender.org/rBee16f26610134e42d5be089e385641cd9807e4dd
remove unnecessary use of smart pointers =================================================================== M source/blender/simulations/bparticles/actions.cpp M source/blender/simulations/bparticles/actions.hpp M source/blender/simulations/bparticles/c_wrapper.cpp M source/blender/simulations/bparticles/emitters.cpp M source/blender/simulations/bparticles/emitters.hpp M source/blender/simulations/bparticles/events.cpp M source/blender/simulations/bparticles/events.hpp M source/blender/simulations/bparticles/forces.cpp M source/blender/simulations/bparticles/forces.hpp =================================================================== diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp index 8b051ae9076..5005985f0a6 100644 --- a/source/blender/simulations/bparticles/actions.cpp +++ b/source/blender/simulations/bparticles/actions.cpp @@ -98,28 +98,24 @@ class ExplodeAction : public Action { } }; -std::unique_ptr<Action> ACTION_kill() +Action *ACTION_kill() { - Action *action = new KillAction(); - return std::unique_ptr<Action>(action); + return new KillAction(); } -std::unique_ptr<Action> ACTION_move(float3 offset) +Action *ACTION_move(float3 offset) { - Action *action = new MoveAction(offset); - return std::unique_ptr<Action>(action); + return new MoveAction(offset); } -std::unique_ptr<Action> ACTION_spawn() +Action *ACTION_spawn() { - Action *action = new SpawnAction(); - return std::unique_ptr<Action>(action); + return new SpawnAction(); } -std::unique_ptr<Action> ACTION_explode() +Action *ACTION_explode() { - Action *action = new ExplodeAction(); - return std::unique_ptr<Action>(action); + return new ExplodeAction(); } } // namespace BParticles diff --git a/source/blender/simulations/bparticles/actions.hpp b/source/blender/simulations/bparticles/actions.hpp index c628dd9c904..568562f8630 100644 --- a/source/blender/simulations/bparticles/actions.hpp +++ b/source/blender/simulations/bparticles/actions.hpp @@ -4,9 +4,9 @@ namespace BParticles { -std::unique_ptr<Action> ACTION_kill(); -std::unique_ptr<Action> ACTION_move(float3 offset); -std::unique_ptr<Action> ACTION_spawn(); -std::unique_ptr<Action> ACTION_explode(); +Action *ACTION_kill(); +Action *ACTION_move(float3 offset); +Action *ACTION_spawn(); +Action *ACTION_explode(); } // namespace BParticles diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp index 8627f572072..5bbfed6b806 100644 --- a/source/blender/simulations/bparticles/c_wrapper.cpp +++ b/source/blender/simulations/bparticles/c_wrapper.cpp @@ -211,10 +211,8 @@ void BParticles_simulate_modifier(NodeParticlesModifierData *npmd, description.m_types.add_new(0, type0); if (npmd->emitter_object) { - description.m_emitters.append( - EMITTER_mesh_surface( - 0, (Mesh *)npmd->emitter_object->data, npmd->emitter_object->obmat, npmd->control1) - .release()); + description.m_emitters.append(EMITTER_mesh_surface( + 0, (Mesh *)npmd->emitter_object->data, npmd->emitter_object->obmat, npmd->control1)); } BVHTreeFromMesh treedata = {0}; if (npmd->collision_object) { @@ -222,20 +220,19 @@ void BParticles_simulate_modifier(NodeParticlesModifierData *npmd, &treedata, (Mesh *)npmd->collision_object->data, BVHTREE_FROM_LOOPTRI, 4); EventActionTest *event_action = new EventActionTest(); - event_action->m_event = - EVENT_mesh_collection(&treedata, npmd->collision_object->obmat).release(); - event_action->m_action = ACTION_explode().release(); + event_action->m_event = EVENT_mesh_collection(&treedata, npmd->collision_object->obmat); + event_action->m_action = ACTION_explode(); type0->m_event_actions.append(event_action); } type0->m_integrator = new EulerIntegrator(); - type0->m_integrator->m_forces.append(FORCE_directional({0, 0, -2}).release()); + type0->m_integrator->m_forces.append(FORCE_directional({0, 0, -2})); auto *type1 = new ModifierParticleType(); description.m_types.add_new(1, type1); { EventActionTest *event_action = new EventActionTest(); - event_action->m_event = EVENT_age_reached(0.3f).release(); - event_action->m_action = ACTION_kill().release(); + event_action->m_event = EVENT_age_reached(0.3f); + event_action->m_action = ACTION_kill(); type1->m_event_actions.append(event_action); } type1->m_integrator = new EulerIntegrator(); diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp index aa67eb0dfc0..5022dcc0a9a 100644 --- a/source/blender/simulations/bparticles/emitters.cpp +++ b/source/blender/simulations/bparticles/emitters.cpp @@ -109,26 +109,23 @@ class PathEmitter : public Emitter { } }; -std::unique_ptr<Emitter> EMITTER_point(float3 point) +Emitter *EMITTER_point(float3 point) { - Emitter *emitter = new PointEmitter(point); - return std::unique_ptr<Emitter>(emitter); + return new PointEmitter(point); } -std::unique_ptr<Emitter> EMITTER_mesh_surface(uint particle_type_id, - Mesh *mesh, - const float4x4 &transform, - float normal_velocity) +Emitter *EMITTER_mesh_surface(uint particle_type_id, + Mesh *mesh, + const float4x4 &transform, + float normal_velocity) { - Emitter *emitter = new SurfaceEmitter(particle_type_id, mesh, transform, normal_velocity); - return std::unique_ptr<Emitter>(emitter); + return new SurfaceEmitter(particle_type_id, mesh, transform, normal_velocity); } -std::unique_ptr<Emitter> EMITTER_path(Path *path, float4x4 transform) +Emitter *EMITTER_path(Path *path, float4x4 transform) { BLI_assert(path); - Emitter *emitter = new PathEmitter(*path, transform); - return std::unique_ptr<Emitter>(emitter); + return new PathEmitter(*path, transform); } } // namespace BParticles diff --git a/source/blender/simulations/bparticles/emitters.hpp b/source/blender/simulations/bparticles/emitters.hpp index 51c7a3f68fa..19c0692f8ba 100644 --- a/source/blender/simulations/bparticles/emitters.hpp +++ b/source/blender/simulations/bparticles/emitters.hpp @@ -7,11 +7,11 @@ struct Path; namespace BParticles { -std::unique_ptr<Emitter> EMITTER_point(float3 point); -std::unique_ptr<Emitter> EMITTER_mesh_surface(uint particle_type_id, - struct Mesh *mesh, - const float4x4 &transform, - float normal_velocity); -std::unique_ptr<Emitter> EMITTER_path(struct Path *path, float4x4 transform); +Emitter *EMITTER_point(float3 point); +Emitter *EMITTER_mesh_surface(uint particle_type_id, + struct Mesh *mesh, + const float4x4 &transform, + float normal_velocity); +Emitter *EMITTER_path(struct Path *path, float4x4 transform); } // namespace BParticles diff --git a/source/blender/simulations/bparticles/events.cpp b/source/blender/simulations/bparticles/events.cpp index db29f633865..9b4c9567890 100644 --- a/source/blender/simulations/bparticles/events.cpp +++ b/source/blender/simulations/bparticles/events.cpp @@ -77,16 +77,14 @@ class MeshCollisionEvent : public Event { } }; -std::unique_ptr<Event> EVENT_age_reached(float age) +Event *EVENT_age_reached(float age) { - Event *event = new AgeReachedEvent(age); - return std::unique_ptr<Event>(event); + return new AgeReachedEvent(age); } -std::unique_ptr<Event> EVENT_mesh_collection(BVHTreeFromMesh *treedata, const float4x4 &transform) +Event *EVENT_mesh_collection(BVHTreeFromMesh *treedata, const float4x4 &transform) { - Event *event = new MeshCollisionEvent(treedata, transform); - return std::unique_ptr<Event>(event); + return new MeshCollisionEvent(treedata, transform); } } // namespace BParticles diff --git a/source/blender/simulations/bparticles/events.hpp b/source/blender/simulations/bparticles/events.hpp index 297900ba340..1ba30a8f153 100644 --- a/source/blender/simulations/bparticles/events.hpp +++ b/source/blender/simulations/bparticles/events.hpp @@ -6,8 +6,7 @@ struct BVHTreeFromMesh; namespace BParticles { -std::unique_ptr<Event> EVENT_age_reached(float age); -std::unique_ptr<Event> EVENT_mesh_collection(struct BVHTreeFromMesh *treedata, - const float4x4 &transform); +Event *EVENT_age_reached(float age); +Event *EVENT_mesh_collection(struct BVHTreeFromMesh *treedata, const float4x4 &transform); } // namespace BParticles diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp index 81d86a39592..9cc7fc427cb 100644 --- a/source/blender/simulations/bparticles/forces.cpp +++ b/source/blender/simulations/bparticles/forces.cpp @@ -42,14 +42,14 @@ class TurbulenceForce : public BParticles::Force { } }; -std::unique_ptr<Force> FORCE_directional(float3 force) +Force *FORCE_directional(float3 force) { - return std::unique_ptr<Force>(new DirectionalForce(force)); + return new DirectionalForce(force); } -std::unique_ptr<Force> FORCE_turbulence(float strength) +Force *FORCE_turbulence(float strength) { - return std::unique_ptr<Force>(new TurbulenceForce(strength)); + return new TurbulenceForce(strength); } } // namespace BParticles diff --git a/source/blender/simulations/bparticles/forces.hpp b/source/blender/simulations/bparticles/forces.hpp index 53d014bd9b2..9654a50b093 100644 --- a/source/blender/simulations/bparticles/forces.hpp +++ b/source/blender/simulations/bparticles/forces.hpp @@ -4,7 +4,7 @@ namespace BParticles { -std::unique_ptr<Force> FORCE_directional(float3 force); -std::unique_ptr<Force> FORCE_turbulence(float strength); +Force *FORCE_directional(float3 force); +Force *FORCE_turbulence(float strength); } // namespace BParticles _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs