Changed: #1440 Simplify

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 1161178d2a
commit 58d57d3304

@ -68,10 +68,7 @@ void CNodeImpl::parse(uint16 version)
INode::parse(version);
if (!m_ChunksOwnsPointers)
{
CStorageValue<uint32> *nodeVersion = static_cast<CStorageValue<uint32> *>(getChunk(PMB_NODE_VERSION_CHUNK_ID));
nlassert(nodeVersion);
m_NodeVersion = nodeVersion->Value;
m_ArchivedChunks.push_back(nodeVersion);
m_NodeVersion = getChunkValue<uint32>(PMB_NODE_VERSION_CHUNK_ID);
CStorageArray<uint32> *parent = static_cast<CStorageArray<uint32> *>(getChunk(PMB_NODE_PARENT_CHUNK_ID));
nlassert(parent);
@ -81,10 +78,7 @@ void CNodeImpl::parse(uint16 version)
m_ParentFlags = parent->Value[1];
m_ArchivedChunks.push_back(parent);
CStorageValue<ucstring> *userName = static_cast<CStorageValue<ucstring> *>(getChunk(PMB_NODE_NAME_CHUNK_ID));
nlassert(userName);
m_UserName = userName->Value;
m_ArchivedChunks.push_back(userName);
m_UserName = getChunkValue<ucstring>(PMB_NODE_NAME_CHUNK_ID);
}
}
@ -97,10 +91,7 @@ void CNodeImpl::build(uint16 version)
{
INode::build(version);
CStorageValue<uint32> *nodeVersion = new CStorageValue<uint32>();
nodeVersion->Value = m_NodeVersion;
m_ArchivedChunks.push_back(nodeVersion);
putChunk(PMB_NODE_VERSION_CHUNK_ID, nodeVersion);
putChunkValue(PMB_NODE_VERSION_CHUNK_ID, m_NodeVersion);
CStorageArray<uint32> *parent = new CStorageArray<uint32>();
parent->Value.resize(2);
@ -109,10 +100,7 @@ void CNodeImpl::build(uint16 version)
m_ArchivedChunks.push_back(parent);
putChunk(PMB_NODE_PARENT_CHUNK_ID, parent);
CStorageValue<ucstring> *userName = new CStorageValue<ucstring>();
userName->Value = m_UserName;
m_ArchivedChunks.push_back(userName);
putChunk(PMB_NODE_NAME_CHUNK_ID, userName);
putChunkValue(PMB_NODE_NAME_CHUNK_ID, m_UserName);
}
void CNodeImpl::disown()

@ -48,7 +48,7 @@ namespace BUILTIN {
#define PMB_TVNODE_DISPLAYNAME_CHUNK_ID 0x0110
#define PMB_TVNODE_IDENTIFIER_CHUNK_ID 0x0120
#define PMB_TVNODE_INTEGER0130_CHUNK_ID 0x0130 /* type? */
#define PMB_TVNODE_ISNOTNODE_CHUNK_ID 0x0130
CTrackViewNode::CTrackViewNode(CScene *scene) : CReferenceTarget(scene), m_Empty0140(NULL), m_Empty0150(NULL)
{
@ -80,20 +80,9 @@ void CTrackViewNode::parse(uint16 version)
// 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;
m_Children[i].DisplayName = getChunkValue<ucstring>(PMB_TVNODE_DISPLAYNAME_CHUNK_ID);
m_Children[i].Identifier = getChunkValue<NLMISC::CClassId>(PMB_TVNODE_IDENTIFIER_CHUNK_ID);
m_Children[i].IsNotAnotherNode = getChunkValue<sint32>(PMB_TVNODE_ISNOTNODE_CHUNK_ID);
}
}
}
@ -114,25 +103,15 @@ void CTrackViewNode::build(uint16 version)
// 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);
putChunkValue(PMB_TVNODE_DISPLAYNAME_CHUNK_ID, m_Children[i].DisplayName);
putChunkValue(PMB_TVNODE_IDENTIFIER_CHUNK_ID, m_Children[i].Identifier);
putChunkValue(PMB_TVNODE_ISNOTNODE_CHUNK_ID, m_Children[i].IsNotAnotherNode);
}
}
void CTrackViewNode::disown()
{
m_Children.clear();
CReferenceTarget::disown();
}
@ -171,7 +150,7 @@ void CTrackViewNode::toStringLocal(std::ostream &ostream, const std::string &pad
}
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 << ") ";
ostream << "(" << m_Children[i].DisplayName.toUtf8() << ", " << m_Children[i].Identifier.toString() << ", " << (m_Children[i].IsNotAnotherNode ? "ENTRY" : "TVNODE") << ") ";
}
}
@ -200,7 +179,7 @@ IStorageObject *CTrackViewNode::createChunkById(uint16 id, bool container)
return new CStorageValue<ucstring>();
case PMB_TVNODE_IDENTIFIER_CHUNK_ID:
return new CStorageValue<NLMISC::CClassId>();
case PMB_TVNODE_INTEGER0130_CHUNK_ID:
case PMB_TVNODE_ISNOTNODE_CHUNK_ID:
return new CStorageValue<sint32>();
}
return CReferenceTarget::createChunkById(id, container);

@ -51,11 +51,11 @@ class CTrackViewNode : public CReferenceTarget
public:
struct TChild
{
TChild() : Integer0130(0) { }
TChild() : IsNotAnotherNode(0) { }
NLMISC::CRefPtr<CReferenceMaker> Reference;
ucstring DisplayName;
NLMISC::CClassId Identifier;
sint32 Integer0130;
sint32 IsNotAnotherNode;
};
CTrackViewNode(CScene *scene);

@ -199,9 +199,9 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
{
// Known unknown special identifiers...
case 0x2032:
return m_SceneClassRegistry->createUnknown(m_Scene, 0x0, NLMISC::CClassId(0x29263a68, 0x405f22f5), ucstring("Unknown 0x2032"), ucstring("0x2032_0x2033_dll"), ucstring("Not part of the dll directory!"));
return m_SceneClassRegistry->createUnknown(m_Scene, 0x0, NLMISC::CClassId(0x29263a68, 0x405f22f5), ucstring("OSM Derived"), ucstring("Internal"), ucstring("Internal"));
case 0x2033:
return m_SceneClassRegistry->createUnknown(m_Scene, 0x0, NLMISC::CClassId(0x4ec13906, 0x5578130e), ucstring("Unknown 0x2033"), ucstring("0x2032_0x2033_dll"), ucstring("Not part of the dll directory!"));
return m_SceneClassRegistry->createUnknown(m_Scene, 0x0, NLMISC::CClassId(0x4ec13906, 0x5578130e), ucstring("WSM Derived"), ucstring("Internal"), ucstring("Internal"));
// return new CSceneClass(m_Scene); // TODO: Make dummy dllentry and classentry for these...
// return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(dllEntry, classEntry));
}

@ -138,6 +138,12 @@ protected:
IStorageObject *getChunk(uint16 id);
/// Use during file build. Adds a chunk to the chunks that will be written to the file. Build is called when a chunk is passed through
void putChunk(uint16 id, IStorageObject *storageObject);
/// Same as getChunk but for lazy programmers, must use together with putChunkValue
template <typename T>
const T &getChunkValue(uint16 id);
/// Same as putChunk but for lazy programmers, must use together with getChunkValue
template <typename T>
void putChunkValue(uint16 id, const T &value);
//@}
protected:
@ -154,6 +160,24 @@ private:
}; /* class CSceneClass */
template <typename T>
const T &CSceneClass::getChunkValue(uint16 id)
{
CStorageValue<T> *chunk = static_cast<CStorageValue<T> *>(getChunk(id));
if (!chunk) { nlerror("Try to get required chunk value 0x%x but it does not exist, bad file format"); }
m_ArchivedChunks.push_back(chunk);
return chunk->Value;
}
template <typename T>
void CSceneClass::putChunkValue(uint16 id, const T &value)
{
CStorageValue<T> *chunk = new CStorageValue<T>();
chunk->Value = value;
m_ArchivedChunks.push_back(chunk);
putChunk(id, chunk);
}
/**
* \brief ISceneClassDesc
* \date 2012-08-19 19:25GMT

@ -33,8 +33,8 @@
#include "../max/builtin/scene_impl.h"
#include "../max/builtin/i_node.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