From 10fdd4d28c6779a5c765ef6f45008628f5fc6c7c Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Fri, 8 Jun 2012 19:30:10 +0200 Subject: [PATCH] Added: #1469 Base camera animation step and static animation step --HG-- branch : gsoc2012-fabien --- .../camera_animation_step_factory.h | 4 +- .../camera_animation_steps.cpp | 90 +++++++++++++++++++ 2 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp 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 c6ec983a8..a5b8d5857 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 @@ -54,7 +54,7 @@ protected: }; // Define used to register the different types of camera animation steps -#define MISSION_REGISTER_ACTION(_class_,_name_) \ +#define CAMERA_ANIMATION_REGISTR_STEP(_class_,_name_) \ class _class_##CameraAnimationStepFactory : public ICameraAnimationStepFactory \ {\ public:\ @@ -73,6 +73,6 @@ public:\ return new _class_;\ } \ };\ - static _class_##ActionFactory* _class_##ActionFactoryInstance = new _class_##ActionFactory; + static _class_##CameraAnimationStepFactory* _class_##CameraAnimationStepFactoryInstance = new _class_##CameraAnimationStepFactory; #endif /* RY_CAMERAANIMATIONSTEPFACTORY_H */ diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp new file mode 100644 index 000000000..9e7f4768b --- /dev/null +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp @@ -0,0 +1,90 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// + +#include "camera_animation_manager/camera_animation_step_factory.h" + +/// Basic camera animation step that has generic values +/// - name +/// - look_at_position +/// - text +/// - duration +class CCameraAnimationStepBasic : public ICameraAnimationStep +{ +protected: + std::string LookAtPos; + std::string Text; + float Duration; + +public: + CCameraAnimationStepBasic() + { + LookAtPos = ""; + Text = ""; + Duration = 0.f; + } + + virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) + { + std::string value; + + // We get the look at position + if (!prim->getPropertyByName("look_at_position", value)) + { + nlwarning(" impossible to get the look_at_position property of the basic step in primitive : %s", filename.c_str()); + return false; + } + LookAtPos = value; + + // We get the text + if (!prim->getPropertyByName("text", value)) + { + nlwarning(" impossible to get the text property of the basic step in primitive : %s", filename.c_str()); + return false; + } + Text = value; + + // We get the duration + if (!prim->getPropertyByName("duration", value)) + { + nlwarning(" impossible to get the duration property of the basic step in primitive : %s", filename.c_str()); + return false; + } + if (!NLMISC::fromString(value, Duration)) + { + nlwarning(" impossible to convert the string : %s, in float in the basic step in primitive : %s", value.c_str(), filename.c_str()); + return false; + } + + return true; + } +}; // This class must not be registered because it a base class + +/// Static camera animation step (that does not have specific variables) +class CCameraAnimationStepStatic : public CCameraAnimationStepBasic +{ +public: + bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) + { + if (!CCameraAnimationStepBasic::parseStep(prim, filename)) + { + nlwarning(" impossible to parse the basic part of the step in primitive : %s", filename.c_str()); + return false; + } + return true; + } +}; +CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepStatic, "camera_animation_static");