/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


		#include "scene3d/mcamera.h"
		#include "log/log.h"

		using namespace GS::NML;
		using namespace GS::S3D;


//------------------------------------------------------------------------------
bool			MCamera::FromMetaTag(Tag &tag)
{
	if	(tag.name != "MCamera")
		__ERR__(__LOG_E__ << "Could not parse managed camera, incorrect root tag (" << tag.name << ").\n", false)

	NMLTagForeach(pt, tag)
	{
				if	(pt->name == "MItem")
				MItem::FromMetaTag(*pt);
		else	if	(pt->name == "Camera")
				Camera::FromMetaTag(*pt);
		else
				__LOG_W__ << "Unknown tag '" << pt->name << "' in <MCamera>.\n";
	}
	return true;
}
Tag				*MCamera::AsMetaTag()
{
	Tag *root = new Tag("MCamera");
	if	(!root)
		__ERR__(__LOG_E__ << "Could not create root tag to serialize.\n", NULL)

	root->AddChild(MItem::AsMetaTag());
	root->AddChild(Camera::AsMetaTag());
	return root;
}
//------------------------------------------------------------------------------
