diff --git a/code/nel/tools/pipeline/max/builtin/geom_object.cpp b/code/nel/tools/pipeline/max/builtin/geom_object.cpp index 1ad2d0985..0b869b459 100644 --- a/code/nel/tools/pipeline/max/builtin/geom_object.cpp +++ b/code/nel/tools/pipeline/max/builtin/geom_object.cpp @@ -98,7 +98,7 @@ void CGeomObject::build(uint16 version, uint filter) else if (filter == PMB_GEOM_OBJECT_PARSE_FILTER) { if (m_Unknown0900) putChunk(PMB_GEOM_UNKNOWN0900_CHUNK_ID, m_Unknown0900); - if (m_GeomBuffers) putChunk(PMB_GEOM_UNKNOWN0900_CHUNK_ID, m_GeomBuffers); + if (m_GeomBuffers) putChunk(PMB_GEOM_BUFFERS_CHUNK_ID, m_GeomBuffers); } } diff --git a/code/nel/tools/pipeline/max/epoly/editable_poly.cpp b/code/nel/tools/pipeline/max/epoly/editable_poly.cpp index 6f1248349..b20e411c5 100644 --- a/code/nel/tools/pipeline/max/epoly/editable_poly.cpp +++ b/code/nel/tools/pipeline/max/epoly/editable_poly.cpp @@ -59,7 +59,7 @@ const NLMISC::CClassId CEditablePoly::ClassId = NLMISC::CClassId(0x1bf8338d, 0x1 const TSClassId CEditablePoly::SuperClassId = CPolyObject::SuperClassId; const CEditablePolyClassDesc EditablePolyClassDesc(&DllPluginDescEPoly); -void CEditablePoly::parse(uint16 version) +void CEditablePoly::parse(uint16 version, uint filter) { CPolyObject::parse(version); } @@ -69,7 +69,7 @@ void CEditablePoly::clean() CPolyObject::clean(); } -void CEditablePoly::build(uint16 version) +void CEditablePoly::build(uint16 version, uint filter) { CPolyObject::build(version); } @@ -95,7 +95,7 @@ const ISceneClassDesc *CEditablePoly::classDesc() const return &EditablePolyClassDesc; } -void CEditablePoly::toStringLocal(std::ostream &ostream, const std::string &pad) const +void CEditablePoly::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const { CPolyObject::toStringLocal(ostream, pad); } diff --git a/code/nel/tools/pipeline/max/epoly/editable_poly.h b/code/nel/tools/pipeline/max/epoly/editable_poly.h index 33b14cfba..b9d7cfe0f 100644 --- a/code/nel/tools/pipeline/max/epoly/editable_poly.h +++ b/code/nel/tools/pipeline/max/epoly/editable_poly.h @@ -59,14 +59,14 @@ public: static const TSClassId SuperClassId; // inherited - virtual void parse(uint16 version); + virtual void parse(uint16 version, uint filter = 0); virtual void clean(); - virtual void build(uint16 version); + virtual void build(uint16 version, uint filter = 0); virtual void disown(); virtual void init(); virtual bool inherits(const NLMISC::CClassId classId) const; virtual const ISceneClassDesc *classDesc() const; - virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const; + virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const; protected: // inherited diff --git a/code/nel/tools/pipeline/max/scene_class.cpp b/code/nel/tools/pipeline/max/scene_class.cpp index 4e2cc6d5b..61527d854 100644 --- a/code/nel/tools/pipeline/max/scene_class.cpp +++ b/code/nel/tools/pipeline/max/scene_class.cpp @@ -271,6 +271,13 @@ void CSceneClass::putChunk(uint16 id, IStorageObject *storageObject) m_OrphanedChunks.insert(m_PutChunkInsert, TStorageObjectWithId(id, storageObject)); } +uint16 CSceneClass::peekChunk() +{ + if (m_OrphanedChunks.size()) + return m_OrphanedChunks.begin()->first; + return 0x0000; +} + //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// diff --git a/code/nel/tools/pipeline/max/scene_class.h b/code/nel/tools/pipeline/max/scene_class.h index 1918478d4..75c84ba08 100644 --- a/code/nel/tools/pipeline/max/scene_class.h +++ b/code/nel/tools/pipeline/max/scene_class.h @@ -144,6 +144,8 @@ protected: /// Same as putChunk but for lazy programmers, must use together with getChunkValue template void putChunkValue(uint16 id, const T &value); + /// See the next chunk id + uint16 peekChunk(); //@} protected: diff --git a/code/nel/tools/pipeline/max/update1/editable_mesh.cpp b/code/nel/tools/pipeline/max/update1/editable_mesh.cpp index 3cf8a6ef4..303cf9123 100644 --- a/code/nel/tools/pipeline/max/update1/editable_mesh.cpp +++ b/code/nel/tools/pipeline/max/update1/editable_mesh.cpp @@ -29,6 +29,7 @@ #include "editable_mesh.h" // STL includes +#include // NeL includes // #include @@ -50,7 +51,12 @@ CEditableMesh::CEditableMesh(CScene *scene) : CTriObject(scene) CEditableMesh::~CEditableMesh() { - + if (!m_ChunksOwnsPointers) + { + for (TStorageObjectContainer::iterator it = m_EditableMeshUnknown.begin(), end = m_EditableMeshUnknown.end(); it != end; ++it) + delete it->second; + m_EditableMeshUnknown.clear(); + } } const ucstring CEditableMesh::DisplayName = ucstring("EditableMesh"); @@ -59,9 +65,67 @@ const NLMISC::CClassId CEditableMesh::ClassId = NLMISC::CClassId(0xe44f10b3, 0x0 const TSClassId CEditableMesh::SuperClassId = CTriObject::SuperClassId; const CEditableMeshClassDesc EditableMeshClassDesc(&DllPluginDescUpdate1); -void CEditableMesh::parse(uint16 version) +void CEditableMesh::parse(uint16 version, uint filter) { CTriObject::parse(version); + + IStorageObject *so; + so = getChunk(0x3001); + if (so) + { + m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x3001, so)); + for (; ; ) + { + if (peekChunk() == 0x2845) + { + so = getChunk(0x2845); + m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x2845, so)); + } + else if (peekChunk() == 0x2846) + { + so = getChunk(0x2846); + m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x2846, so)); + } + else if (peekChunk() == 0x2847) + { + so = getChunk(0x2847); + m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x2847, so)); + } + else break; + } + } + for (; ; ) + { + so = getChunk(0x3003); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x3003, so)); + else break; + so = getChunk(0x3004); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x3004, so)); + } + so = getChunk(0x3002); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x3002, so)); + so = getChunk(0x4020); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4020, so)); + so = getChunk(0x4024); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4024, so)); + so = getChunk(0x4025); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4025, so)); + so = getChunk(0x4026); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4026, so)); + so = getChunk(0x402c); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x402c, so)); + so = getChunk(0x402d); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x402d, so)); + so = getChunk(0x4030); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4030, so)); + so = getChunk(0x4034); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4034, so)); + so = getChunk(0x4038); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x4038, so)); + so = getChunk(0x403b); + if (so) m_EditableMeshUnknown.push_back(TStorageObjectWithId(0x403b, so)); + + CTriObject::parse(version, PMB_TRI_OBJECT_PARSE_FILTER); } void CEditableMesh::clean() @@ -69,13 +133,19 @@ void CEditableMesh::clean() CTriObject::clean(); } -void CEditableMesh::build(uint16 version) +void CEditableMesh::build(uint16 version, uint filter) { CTriObject::build(version); + + for (TStorageObjectContainer::iterator it = m_EditableMeshUnknown.begin(), end = m_EditableMeshUnknown.end(); it != end; ++it) + putChunk(it->first, it->second); + + CTriObject::build(version, PMB_TRI_OBJECT_PARSE_FILTER); } void CEditableMesh::disown() { + m_EditableMeshUnknown.clear(); CTriObject::disown(); } @@ -95,9 +165,23 @@ const ISceneClassDesc *CEditableMesh::classDesc() const return &EditableMeshClassDesc; } -void CEditableMesh::toStringLocal(std::ostream &ostream, const std::string &pad) const +void CEditableMesh::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const { CTriObject::toStringLocal(ostream, pad); + + std::string padpad = pad + "\t"; + sint i = 0; + for (TStorageObjectContainer::const_iterator it = m_EditableMeshUnknown.begin(), end = m_EditableMeshUnknown.end(); it != end; ++it) + { + std::stringstream ss; + ss << std::hex << std::setfill('0'); + ss << std::setw(4) << it->first; + ostream << "\n" << pad << "EditableMeshUnkown[" << i << "] 0x" << ss.str() << ": "; + it->second->toString(ostream, padpad); + ++i; + } + + CTriObject::toStringLocal(ostream, pad, PMB_TRI_OBJECT_PARSE_FILTER); } IStorageObject *CEditableMesh::createChunkById(uint16 id, bool container) diff --git a/code/nel/tools/pipeline/max/update1/editable_mesh.h b/code/nel/tools/pipeline/max/update1/editable_mesh.h index d1ac46277..2dddc1376 100644 --- a/code/nel/tools/pipeline/max/update1/editable_mesh.h +++ b/code/nel/tools/pipeline/max/update1/editable_mesh.h @@ -59,18 +59,19 @@ public: static const TSClassId SuperClassId; // inherited - virtual void parse(uint16 version); + virtual void parse(uint16 version, uint filter = 0); virtual void clean(); - virtual void build(uint16 version); + virtual void build(uint16 version, uint filter = 0); virtual void disown(); virtual void init(); virtual bool inherits(const NLMISC::CClassId classId) const; virtual const ISceneClassDesc *classDesc() const; - virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const; + virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const; protected: // inherited virtual IStorageObject *createChunkById(uint16 id, bool container); + TStorageObjectContainer m_EditableMeshUnknown; }; /* class CEditableMesh */