49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
----------------------------------------------------------------------------- */
|
|
|
|
|
|
#include "motion/scene_motion_container.h"
|
|
#include "log/log.h"
|
|
|
|
using namespace GS;
|
|
using namespace GS::Core;
|
|
using GS::NML::Tag;
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
bool SceneMotionContainer::FromMetaTag(Tag &tag, const Map <uint, uint> *uid_map)
|
|
{
|
|
if (tag.name != "SceneMotionContainer")
|
|
__ERR__(__LOG_E__ << "Could not parse scene motion container, incorrect root tag (" << tag.name << ").\n", false)
|
|
|
|
motions.Clear();
|
|
|
|
// Parse root tags.
|
|
NMLTagForeach(pt, tag)
|
|
{
|
|
if (pt->name == "SceneMotion")
|
|
{
|
|
SceneMotion *set = new SceneMotion;
|
|
set->FromMetaTag(*pt, uid_map);
|
|
motions.Add(set);
|
|
}
|
|
else
|
|
__LOG_W__ << "Unknown tag '" << pt->name << "' in <SceneMotionContainer>.\n";
|
|
}
|
|
return true;
|
|
}
|
|
Tag *SceneMotionContainer::AsMetaTag() const
|
|
{
|
|
Tag *root = new Tag("SceneMotionContainer");
|
|
if (!root)
|
|
__ERR__(__LOG_E__ << "Could not create root tag to serialize.\n", NULL)
|
|
|
|
ListForeachPtr(SceneMotion *, s, motions)
|
|
root->AddChild(s->AsMetaTag());
|
|
|
|
return root;
|
|
}
|
|
//------------------------------------------------------------------------------
|