Added: #1469 Base containers for animation instructions

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 0af5c0518b
commit 94c3b7b47c

@ -65,6 +65,12 @@ CCameraAnimationManager::CCameraAnimationManager()
CCameraAnimationManager::~CCameraAnimationManager() CCameraAnimationManager::~CCameraAnimationManager()
{ {
// Delete the list of animations // 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) bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, const std::string& filename)
@ -79,6 +85,9 @@ bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, cons
string animName = value; string animName = value;
TCameraAnimInfo animInfo;
animInfo.Name = animName;
// We now parse the instructions which are children of the camera animation // We now parse the instructions which are children of the camera animation
for (uint i = 0; i < prim->getNumChildren(); i++) 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 // We add the instruction to the list
if (step) 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; return true;
} }

@ -19,6 +19,7 @@
#include "nel/ligo/primitive.h" #include "nel/ligo/primitive.h"
#include <string> #include <string>
#include "camera_animation_manager/camera_animation_step_factory.h"
/************************************************************************/ /************************************************************************/
/* Class that manages the camera animations. (singleton). /* Class that manages the camera animations. (singleton).
@ -51,6 +52,37 @@ private:
/// Instance of the manager /// Instance of the manager
static CCameraAnimationManager* _Instance; 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<ICameraAnimationStep*>::iterator it = Steps.begin(); it != Steps.end(); ++it)
{
ICameraAnimationStep* step = *it;
delete step;
}
Steps.clear();
Name = "";
}
std::string Name;
std::vector<ICameraAnimationStep*> Steps;
};
typedef std::map<std::string, TCameraAnimInfo> TCameraAnimationContainer;
/// Variable that contains the animations
TCameraAnimationContainer Animations;
}; };

Loading…
Cancel
Save