parent
dec6c2d880
commit
fec41ebda9
@ -0,0 +1,84 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2015 Winch Gate Property Limited
|
||||
// Author: Jan Boon <jan.boon@kaetemi.be>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "scene_meta.h"
|
||||
|
||||
#include <nel/misc/debug.h>
|
||||
#include <nel/misc/stream.h>
|
||||
#include <nel/misc/file.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
CNodeMeta::CNodeMeta() :
|
||||
AddToIG(true),
|
||||
ExportMesh(TMeshShape),
|
||||
ExportBone(TBoneAuto)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CNodeMeta::serial(NLMISC::IStream &s)
|
||||
{
|
||||
uint version = s.serialVersion(1);
|
||||
s.serial(AddToIG);
|
||||
s.serial((uint32 &)ExportMesh);
|
||||
s.serial((uint32 &)ExportBone);
|
||||
s.serial(InstanceShape);
|
||||
s.serial(InstanceName);
|
||||
s.serial(InstanceGroupName);
|
||||
}
|
||||
|
||||
CSceneMeta::CSceneMeta() :
|
||||
DefaultInstanceGroup(false),
|
||||
SkeletonMode(TSkelLocal)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CSceneMeta::load(const std::string &filePath)
|
||||
{
|
||||
m_MetaFilePath = filePath + ".nelmeta";
|
||||
if (CFile::fileExists(m_MetaFilePath))
|
||||
{
|
||||
CIFile f(m_MetaFilePath);
|
||||
serial(f);
|
||||
f.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSceneMeta::save()
|
||||
{
|
||||
COFile f(m_MetaFilePath, false, false, true);
|
||||
serial(f);
|
||||
f.close();
|
||||
}
|
||||
|
||||
void CSceneMeta::serial(NLMISC::IStream &s)
|
||||
{
|
||||
uint version = s.serialVersion(1);
|
||||
|
||||
s.serial(DefaultInstanceGroup);
|
||||
s.serial((uint32 &)SkeletonMode);
|
||||
|
||||
s.serialCont(Nodes);
|
||||
}
|
||||
|
||||
/* end of file */
|
@ -0,0 +1,83 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2015 Winch Gate Property Limited
|
||||
// Author: Jan Boon <jan.boon@kaetemi.be>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
#include <nel/misc/sstring.h>
|
||||
|
||||
namespace NLMISC {
|
||||
class IStream;
|
||||
}
|
||||
|
||||
enum TMesh
|
||||
{
|
||||
TMeshDisabled = 0,
|
||||
TMeshShape = 1,
|
||||
TMeshCollisionInt = 2,
|
||||
TMeshCollisionExt = 3,
|
||||
TMeshZone = 4,
|
||||
};
|
||||
|
||||
enum TBone
|
||||
{
|
||||
TBoneAuto = 0,
|
||||
TBoneForce = 1, // Force this node to be part of a skeleton
|
||||
TBoneRoot = 2, // Make this node the skeleton root, it will be exported using the scene name. There can only be one (editor should keep track and disable)
|
||||
};
|
||||
|
||||
struct CNodeMeta
|
||||
{
|
||||
CNodeMeta();
|
||||
|
||||
bool AddToIG; // Add this node to an instance group
|
||||
TMesh ExportMesh;
|
||||
TBone ExportBone;
|
||||
|
||||
std::string InstanceShape;
|
||||
std::string InstanceName;
|
||||
std::string InstanceGroupName;
|
||||
|
||||
void serial(NLMISC::IStream &s);
|
||||
};
|
||||
|
||||
enum TSkel
|
||||
{
|
||||
TSkelLocal = 0, // Export smallest skeleton possible from connected bones
|
||||
TSkelRoot = 1, // Export skeleton from direct child node in the scene root node
|
||||
TSkelFull = 2, // Include all connected child nodes in the skeleton
|
||||
};
|
||||
|
||||
struct CSceneMeta
|
||||
{
|
||||
CSceneMeta();
|
||||
|
||||
bool DefaultInstanceGroup; // Export a default instance group from nodes the scene that do not have an instance group set
|
||||
TSkel SkeletonMode;
|
||||
std::map<NLMISC::CSString, CNodeMeta> Nodes;
|
||||
|
||||
const std::string &metaFilePath() const { return m_MetaFilePath; }
|
||||
|
||||
bool load(const std::string &filePath);
|
||||
void save();
|
||||
void serial(NLMISC::IStream &s);
|
||||
|
||||
private:
|
||||
std::string m_MetaFilePath;
|
||||
|
||||
};
|
||||
|
||||
/* end of file */
|
Loading…
Reference in New Issue