From 4a153d8e55a73de68e91978a8497f91f5dc2fb65 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Sat, 9 Jun 2012 19:01:17 +0200 Subject: [PATCH] Added: #1469 Parsing of camera animation turn around step --HG-- branch : gsoc2012-fabien --- .../camera_animation_steps.cpp | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) 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 index 68e57161d..e5c0df115 100644 --- 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 @@ -178,3 +178,70 @@ public: } }; CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepFollowEntity, "camera_animation_follow_entity"); + +///////////////////////////////////////////////////////////////////////////// +/// Turn around camera animation step +/// - point_to_turn_around +/// - distance_to_point +/// - speed +class CCameraAnimationStepTurnAround: public CCameraAnimationStepBasic +{ +protected: + std::string PointToTurnAround; + float DistanceToPoint; + float Speed; + +public: + CCameraAnimationStepTurnAround() + { + PointToTurnAround = ""; + DistanceToPoint = 0.f; + Speed = 0.f; + } + + 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; + } + + std::string value; + + // We get the point to turn around + if (!prim->getPropertyByName("point_to_turn_around", value)) + { + nlwarning(" impossible to get the point_to_turn_around property of the basic step in primitive : %s", filename.c_str()); + return false; + } + PointToTurnAround = value; + + // We get the distance to the point + if (!prim->getPropertyByName("distance_to_point", value)) + { + nlwarning(" impossible to get the distance_to_point property of the basic step in primitive : %s", filename.c_str()); + return false; + } + if (!NLMISC::fromString(value, DistanceToPoint)) + { + nlwarning(" impossible to convert the string : %s, in float in the follow entity step in primitive : %s", value.c_str(), filename.c_str()); + return false; + } + + // We get the speed + if (!prim->getPropertyByName("speed", value)) + { + nlwarning(" impossible to get the speed property of the basic step in primitive : %s", filename.c_str()); + return false; + } + if (!NLMISC::fromString(value, Speed)) + { + nlwarning(" impossible to convert the string : %s, in float in the follow entity step in primitive : %s", value.c_str(), filename.c_str()); + return false; + } + + return true; + } +}; +CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepTurnAround, "camera_animation_turn_around"); \ No newline at end of file