Added: #1469 Camera animation modifiers are added to camera animation steps

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 2f8696133a
commit d89477ff21

@ -46,7 +46,20 @@ ICameraAnimationStep* ICameraAnimationStepFactory::parseStep(const NLLIGO::IPrim
const NLLIGO::IPrimitive* child; const NLLIGO::IPrimitive* child;
prim->getChild(child, i); prim->getChild(child, i);
// We tell the factory to load the modifier in function of its type
std::string modifierType;
if (!child->getPropertyByName("class", modifierType))
{
nlwarning("<ICameraAnimationStepFactory parseStep> Error while getting the class of a camera animation modifier in primitive number '%s'", filename.c_str());
continue;
}
ICameraAnimationModifier* modifier = ICameraAnimationModifierFactory::parseModifier(child, filename, modifierType);
// We add the modifier to the list
if (modifier)
{
ret->addModifier(modifier);
}
} }
return ret; return ret;
@ -59,4 +72,9 @@ void ICameraAnimationStepFactory::init()
{ {
if (!Entries) if (!Entries)
Entries = new std::vector<std::pair<std::string, ICameraAnimationStepFactory*> >; Entries = new std::vector<std::pair<std::string, ICameraAnimationStepFactory*> >;
} }
void ICameraAnimationStep::addModifier(ICameraAnimationModifier* modifier)
{
Modifiers.push_back(modifier);
}

@ -19,6 +19,9 @@
#include "nel/ligo/primitive.h" #include "nel/ligo/primitive.h"
#include <string> #include <string>
#include <vector>
#include "camera_animation_manager/camera_animation_modifier_factory.h"
/************************************************************************/ /************************************************************************/
/* Interface for camera animation steps. /* Interface for camera animation steps.
@ -31,6 +34,12 @@ class ICameraAnimationStep
public: public:
/// This function is called when it's time to parse the primitive to load the camera animation step /// This function is called when it's time to parse the primitive to load the camera animation step
virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) = 0; virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) = 0;
// Function that adds a camera animation modifier to this step
void addModifier(ICameraAnimationModifier* modifier);
protected:
// The list of modifiers
std::vector<ICameraAnimationModifier*> Modifiers;
}; };
/************************************************************************/ /************************************************************************/
@ -44,13 +53,16 @@ class ICameraAnimationStepFactory
{ {
public: public:
/// Function that will instanciate the correct camera animation step /// Function that will instanciate the correct camera animation step
static ICameraAnimationStep* parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename, const std::string& stepType); static ICameraAnimationStep* parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename, const std::string& stepType);
protected: protected:
/// Functions used to be able to create the camera animation steps /// Functions used to be able to create the camera animation steps
static void init(); static void init();
virtual ICameraAnimationStep * instanciate() = 0; virtual ICameraAnimationStep * instanciate() = 0;
static std::vector<std::pair<std::string, ICameraAnimationStepFactory*> >* Entries; static std::vector<std::pair<std::string, ICameraAnimationStepFactory*> >* Entries;
// The list of modifiers
std::vector<ICameraAnimationModifier*> Modifiers;
}; };
// Define used to register the different types of camera animation steps // Define used to register the different types of camera animation steps

Loading…
Cancel
Save