Added: #1440 Parse references

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 72d587fb51
commit dce3e67b73

@ -43,7 +43,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CAnimatable::CAnimatable(CScene *scene) : CSceneClass(scene), m_AppData(NULL)
CAnimatable::CAnimatable(PIPELINE::MAX::CScene *scene) : CSceneClass(scene), m_AppData(NULL)
{
}

@ -34,6 +34,7 @@
// NeL includes
// Project includes
#include "../scene.h"
#include "../scene_class.h"
#include "../super_class_desc.h"
@ -55,7 +56,7 @@ class CAppData;
class CAnimatable : public CSceneClass
{
public:
CAnimatable(CScene *scene);
CAnimatable(PIPELINE::MAX::CScene *scene);
virtual ~CAnimatable();
// class desc

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CBaseObject::CBaseObject(CScene *scene) : CReferenceTarget(scene)
CBaseObject::CBaseObject(PIPELINE::MAX::CScene *scene) : CReferenceTarget(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CBaseObject : public CReferenceTarget
{
public:
CBaseObject(CScene *scene);
CBaseObject(PIPELINE::MAX::CScene *scene);
virtual ~CBaseObject();
}; /* class CBaseObject */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CBitmapTex::CBitmapTex(CScene *scene) : CTexmap(scene)
CBitmapTex::CBitmapTex(PIPELINE::MAX::CScene *scene) : CTexmap(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CBitmapTex : public CTexmap
{
public:
CBitmapTex(CScene *scene);
CBitmapTex(PIPELINE::MAX::CScene *scene);
virtual ~CBitmapTex();
}; /* class CBitmapTex */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
INode::INode(CScene *scene) : CReferenceTarget(scene)
INode::INode(PIPELINE::MAX::CScene *scene) : CReferenceTarget(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class INode : public CReferenceTarget
{
public:
INode(CScene *scene);
INode(PIPELINE::MAX::CScene *scene);
virtual ~INode();
// class desc

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CModifier::CModifier(CScene *scene) : CBaseObject(scene)
CModifier::CModifier(PIPELINE::MAX::CScene *scene) : CBaseObject(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CModifier : public CBaseObject
{
public:
CModifier(CScene *scene);
CModifier(PIPELINE::MAX::CScene *scene);
virtual ~CModifier();
}; /* class CModifier */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CMtl::CMtl(CScene *scene) : CMtlBase(scene)
CMtl::CMtl(PIPELINE::MAX::CScene *scene) : CMtlBase(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CMtl : public CMtlBase
{
public:
CMtl(CScene *scene);
CMtl(PIPELINE::MAX::CScene *scene);
virtual ~CMtl();
}; /* class CMtl */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CMtlBase::CMtlBase(CScene *scene) : CReferenceTarget(scene)
CMtlBase::CMtlBase(PIPELINE::MAX::CScene *scene) : CReferenceTarget(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CMtlBase : public CReferenceTarget
{
public:
CMtlBase(CScene *scene);
CMtlBase(PIPELINE::MAX::CScene *scene);
virtual ~CMtlBase();
}; /* class CMtlBase */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CNodeImpl::CNodeImpl(CScene *scene) : INode(scene)
CNodeImpl::CNodeImpl(PIPELINE::MAX::CScene *scene) : INode(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CNodeImpl : public INode
{
public:
CNodeImpl(CScene *scene);
CNodeImpl(PIPELINE::MAX::CScene *scene);
virtual ~CNodeImpl();
// class desc

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CObject::CObject(CScene *scene) : CBaseObject(scene)
CObject::CObject(PIPELINE::MAX::CScene *scene) : CBaseObject(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CObject : public CBaseObject
{
public:
CObject(CScene *scene);
CObject(PIPELINE::MAX::CScene *scene);
virtual ~CObject();
}; /* class CObject */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CParamBlock::CParamBlock(CScene *scene) : CReferenceTarget(scene)
CParamBlock::CParamBlock(PIPELINE::MAX::CScene *scene) : CReferenceTarget(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CParamBlock : public CReferenceTarget
{
public:
CParamBlock(CScene *scene);
CParamBlock(PIPELINE::MAX::CScene *scene);
virtual ~CParamBlock();
}; /* class CParamBlock */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CParamBlock2::CParamBlock2(CScene *scene) : CReferenceTarget(scene)
CParamBlock2::CParamBlock2(PIPELINE::MAX::CScene *scene) : CReferenceTarget(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CParamBlock2 : public CReferenceTarget
{
public:
CParamBlock2(CScene *scene);
CParamBlock2(PIPELINE::MAX::CScene *scene);
virtual ~CParamBlock2();
}; /* class CParamBlock2 */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CPatchObject::CPatchObject(CScene *scene) : CObject(scene)
CPatchObject::CPatchObject(PIPELINE::MAX::CScene *scene) : CObject(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CPatchObject : public CObject
{
public:
CPatchObject(CScene *scene);
CPatchObject(PIPELINE::MAX::CScene *scene);
virtual ~CPatchObject();
}; /* class CPatchObject */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CPolyObject::CPolyObject(CScene *scene) : CObject(scene)
CPolyObject::CPolyObject(PIPELINE::MAX::CScene *scene) : CObject(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CPolyObject : public CObject
{
public:
CPolyObject(CScene *scene);
CPolyObject(PIPELINE::MAX::CScene *scene);
virtual ~CPolyObject();
}; /* class CPolyObject */

@ -29,6 +29,7 @@
#include "reference_maker.h"
// STL includes
#include <iomanip>
// NeL includes
// #include <nel/misc/debug.h>
@ -63,7 +64,7 @@ namespace BUILTIN {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CReferenceMaker::CReferenceMaker(CScene *scene) : CAnimatable(scene)
CReferenceMaker::CReferenceMaker(PIPELINE::MAX::CScene *scene) : CAnimatable(scene), m_ReferenceMap(false), m_References2035Value0(0)
{
}
@ -72,10 +73,6 @@ CReferenceMaker::~CReferenceMaker()
{
if (!m_ChunksOwnsPointers)
{
delete m_References2034;
m_References2034 = NULL;
delete m_References2035;
m_References2035 = NULL;
delete m_204B_Equals_2E;
m_204B_Equals_2E = NULL;
}
@ -94,35 +91,100 @@ void CReferenceMaker::parse(uint16 version, TParseLevel level)
CAnimatable::parse(version, level);
if (!m_ChunksOwnsPointers)
{
m_References2034 = static_cast<CStorageArray<sint32> *>(getChunk(PMB_REFERENCES_2034_CHUNK_ID));
m_References2035 = static_cast<CStorageArray<sint32> *>(getChunk(PMB_REFERENCES_2035_CHUNK_ID));
if (m_References2034) nlassert(m_References2035 == NULL); // Apparently, there can be only one.
if (m_References2035) nlassert(m_References2034 == NULL);
CStorageArray<sint32> *references2034 = static_cast<CStorageArray<sint32> *>(getChunk(PMB_REFERENCES_2034_CHUNK_ID));
CStorageArray<sint32> *references2035 = static_cast<CStorageArray<sint32> *>(getChunk(PMB_REFERENCES_2035_CHUNK_ID));
if (references2034) nlassert(references2035 == NULL); // Apparently, there can be only one.
if (references2035) nlassert(references2034 == NULL);
m_204B_Equals_2E = static_cast<CStorageValue<uint8> *>(getChunk(PMB_204B_EQUALS_2E_CHUNK_ID));
if (m_204B_Equals_2E) nlassert(m_204B_Equals_2E->Value == 0x2e); // Really, let me know when it has another value.
// TODO: Parse contents
// Parse contents
if (references2034)
{
m_ReferenceMap = false; // NOTE: Plugins may check after parse if they parsed with the correct type, to find a pattern
m_ArchivedChunks.push_back(references2034);
for (std::vector<sint32>::size_type i = 0; i < references2034->Value.size(); ++i)
{
if (references2034->Value[i] > 0)
{
CReferenceMaker *referenceMaker = dynamic_cast<CReferenceMaker *>(container()->getByStorageIndex(references2034->Value[i]));
if (!referenceMaker) nlerror("Reference maker is %s not a reference maker", container()->getByStorageIndex(references2034->Value[i])->classDesc()->classId().toString().c_str());
setReference(i, referenceMaker);
}
}
}
if (references2035)
{
m_ReferenceMap = true;
m_ArchivedChunks.push_back(references2035);
std::vector<sint32>::iterator it = references2035->Value.begin();
m_References2035Value0 = (*it);
++it;
std::vector<sint32>::iterator end = references2035->Value.end();
while (it != end)
{
sint32 index = (*it);
++it;
sint32 referenceindex = (*it);
++it;
CReferenceMaker *referenceMaker = dynamic_cast<CReferenceMaker *>(container()->getByStorageIndex(referenceindex));
if (!referenceMaker) nlerror("Reference maker is %s not a reference maker", container()->getByStorageIndex(referenceindex)->classDesc()->classId().toString().c_str());
setReference(index, referenceMaker);
}
}
}
}
void CReferenceMaker::clean()
{
CAnimatable::clean();
// TODO: Delete unnecessary stuff
CAnimatable::clean(); // Nothing to do here, m_ArchivedChunks is cleaned (deleted) for us!
}
void CReferenceMaker::build(uint16 version)
{
CAnimatable::build(version);
// TODO: Build contents
if (m_References2034) putChunk(PMB_REFERENCES_2034_CHUNK_ID, m_References2034);
if (m_References2035) putChunk(PMB_REFERENCES_2035_CHUNK_ID, m_References2035);
//if (m_References2034) putChunk(PMB_REFERENCES_2034_CHUNK_ID, m_References2034);
//if (m_References2035) putChunk(PMB_REFERENCES_2035_CHUNK_ID, m_References2035);
if (!m_ReferenceMap)
{
CStorageArray<sint32> *references2034 = new CStorageArray<sint32>();
uint nb = nbReferences();
references2034->Value.resize(nb);
for (uint i = 0; i < nb; ++i)
{
CReferenceMaker *referenceMaker = getReference(i);
if (referenceMaker) references2034->Value[i] = container()->getOrCreateStorageIndex(referenceMaker);
else references2034->Value[i] = -1;
}
putChunk(PMB_REFERENCES_2034_CHUNK_ID, references2034);
m_ArchivedChunks.push_back(references2034);
}
else
{
CStorageArray<sint32> *references2035 = new CStorageArray<sint32>();
uint nb = nbReferences();
references2035->Value.push_back(m_References2035Value0);
for (uint i = 0; i < nb; ++i)
{
CReferenceMaker *referenceMaker = getReference(i);
if (referenceMaker)
{
references2035->Value.push_back(i);
references2035->Value.push_back(container()->getOrCreateStorageIndex(referenceMaker));
}
}
putChunk(PMB_REFERENCES_2035_CHUNK_ID, references2035);
m_ArchivedChunks.push_back(references2035);
}
if (m_204B_Equals_2E) putChunk(PMB_204B_EQUALS_2E_CHUNK_ID, m_204B_Equals_2E);
}
void CReferenceMaker::disown()
{
m_References2034 = NULL;
m_References2035 = NULL;
m_References.clear();
m_ReferenceMap = false;
m_References2035Value0 = 0;
m_204B_Equals_2E = NULL;
CAnimatable::disown();
}
@ -146,15 +208,32 @@ const ISceneClassDesc *CReferenceMaker::classDesc() const
void CReferenceMaker::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CAnimatable::toStringLocal(ostream, pad);
if (m_References2034)
uint nb = nbReferences();
if (nb)
{
ostream << "\n" << pad << "References 0x2034: ";
m_References2034->toString(ostream, pad + "\t");
}
if (m_References2035)
if (!m_ReferenceMap) ostream << "\n" << pad << "References 0x2034: ";
else ostream << "\n" << pad << "References 0x2035: ";
std::string padpad = pad + "\t";
ostream << "PARSED ";
if (!m_References.size()) ostream << "VIRTUAL ";
ostream << "{ ";
for (uint i = 0; i < nb; ++i)
{
CReferenceMaker *referenceMaker = getReference(i);
if (referenceMaker)
{
ostream << "\n" << pad << "References 0x2035: ";
m_References2035->toString(ostream, pad + "\t");
ostream << "\n" << padpad << 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 << "} ";
}
if (m_204B_Equals_2E)
{
@ -163,6 +242,23 @@ void CReferenceMaker::toStringLocal(std::ostream &ostream, const std::string &pa
}
}
CReferenceMaker *CReferenceMaker::getReference(uint index) const
{
if (m_References.size() <= index) return NULL;
return m_References[index];
}
void CReferenceMaker::setReference(uint index, CReferenceMaker *reference)
{
if (m_References.size() <= index) m_References.resize(index + 1);
m_References[index] = reference;
}
uint CReferenceMaker::nbReferences() const
{
return m_References.size();
}
IStorageObject *CReferenceMaker::createChunkById(uint16 id, bool container)
{
switch (id)

@ -50,7 +50,7 @@ namespace BUILTIN {
class CReferenceMaker : public CAnimatable
{
public:
CReferenceMaker(CScene *scene);
CReferenceMaker(PIPELINE::MAX::CScene *scene);
virtual ~CReferenceMaker();
// class desc
@ -70,15 +70,26 @@ public:
virtual const ISceneClassDesc *classDesc() const;
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
// child classes should inherit, default implementation stores in a vector
/// Get a reference
virtual CReferenceMaker *getReference(uint index) const;
virtual void setReference(uint index, CReferenceMaker *reference);
virtual uint nbReferences() const;
protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
/// Storage method
bool m_ReferenceMap;
private:
CStorageArray<sint32> *m_References2034;
CStorageArray<sint32> *m_References2035;
CStorageValue<uint8> *m_204B_Equals_2E;
/// Default implementation, should preferably not use this, no direct read access will be provided
std::vector<NLMISC::CRefPtr<CReferenceMaker> > m_References;
/// Unknown value
uint32 m_References2035Value0;
}; /* class CReferenceMaker */
typedef CSceneClassDesc<CReferenceMaker> CReferenceMakerClassDesc;

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CReferenceTarget::CReferenceTarget(CScene *scene) : CReferenceMaker(scene)
CReferenceTarget::CReferenceTarget(PIPELINE::MAX::CScene *scene) : CReferenceMaker(scene)
{
}

@ -50,7 +50,7 @@ namespace BUILTIN {
class CReferenceTarget : public CReferenceMaker
{
public:
CReferenceTarget(CScene *scene);
CReferenceTarget(PIPELINE::MAX::CScene *scene);
virtual ~CReferenceTarget();
// class desc

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CStdMat::CStdMat(CScene *scene) : CMtl(scene)
CStdMat::CStdMat(PIPELINE::MAX::CScene *scene) : CMtl(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CStdMat : public CMtl
{
public:
CStdMat(CScene *scene);
CStdMat(PIPELINE::MAX::CScene *scene);
virtual ~CStdMat();
}; /* class CStdMat */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CStdMat2::CStdMat2(CScene *scene) : CStdMat(scene)
CStdMat2::CStdMat2(PIPELINE::MAX::CScene *scene) : CStdMat(scene)
{
}

@ -55,7 +55,7 @@ protected:
// instances
// ...
public:
CStdMat2(CScene *scene);
CStdMat2(PIPELINE::MAX::CScene *scene);
virtual ~CStdMat2();
}; /* class CStdMat2 */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CTexmap::CTexmap(CScene *scene) : CMtlBase(scene)
CTexmap::CTexmap(PIPELINE::MAX::CScene *scene) : CMtlBase(scene)
{
}

@ -49,7 +49,7 @@ namespace BUILTIN {
class CTexmap : public CMtlBase
{
public:
CTexmap(CScene *scene);
CTexmap(PIPELINE::MAX::CScene *scene);
virtual ~CTexmap();
}; /* class CTexmap */

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CTriObject::CTriObject(CScene *scene) : CObject(scene)
CTriObject::CTriObject(PIPELINE::MAX::CScene *scene) : CObject(scene)
{
}

@ -50,7 +50,7 @@ class CTriObject : public CObject
{
public:
CTriObject(CScene *scene);
CTriObject(PIPELINE::MAX::CScene *scene);
virtual ~CTriObject();
}; /* class CTriObject */

@ -141,24 +141,52 @@ void CSceneClassContainer::toString(std::ostream &ostream, const std::string &pa
void CSceneClassContainer::parse(uint16 version, TParseLevel level)
{
// Temporary 'readonly' implementation, not modifying m_Chunks!
m_StorageObjectByIndex.resize(m_Chunks.size());
TStorageObjectIterator it = m_Chunks.begin();
for (std::vector<CSceneClass *>::size_type i = 0; i < m_StorageObjectByIndex.size(); ++i)
{
m_StorageObjectByIndex[i] = static_cast<CSceneClass *>(it->second);
++it;
}
CStorageContainer::parse(version, level);
}
void CSceneClassContainer::clean()
{
// Temporary 'readonly' implementation, not modifying m_Chunks!
CStorageContainer::clean();
}
void CSceneClassContainer::build(uint16 version)
{
// Temporary 'readonly' implementation, not modifying m_Chunks!
for (std::vector<CSceneClass *>::size_type i = 0; i < m_StorageObjectByIndex.size(); ++i)
{
m_StorageObjectToIndex[m_StorageObjectByIndex[i]] = i;
}
CStorageContainer::build(version);
}
void CSceneClassContainer::disown()
{
// Temporary 'readonly' implementation, not modifying m_Chunks!
CStorageContainer::disown();
}
CSceneClass *CSceneClassContainer::getByStorageIndex(uint32 index) const
{
// Temporary 'readonly' implementation, not modifying m_Chunks!
if (index >= m_StorageObjectByIndex.size()) { nlerror("Index %i is outside size %i", index, m_StorageObjectByIndex.size()); return NULL; }
return m_StorageObjectByIndex[index];
}
uint32 CSceneClassContainer::getOrCreateStorageIndex(CSceneClass *storageObject)
{
// Temporary 'readonly' implementation, not modifying m_Chunks!
return m_StorageObjectToIndex[storageObject];
}
IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
{
// nldebug("Scene class id %x (%i)", (uint32)id, (uint32)id);

@ -37,10 +37,16 @@
// Project includes
#include "storage_object.h"
#include "storage_value.h"
#include "scene_class.h"
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
class CScene;
}
class CSceneClass;
// Registry containing available scene classes
class CSceneClassRegistry;
@ -114,6 +120,10 @@ public:
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
public:
/// Return the single instance of the builtin scene class
inline BUILTIN::CScene *scene() { return NULL; }
private:
CScene *m_Scene;
@ -121,8 +131,8 @@ private:
CDllDirectory *m_DllDirectory;
CClassDirectory3 *m_ClassDirectory3;
std::vector<IStorageObject *> m_StorageObjectByIndex;
std::map<IStorageObject *, uint32> m_StorageObjectToIndex;
std::vector<CSceneClass *> m_StorageObjectByIndex;
std::map<CSceneClass *, uint32> m_StorageObjectToIndex;
}; /* class CSceneClassContainer */

@ -68,7 +68,15 @@ CSceneClass::CSceneClass(CScene *scene) : m_Scene(scene)
CSceneClass::~CSceneClass()
{
if (!m_ChunksOwnsPointers)
{
for (TStorageObjectContainer::iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it)
delete it->second;
m_OrphanedChunks.clear();
for (std::vector<IStorageObject *>::iterator it = m_ArchivedChunks.begin(), end = m_ArchivedChunks.end(); it != end; ++it)
delete (*it);
m_ArchivedChunks.clear();
}
}
std::string CSceneClass::className() const
@ -84,7 +92,22 @@ void CSceneClass::toString(std::ostream &ostream, const std::string &pad) const
}
else
{
ostream << "(" << className() << ": " << ucstring(classDesc()->displayName()).toUtf8() << ", " << classDesc()->classId().toString() << ", " << ucstring(classDesc()->dllPluginDesc()->internalName()).toUtf8() << ") [" << m_Chunks.size() << "] { ";
ostream << "<ptr=0x";
{
std::stringstream ss;
ss << std::hex << std::setfill('0');
ss << std::setw(16) << (uint64)(void *)this;
ostream << ss.str();
}
ostream << "> ";
ostream << "(" << className() << ": " << ucstring(classDesc()->displayName()).toUtf8() << ", " << classDesc()->classId().toString() << ", 0x";
{
std::stringstream ss;
ss << std::hex << std::setfill('0');
ss << std::setw(8) << classDesc()->superClassId();
ostream << ss.str();
}
ostream << ", " << ucstring(classDesc()->dllPluginDesc()->internalName()).toUtf8() << ") [" << m_OrphanedChunks.size() << "] { ";
toStringLocal(ostream, pad);
// Append orphans
std::string padpad = pad + "\t";
@ -137,6 +160,11 @@ void CSceneClass::clean()
static_cast<CStorageContainer *>(it->second)->clean();
}
}
// Erase archived chunks, they must have been parsed perfectly
for (std::vector<IStorageObject *>::iterator it = m_ArchivedChunks.begin(), end = m_ArchivedChunks.end(); it != end; ++it)
delete (*it);
m_ArchivedChunks.clear();
}
void CSceneClass::build(uint16 version)
@ -166,6 +194,7 @@ void CSceneClass::disown()
// Clear local references
m_OrphanedChunks.clear();
m_ArchivedChunks.clear();
// Return ownership
m_ChunksOwnsPointers = true;

@ -40,11 +40,16 @@
#include "storage_object.h"
#include "storage_value.h"
#include "dll_plugin_desc.h"
#include "scene.h"
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
class CScene;
}
class ISceneClassDesc;
/**
@ -62,7 +67,7 @@ class ISceneClassDesc;
* CRefPtr<T> is a safe handle, which you can use to verify if the class
* has been deleted or not, similar to AnimHandle in max.
*/
class CSceneClass : public CStorageContainer, public NLMISC::CRefCount
class CSceneClass : public CStorageContainer, public NLMISC::CVirtualRefCount
{
public:
CSceneClass(CScene *scene);
@ -116,6 +121,16 @@ public:
inline const TStorageObjectContainer &orphanedChunks() const { return m_OrphanedChunks; }
//@}
//! \name Scene utility access
//@{
/// Return the scene scene class
inline BUILTIN::CScene *scene() const { return m_Scene->container()->scene(); }
/// Return the scene version
inline uint16 version() const { return m_Scene->version(); }
/// Return the scene container
inline CSceneClassContainer *container() const { return m_Scene->container(); }
//@}
protected:
//! \name Methods used by inheriting classes to read and write to the storage safely
//@{
@ -128,6 +143,9 @@ protected:
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
/// Chunks which have been parsed, kept unmodified, and which are no longer necessary, should be placed here
std::vector<IStorageObject *> m_ArchivedChunks;
private:
TStorageObjectContainer m_OrphanedChunks;
TStorageObjectIterator m_PutChunkInsert;

@ -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";

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save