Added: #1440 Extended parser for CTrackViewNode

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 028c5381d1
commit f5d2048f7c

@ -59,12 +59,15 @@ namespace BUILTIN {
#define PMB_REFERENCES_2034_CHUNK_ID 0x2034
#define PMB_REFERENCES_2035_CHUNK_ID 0x2035
#define PMB_204B_EQUALS_2E_CHUNK_ID 0x204B
#define PMB_UNKNOWN2045_CHUNK_ID 0x2045
#define PMB_UNKNOWN2047_CHUNK_ID 0x2047
#define PMB_UNKNOWN21B0_CHUNK_ID 0x21B0
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CReferenceMaker::CReferenceMaker(CScene *scene) : CAnimatable(scene), m_ReferenceMap(false), m_References2035Value0(0)
CReferenceMaker::CReferenceMaker(CScene *scene) : CAnimatable(scene), m_ReferenceMap(false), m_204B_Equals_2E(NULL), m_References2035Value0(0), m_Unknown2045(NULL), m_Unknown2047(NULL), m_Unknown21B0(NULL)
{
}
@ -75,6 +78,12 @@ CReferenceMaker::~CReferenceMaker()
{
delete m_204B_Equals_2E;
m_204B_Equals_2E = NULL;
delete m_Unknown2045;
m_Unknown2045 = NULL;
delete m_Unknown2047;
m_Unknown2047 = NULL;
delete m_Unknown21B0;
m_Unknown21B0 = NULL;
}
}
@ -132,6 +141,10 @@ void CReferenceMaker::parse(uint16 version)
setReference(index, referenceMaker);
}
}
m_Unknown2045 = static_cast<CStorageRaw *>(getChunk(PMB_UNKNOWN2045_CHUNK_ID)); // not sure if this is part of maker or target
m_Unknown2047 = static_cast<CStorageRaw *>(getChunk(PMB_UNKNOWN2047_CHUNK_ID)); // not sure if this is part of maker or target
m_Unknown21B0 = static_cast<CStorageRaw *>(getChunk(PMB_UNKNOWN21B0_CHUNK_ID)); // not sure if this is part of maker or target
}
}
@ -178,6 +191,9 @@ void CReferenceMaker::build(uint16 version)
m_ArchivedChunks.push_back(references2035);
}
if (m_204B_Equals_2E) putChunk(PMB_204B_EQUALS_2E_CHUNK_ID, m_204B_Equals_2E);
if (m_Unknown2045) putChunk(PMB_UNKNOWN2045_CHUNK_ID, m_Unknown2045);
if (m_Unknown2047) putChunk(PMB_UNKNOWN2047_CHUNK_ID, m_Unknown2047);
if (m_Unknown21B0) putChunk(PMB_UNKNOWN21B0_CHUNK_ID, m_Unknown21B0);
}
void CReferenceMaker::disown()
@ -186,6 +202,9 @@ void CReferenceMaker::disown()
m_ReferenceMap = false;
m_References2035Value0 = 0;
m_204B_Equals_2E = NULL;
m_Unknown2045 = NULL;
m_Unknown2047 = NULL;
m_Unknown21B0 = NULL;
CAnimatable::disown();
}
@ -240,6 +259,21 @@ void CReferenceMaker::toStringLocal(std::ostream &ostream, const std::string &pa
ostream << "\n" << pad << "0x204B Equals 0x2E (46): ";
m_204B_Equals_2E->toString(ostream, pad + "\t");
}
if (m_Unknown2045)
{
ostream << "\n" << pad << "Unknown 0x2045: ";
m_Unknown2045->toString(ostream, pad + "\t");
}
if (m_Unknown2047)
{
ostream << "\n" << pad << "Unknown 0x2047: ";
m_Unknown2047->toString(ostream, pad + "\t");
}
if (m_Unknown21B0)
{
ostream << "\n" << pad << "Unknown 0x21B0: ";
m_Unknown21B0->toString(ostream, pad + "\t");
}
}
CReferenceMaker *CReferenceMaker::getReference(uint index) const
@ -269,6 +303,8 @@ IStorageObject *CReferenceMaker::createChunkById(uint16 id, bool container)
return new CStorageArray<sint32>();
case PMB_204B_EQUALS_2E_CHUNK_ID:
return new CStorageValue<uint8>();
case PMB_UNKNOWN21B0_CHUNK_ID:
return new CStorageRaw();
}
return CAnimatable::createChunkById(id, container);
}

@ -90,6 +90,10 @@ private:
/// Unknown value
uint32 m_References2035Value0;
CStorageRaw *m_Unknown2045;
CStorageRaw *m_Unknown2047;
CStorageRaw *m_Unknown21B0;
}; /* class CReferenceMaker */
typedef CSceneClassDesc<CReferenceMaker> CReferenceMakerClassDesc;

@ -29,6 +29,7 @@
#include "track_view_node.h"
// STL includes
#include <iomanip>
// NeL includes
// #include <nel/misc/debug.h>
@ -49,7 +50,7 @@ namespace BUILTIN {
#define PMB_TVNODE_IDENTIFIER_CHUNK_ID 0x0120
#define PMB_TVNODE_INTEGER0130_CHUNK_ID 0x0130 /* type? */
CTrackViewNode::CTrackViewNode(CScene *scene) : CReferenceTarget(scene)
CTrackViewNode::CTrackViewNode(CScene *scene) : CReferenceTarget(scene), m_Empty0140(NULL), m_Empty0150(NULL)
{
}
@ -68,6 +69,33 @@ const CTrackViewNodeClassDesc TrackViewNodeClassDesc(&DllPluginDescBuiltin);
void CTrackViewNode::parse(uint16 version)
{
CReferenceTarget::parse(version);
if (!m_ChunksOwnsPointers)
{
// Read unknown chunks
m_Empty0140 = static_cast<CStorageRaw *>(getChunk(PMB_TVNODE_EMPTY0140_CHUNK_ID));
if (m_Empty0140) nlassert(m_Empty0140->Value.empty());
m_Empty0150 = static_cast<CStorageRaw *>(getChunk(PMB_TVNODE_EMPTY0150_CHUNK_ID));
if (m_Empty0150) nlassert(m_Empty0140->Value.empty());
// Read child nodes
for (std::vector<TChild>::size_type i = 0; i < m_Children.size(); ++i)
{
CStorageValue<ucstring> *displayName = static_cast<CStorageValue<ucstring> *>(getChunk(PMB_TVNODE_DISPLAYNAME_CHUNK_ID));
nlassert(displayName);
m_ArchivedChunks.push_back(displayName);
m_Children[i].DisplayName = displayName->Value;
CStorageValue<NLMISC::CClassId> *identifier = static_cast<CStorageValue<NLMISC::CClassId> *>(getChunk(PMB_TVNODE_IDENTIFIER_CHUNK_ID));
nlassert(identifier);
m_ArchivedChunks.push_back(identifier);
m_Children[i].Identifier = identifier->Value;
CStorageValue<sint32> *integer0130 = static_cast<CStorageValue<sint32> *>(getChunk(PMB_TVNODE_INTEGER0130_CHUNK_ID));
nlassert(integer0130);
m_ArchivedChunks.push_back(integer0130);
m_Children[i].Integer0130 = integer0130->Value;
}
}
}
void CTrackViewNode::clean()
@ -78,6 +106,29 @@ void CTrackViewNode::clean()
void CTrackViewNode::build(uint16 version)
{
CReferenceTarget::build(version);
// Write unknown chunks
if (m_Empty0140) putChunk(PMB_TVNODE_EMPTY0140_CHUNK_ID, m_Empty0140);
if (m_Empty0150) putChunk(PMB_TVNODE_EMPTY0150_CHUNK_ID, m_Empty0150);
// Write child nodes
for (std::vector<TChild>::size_type i = 0; i < m_Children.size(); ++i)
{
CStorageValue<ucstring> *displayName = new CStorageValue<ucstring>();
displayName->Value = m_Children[i].DisplayName;
m_ArchivedChunks.push_back(displayName);
putChunk(PMB_TVNODE_DISPLAYNAME_CHUNK_ID, displayName);
CStorageValue<NLMISC::CClassId> *identifier = new CStorageValue<NLMISC::CClassId>();
identifier->Value = m_Children[i].Identifier;
m_ArchivedChunks.push_back(identifier);
putChunk(PMB_TVNODE_IDENTIFIER_CHUNK_ID, identifier);
CStorageValue<sint32> *integer0130 = new CStorageValue<sint32>();
integer0130->Value = m_Children[i].Integer0130;
m_ArchivedChunks.push_back(integer0130);
putChunk(PMB_TVNODE_INTEGER0130_CHUNK_ID, integer0130);
}
}
void CTrackViewNode::disown()
@ -104,25 +155,43 @@ const ISceneClassDesc *CTrackViewNode::classDesc() const
void CTrackViewNode::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CReferenceTarget::toStringLocal(ostream, pad);
if (m_Empty0140) ostream << "\n" << pad << "Empty 0x0140 ";
if (m_Empty0150) ostream << "\n" << pad << "Empty 0x0150 ";
// std::string padpad = pad + "\t";
for (std::vector<TChild>::size_type i = 0; i < m_Children.size(); ++i)
{
CReferenceMaker *referenceMaker = m_Children[i].Reference;
nlassert(referenceMaker);
ostream << "\n" << pad << i << ": <ptr=0x";
{
std::stringstream ss;
ss << std::hex << std::setfill('0');
ss << std::setw(16) << (uint64)(void *)referenceMaker;
ostream << ss.str();
}
ostream << "> ";
ostream << "(" << ucstring(referenceMaker->classDesc()->displayName()).toUtf8() << ", " << referenceMaker->classDesc()->classId().toString() << ") ";
ostream << "(" << m_Children[i].DisplayName.toUtf8() << ", " << m_Children[i].Identifier.toString() << ", " << m_Children[i].Integer0130 << ") ";
}
}
/*
CReferenceMaker *CTrackViewNode::getReference(uint index) const
{
if (m_References.size() <= index) return NULL;
return m_References[index];
if (m_Children.size() <= index) return NULL;
return m_Children[index].Reference;
}
void CTrackViewNode::setReference(uint index, CReferenceMaker *reference)
{
if (m_References.size() <= index) m_References.resize(index + 1);
m_References[index] = reference;
if (m_Children.size() <= index) m_Children.resize(index + 1);
m_Children[index].Reference = reference;
}
uint CTrackViewNode::nbReferences() const
{
return m_References.size();
return m_Children.size();
}
*/
IStorageObject *CTrackViewNode::createChunkById(uint16 id, bool container)
{
switch (id)

@ -51,6 +51,7 @@ class CTrackViewNode : public CReferenceTarget
public:
struct TChild
{
TChild() : Integer0130(0) { }
NLMISC::CRefPtr<CReferenceMaker> Reference;
ucstring DisplayName;
NLMISC::CClassId Identifier;
@ -77,9 +78,9 @@ public:
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
// reference maker
/*virtual CReferenceMaker *getReference(uint index) const;
virtual CReferenceMaker *getReference(uint index) const;
virtual void setReference(uint index, CReferenceMaker *reference);
virtual uint nbReferences() const;*/
virtual uint nbReferences() const;
// read access
inline const std::vector<TChild> &children() const { return m_Children; }

@ -31,8 +31,8 @@
#include "../max/builtin/storage/app_data.h"
#include "../max/builtin/builtin.h"
//static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max";
static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max";
static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max";
//static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/test2008.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/teapot_test_scene.max";
static const char *streamname = "Scene";

Loading…
Cancel
Save