4 * \date 2012-08-22 08:52GMT
5 * \author Jan Boon (Kaetemi)
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"
34 // #include <nel/misc/debug.h>
37 #include "storage/app_data.h"
40 // using namespace NLMISC;
42 #define PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID 0x2140
48 CAnimatable::CAnimatable(CScene
*scene
) : CSceneClass(scene
), m_AppData(NULL
)
53 CAnimatable::~CAnimatable()
55 if (!m_ChunksOwnsPointers
)
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
);
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()
90 if (m_AppData
) m_AppData
->clean();
93 void CAnimatable::build(uint16 version
, uint filter
)
95 CSceneClass::build(version
);
98 putChunk(PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID
, m_Unknown2140
);
102 if (m_AppData
->entries().size() == 0)
104 // Discard appdata if it has no entries
110 putChunk(PMBS_APP_DATA_CHUNK_ID
, m_AppData
);
115 void CAnimatable::disown()
117 m_Unknown2140
= NULL
;
119 CSceneClass::disown();
122 void CAnimatable::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
; }
153 m_AppData
= new STORAGE::CAppData();
159 IStorageObject
*CAnimatable::createChunkById(uint16 id
, bool container
)
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 */