Fix game:addSpawnShapesByZone
[ryzomcore.git] / nel / tools / 3d / mesh_utils / scene_meta.cpp
blobf5e8adf99db3983ea892a97298a7290537c65ebb
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2015 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // Author: Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
19 #include <nel/misc/types_nl.h>
20 #include "scene_meta.h"
22 #include <nel/misc/debug.h>
23 #include <nel/misc/stream.h>
24 #include <nel/misc/file.h>
26 #include <nel/3d/material.h>
28 using namespace std;
29 using namespace NLMISC;
31 CNodeMeta::CNodeMeta() :
32 AddToIG(true),
33 ExportMesh(TMeshShape),
34 ExportBone(TBoneAuto),
35 AutoAnim(false)
40 void CNodeMeta::serial(NLMISC::IStream &s)
42 uint version = s.serialVersion(1);
43 s.serial(AddToIG);
44 s.serial((uint32 &)ExportMesh);
45 s.serial((uint32 &)ExportBone);
46 s.serial(InstanceShape);
47 s.serial(InstanceName);
48 s.serial(InstanceGroupName);
49 s.serial(AutoAnim);
52 CSceneMeta::CSceneMeta() :
53 ImportShape(true),
54 ImportSkel(true),
55 ImportAnim(true),
56 ImportCmb(true),
57 ImportIG(true),
58 ExportDefaultIG(false),
59 SkeletonMode(TSkelRoot)
64 bool CSceneMeta::load(const std::string &filePath)
66 m_MetaFilePath = NLMISC::CPath::standardizePath(filePath + ".nelmeta", false);
67 if (CFile::fileExists(m_MetaFilePath))
69 CIFile f(m_MetaFilePath);
70 serial(f);
71 f.close();
72 return true;
74 return false;
77 void CSceneMeta::save()
79 COFile f(m_MetaFilePath, false, false, true);
80 serial(f);
81 f.close();
84 void CSceneMeta::serial(NLMISC::IStream &s)
86 uint version = s.serialVersion(1);
88 s.serial(ImportShape);
89 s.serial(ImportSkel);
90 s.serial(ImportAnim);
91 s.serial(ImportCmb);
92 s.serial(ImportIG);
94 s.serial(ExportDefaultIG);
95 s.serial((uint32 &)SkeletonMode);
97 s.serialCont(Nodes);
98 s.serialPtrCont(Materials);
101 /* end of file */