43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
----------------------------------------------------------------------------- */
|
|
|
|
|
|
#include "scene3d/mobject.h"
|
|
#include "log/log.h"
|
|
|
|
using namespace GS::S3D;
|
|
using namespace GS::NML;
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
bool MObject::FromMetaTag(Tag &tag)
|
|
{
|
|
if (tag.name != "MObject")
|
|
__ERR__(__LOG_E__ << "Could not parse managed object, incorrect root tag (" << tag.name << ").\n", false);
|
|
|
|
NMLTagForeach(pt, tag)
|
|
{
|
|
if (pt->name == "MItem")
|
|
MItem::FromMetaTag(*pt);
|
|
else if (pt->name == "Object")
|
|
Object::FromMetaTag(*pt);
|
|
else
|
|
__LOG_W__ << "Unknown tag '" << pt->name << "' in <MObject>.\n";
|
|
}
|
|
return true;
|
|
}
|
|
Tag *MObject::AsMetaTag()
|
|
{
|
|
Tag *root = new Tag("MObject");
|
|
if (!root)
|
|
__ERR__(__LOG_E__ << "Could not create root tag to serialize.\n", NULL);
|
|
|
|
root->AddChild(MItem::AsMetaTag());
|
|
root->AddChild(Object::AsMetaTag());
|
|
|
|
return root;
|
|
}
|
|
//------------------------------------------------------------------------------
|