Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / 3d / pipeline_max / builtin / animatable.cpp
blob3bc65c18180a9f866cd5e5bfb72f4ab8ae2734de
1 /**
2 * \file animatable.cpp
3 * \brief CAnimatable
4 * \date 2012-08-22 08:52GMT
5 * \author Jan Boon (Kaetemi)
6 * CAnimatable
7 */
9 /*
10 * Copyright (C) 2012 by authors
12 * This file is part of RYZOM CORE PIPELINE.
13 * RYZOM CORE PIPELINE is free software: you can redistribute it
14 * and/or modify it under the terms of the GNU Affero General Public
15 * License as published by the Free Software Foundation, either
16 * version 3 of the License, or (at your option) any later version.
18 * RYZOM CORE PIPELINE is distributed in the hope that it will be
19 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Affero General Public License for more details.
23 * You should have received a copy of the GNU Affero General Public
24 * License along with RYZOM CORE PIPELINE. If not, see
25 * <http://www.gnu.org/licenses/>.
28 #include <nel/misc/types_nl.h>
29 #include "animatable.h"
31 // STL includes
33 // NeL includes
34 // #include <nel/misc/debug.h>
36 // Project includes
37 #include "storage/app_data.h"
39 using namespace std;
40 // using namespace NLMISC;
42 #define PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID 0x2140
44 namespace PIPELINE {
45 namespace MAX {
46 namespace BUILTIN {
48 CAnimatable::CAnimatable(CScene *scene) : CSceneClass(scene), m_AppData(NULL)
53 CAnimatable::~CAnimatable()
55 if (!m_ChunksOwnsPointers)
57 delete m_Unknown2140;
58 m_Unknown2140 = NULL;
59 delete m_AppData;
60 m_AppData = NULL;
64 const ucstring CAnimatable::DisplayName = ucstring("Animatable");
65 const char *CAnimatable::InternalName = "Animatable";
66 const char *CAnimatable::InternalNameUnknown = "AnimatableUnknown";
67 const NLMISC::CClassId CAnimatable::ClassId = NLMISC::CClassId(0x3101497b, 0x24af711b); /* Not official, please correct */
68 const TSClassId CAnimatable::SuperClassId = 0x77a60fbd; /* Not official, please correct */
69 const CAnimatableClassDesc AnimatableClassDesc(&DllPluginDescBuiltin);
70 const CAnimatableSuperClassDesc AnimatableSuperClassDesc(&AnimatableClassDesc);
72 void CAnimatable::parse(uint16 version, uint filter)
74 CSceneClass::parse(version);
75 if (!m_ChunksOwnsPointers)
77 m_Unknown2140 = getChunk(PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID);
78 if (m_Unknown2140)
80 // nldebug("Found unknown 0x2140");
81 // TODO: Put std::cout code here
83 m_AppData = static_cast<STORAGE::CAppData *>(getChunk(PMBS_APP_DATA_CHUNK_ID));
87 void CAnimatable::clean()
89 CSceneClass::clean();
90 if (m_AppData) m_AppData->clean();
93 void CAnimatable::build(uint16 version, uint filter)
95 CSceneClass::build(version);
96 if (m_Unknown2140)
98 putChunk(PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID, m_Unknown2140);
100 if (m_AppData)
102 if (m_AppData->entries().size() == 0)
104 // Discard appdata if it has no entries
105 delete m_AppData;
106 m_AppData = NULL;
108 else
110 putChunk(PMBS_APP_DATA_CHUNK_ID, m_AppData);
115 void CAnimatable::disown()
117 m_Unknown2140 = NULL;
118 m_AppData = NULL;
119 CSceneClass::disown();
122 void CAnimatable::init()
124 CSceneClass::init();
127 bool CAnimatable::inherits(const NLMISC::CClassId classId) const
129 if (classId == classDesc()->classId()) return true;
130 return CSceneClass::inherits(classId);
133 const ISceneClassDesc *CAnimatable::classDesc() const
135 return &AnimatableClassDesc;
138 void CAnimatable::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
140 CSceneClass::toStringLocal(ostream, pad);
141 if (m_AppData && m_AppData->entries().size() != 0)
143 ostream << "\n" << pad << "AppData: ";
144 m_AppData->toString(ostream, pad + "\t");
148 STORAGE::CAppData *CAnimatable::appData()
150 if (m_ChunksOwnsPointers) { nlerror("Not parsed"); return NULL; }
151 if (!m_AppData)
153 m_AppData = new STORAGE::CAppData();
154 m_AppData->init();
156 return m_AppData;
159 IStorageObject *CAnimatable::createChunkById(uint16 id, bool container)
161 switch (id)
163 case PMBS_APP_DATA_CHUNK_ID:
164 return new STORAGE::CAppData;
166 return CSceneClass::createChunkById(id, container);
169 } /* namespace BUILTIN */
170 } /* namespace MAX */
171 } /* namespace PIPELINE */
173 /* end of file */