Added: #1469 Basis of the camera animations parsing

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 99b9ef33b8
commit a609fb6c4c

@ -18,8 +18,13 @@
#include "stdpch.h" #include "stdpch.h"
#include "camera_animation_manager/camera_animation_manager.h" #include "camera_animation_manager/camera_animation_manager.h"
#include "primitives_parser.h"
#include "nel/ligo/primitive.h"
using namespace std; using namespace std;
using namespace NLMISC;
using namespace NLLIGO;
using namespace NLNET;
CCameraAnimationManager* CCameraAnimationManager::_Instance = NULL; CCameraAnimationManager* CCameraAnimationManager::_Instance = NULL;
@ -39,10 +44,54 @@ void CCameraAnimationManager::release()
CCameraAnimationManager::CCameraAnimationManager() CCameraAnimationManager::CCameraAnimationManager()
{ {
// We get the loaded primitives
const CPrimitivesParser::TPrimitivesList & primsList = CPrimitivesParser::getInstance().getPrimitives();
nlinfo("parsing the camera animations");
// We begin to parse the camera animations
CPrimitivesParser::TPrimitivesList::const_iterator first, last;
for (first = primsList.begin(), last = primsList.end(); first != last; ++first)
{
// parse camera animations
if (!parseCameraAnimations(first->Primitive.RootNode, first->FileName))
{
nlwarning("<CCameraAnimationManager constructor> Error while parsing the camera animations in primitive number '%s'", first->FileName.c_str());
}
}
} }
CCameraAnimationManager::~CCameraAnimationManager() CCameraAnimationManager::~CCameraAnimationManager()
{ {
// Delete the list of animations
}
bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, const std::string& filename)
{
string value;
// if the node is a camera animation parse it
if (prim->getPropertyByName("class", value) && !nlstricmp(value.c_str(), "camera_animation_tree") )
{
// We get the name of the mission
prim->getPropertyByName("name", value);
string animName = value;
// We now parse the instructions which are children of the camera animation
for (uint i = 0; i < prim->getNumChildren(); i++)
{
const IPrimitive* child;
prim->getChild(child, 1);
// We tell the factory to load the instructions in function of the type of instruction we have
// We add the instruction to the list
}
// We add the camera animation to the list
return true;
}
return false;
} }

@ -17,6 +17,9 @@
#ifndef RY_CAMERAANIMATIONMANAGER_H #ifndef RY_CAMERAANIMATIONMANAGER_H
#define RY_CAMERAANIMATIONMANAGER_H #define RY_CAMERAANIMATIONMANAGER_H
#include "nel/ligo/primitive.h"
#include <string>
/************************************************************************/ /************************************************************************/
/* Class that manages the camera animations. (singleton). /* Class that manages the camera animations. (singleton).
* It's responsible of : * It's responsible of :
@ -42,6 +45,10 @@ private:
CCameraAnimationManager(); CCameraAnimationManager();
// Destructor // Destructor
~CCameraAnimationManager(); ~CCameraAnimationManager();
// Function that parses the camera animations
bool parseCameraAnimations(const NLLIGO::IPrimitive* prim, const std::string& filename);
// Instance of the manager // Instance of the manager
static CCameraAnimationManager* _Instance; static CCameraAnimationManager* _Instance;
}; };

@ -1876,6 +1876,8 @@ void CPlayerService::release()
CActionDistanceChecker::release(); CActionDistanceChecker::release();
if (!packingSheets) CMissionManager::release(); if (!packingSheets) CMissionManager::release();
if (!packingSheets) CCameraAnimationManager::release();
CEffectManager::release(); CEffectManager::release();
if (!packingSheets) CZoneManager::getInstance().release(); if (!packingSheets) CZoneManager::getInstance().release();

Loading…
Cancel
Save