From 94c3b7b47c605ae9452903549bb6c5de2b6f745f Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Fri, 8 Jun 2012 00:29:41 +0200 Subject: [PATCH] Added: #1469 Base containers for animation instructions --HG-- branch : gsoc2012-fabien --- .../camera_animation_manager.cpp | 14 ++++++-- .../camera_animation_manager.h | 32 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp index 3bb60b96c..5cce15b0d 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp @@ -65,6 +65,12 @@ CCameraAnimationManager::CCameraAnimationManager() CCameraAnimationManager::~CCameraAnimationManager() { // Delete the list of animations + TCameraAnimationContainer::iterator first = Animations.begin(); + for (; first != Animations.end(); ++first) + { + first->second.release(); + } + Animations.clear(); } bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, const std::string& filename) @@ -79,6 +85,9 @@ bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, cons string animName = value; + TCameraAnimInfo animInfo; + animInfo.Name = animName; + // We now parse the instructions which are children of the camera animation for (uint i = 0; i < prim->getNumChildren(); i++) { @@ -97,11 +106,12 @@ bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, cons // We add the instruction to the list if (step) { - + animInfo.Steps.push_back(step); } } - // We add the camera animation to the list + // We add the camera animation to the container + Animations[animName] = animInfo; return true; } diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h index a63214c71..009b25d95 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h @@ -19,6 +19,7 @@ #include "nel/ligo/primitive.h" #include +#include "camera_animation_manager/camera_animation_step_factory.h" /************************************************************************/ /* Class that manages the camera animations. (singleton). @@ -51,6 +52,37 @@ private: /// Instance of the manager static CCameraAnimationManager* _Instance; + + /// Class that contains information about an animation + class TCameraAnimInfo + { + public: + TCameraAnimInfo() + { + Name = ""; + } + + void release() + { + // We delete the camera animation steps + for (std::vector::iterator it = Steps.begin(); it != Steps.end(); ++it) + { + ICameraAnimationStep* step = *it; + delete step; + } + Steps.clear(); + + Name = ""; + } + + std::string Name; + std::vector Steps; + }; + + typedef std::map TCameraAnimationContainer; + + /// Variable that contains the animations + TCameraAnimationContainer Animations; };