From d89477ff213297cdc17772ee05493d960c7a17f5 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Mon, 11 Jun 2012 23:37:59 +0200 Subject: [PATCH] Added: #1469 Camera animation modifiers are added to camera animation steps --HG-- branch : gsoc2012-fabien --- .../camera_animation_step_factory.cpp | 20 ++++++++++++++++++- .../camera_animation_step_factory.h | 14 ++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp index b69eeff57..23799d3af 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp @@ -46,7 +46,20 @@ ICameraAnimationStep* ICameraAnimationStepFactory::parseStep(const NLLIGO::IPrim const NLLIGO::IPrimitive* child; 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(" 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; @@ -59,4 +72,9 @@ void ICameraAnimationStepFactory::init() { if (!Entries) Entries = new std::vector >; -} \ No newline at end of file +} + +void ICameraAnimationStep::addModifier(ICameraAnimationModifier* modifier) +{ + Modifiers.push_back(modifier); +} diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h index a5b8d5857..a21422845 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h @@ -19,6 +19,9 @@ #include "nel/ligo/primitive.h" #include +#include + +#include "camera_animation_manager/camera_animation_modifier_factory.h" /************************************************************************/ /* Interface for camera animation steps. @@ -31,6 +34,12 @@ class ICameraAnimationStep public: /// 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; + // Function that adds a camera animation modifier to this step + void addModifier(ICameraAnimationModifier* modifier); + +protected: + // The list of modifiers + std::vector Modifiers; }; /************************************************************************/ @@ -44,13 +53,16 @@ class ICameraAnimationStepFactory { public: /// 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: /// Functions used to be able to create the camera animation steps static void init(); virtual ICameraAnimationStep * instanciate() = 0; static std::vector >* Entries; + + // The list of modifiers + std::vector Modifiers; }; // Define used to register the different types of camera animation steps