Added: #1440 Parser for CEditablePoly

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 9db385c94c
commit 4f544bf916

@ -184,6 +184,8 @@ void CAppData::parse(uint16 version, uint filter)
// Take local ownership
m_ChunksOwnsPointers = false;
#else
CStorageContainer::parse(version);
#endif
}
@ -195,6 +197,8 @@ void CAppData::clean()
if (m_Chunks.begin()->first != PMBS_APP_DATA_HEADER_CHUNK_ID) { nlerror("Bad id %x, expected %x", (uint32)m_Chunks.begin()->first, PMBS_APP_DATA_HEADER_CHUNK_ID); return; } // Cannot happen, because we won't have local ownership if parsing failed
delete m_Chunks.begin()->second; // Delete the header chunk, since we own it
m_Chunks.clear(); // Clear the remaining chunks
#else
CStorageContainer::clean();
#endif
}
@ -213,6 +217,8 @@ void CAppData::build(uint16 version, uint filter)
// Set up the entries
for (TMap::iterator it = m_Entries.begin(), end = m_Entries.end(); it != end; ++it)
m_Chunks.push_back(TStorageObjectWithId(PMBS_APP_DATA_ENTRY_CHUNK_ID, it->second));
#else
CStorageContainer::build(version);
#endif
}
@ -231,6 +237,8 @@ void CAppData::disown()
// Disown all the child chunks
CStorageContainer::disown();
#else
CStorageContainer::disown();
#endif
}

@ -252,6 +252,8 @@ void CGeomBuffers::parse(uint16 version, uint filter)
{
#if PMBS_GEOM_BUFFERS_PARSE
CStorageContainer::parse(version);
#else
CStorageContainer::parse(version);
#endif
}
@ -259,6 +261,8 @@ void CGeomBuffers::clean()
{
#if PMBS_GEOM_BUFFERS_PARSE
CStorageContainer::clean();
#else
CStorageContainer::clean();
#endif
}
@ -266,6 +270,8 @@ void CGeomBuffers::build(uint16 version, uint filter)
{
#if PMBS_GEOM_BUFFERS_PARSE
CStorageContainer::build(version);
#else
CStorageContainer::build(version);
#endif
}
@ -273,6 +279,8 @@ void CGeomBuffers::disown()
{
#if PMBS_GEOM_BUFFERS_PARSE
CStorageContainer::disown();
#else
CStorageContainer::disown();
#endif
}

@ -29,6 +29,7 @@
#include "editable_poly.h"
// STL includes
#include <iomanip>
// NeL includes
// #include <nel/misc/debug.h>
@ -50,7 +51,12 @@ CEditablePoly::CEditablePoly(CScene *scene) : CPolyObject(scene)
CEditablePoly::~CEditablePoly()
{
if (!m_ChunksOwnsPointers)
{
for (TStorageObjectContainer::iterator it = m_EditablePolyUnknown.begin(), end = m_EditablePolyUnknown.end(); it != end; ++it)
delete it->second;
m_EditablePolyUnknown.clear();
}
}
const ucstring CEditablePoly::DisplayName = ucstring("EditablePoly");
@ -62,6 +68,26 @@ const CEditablePolyClassDesc EditablePolyClassDesc(&DllPluginDescEPoly);
void CEditablePoly::parse(uint16 version, uint filter)
{
CPolyObject::parse(version);
IStorageObject *so;
so = getChunk(0x4039);
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x4039, so));
so = getChunk(0x403a);
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x403a, so));
for (; ; )
{ // note: also in editable mesh, copy paste or related somehow? / use a common parser class inbetween?
so = getChunk(0x3003);
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x3003, so));
else break;
so = getChunk(0x3004);
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x3004, so));
}
so = getChunk(0x3002);
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x3002, so));
so = getChunk(0x4038);
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x4038, so));
CPolyObject::parse(version, PMB_POLY_OBJECT_PARSE_FILTER);
}
void CEditablePoly::clean()
@ -72,6 +98,11 @@ void CEditablePoly::clean()
void CEditablePoly::build(uint16 version, uint filter)
{
CPolyObject::build(version);
for (TStorageObjectContainer::iterator it = m_EditablePolyUnknown.begin(), end = m_EditablePolyUnknown.end(); it != end; ++it)
putChunk(it->first, it->second);
CPolyObject::build(version, PMB_POLY_OBJECT_PARSE_FILTER);
}
void CEditablePoly::disown()
@ -98,6 +129,20 @@ const ISceneClassDesc *CEditablePoly::classDesc() const
void CEditablePoly::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
{
CPolyObject::toStringLocal(ostream, pad);
std::string padpad = pad + "\t";
sint i = 0;
for (TStorageObjectContainer::const_iterator it = m_EditablePolyUnknown.begin(), end = m_EditablePolyUnknown.end(); it != end; ++it)
{
std::stringstream ss;
ss << std::hex << std::setfill('0');
ss << std::setw(4) << it->first;
ostream << "\n" << pad << "EditablePolyUnkown[" << i << "] 0x" << ss.str() << ": ";
it->second->toString(ostream, padpad);
++i;
}
CPolyObject::toStringLocal(ostream, pad, PMB_POLY_OBJECT_PARSE_FILTER);
}
IStorageObject *CEditablePoly::createChunkById(uint16 id, bool container)

@ -72,6 +72,9 @@ protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
private:
TStorageObjectContainer m_EditablePolyUnknown;
}; /* class CEditablePoly */
typedef CSceneClassDesc<CEditablePoly> CEditablePolyClassDesc;

@ -71,6 +71,8 @@ public:
protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
private:
TStorageObjectContainer m_EditableMeshUnknown;
}; /* class CEditableMesh */

Loading…
Cancel
Save