Added: #1440 Pointer to CScene storage

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

@ -43,7 +43,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CAnimatable::CAnimatable() : m_AppData(NULL)
CAnimatable::CAnimatable(CScene *scene) : CSceneClass(scene), m_AppData(NULL)
{
}
@ -57,7 +57,7 @@ CAnimatable::~CAnimatable()
}
}
const ucchar *CAnimatable::DisplayName = ucstring("Animatable").c_str();
const ucstring CAnimatable::DisplayName = ucstring("Animatable");
const char *CAnimatable::InternalName = "Animatable";
const char *CAnimatable::InternalNameUnknown = "AnimatableUnknown";
const NLMISC::CClassId CAnimatable::ClassId = NLMISC::CClassId(0x3101497b, 0x24af711b); /* Not official, please correct */

@ -55,11 +55,11 @@ class CAppData;
class CAnimatable : public CSceneClass
{
public:
CAnimatable();
CAnimatable(CScene *scene);
virtual ~CAnimatable();
// class desc
static const ucchar *DisplayName;
static const ucstring DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;

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

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

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

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

@ -35,10 +35,13 @@
// Project includes
#include "../scene_class_registry.h"
#include "animatable.h"
#include "reference_maker.h"
#include "reference_target.h"
#include "i_node.h"
#include "node_impl.h"
// using namespace std;
// using namespace NLMISC;
@ -204,6 +207,9 @@ CBuiltin::~CBuiltin()
void CBuiltin::registerClasses(CSceneClassRegistry *registry)
{
// invalid
registry->add(&NullSuperClassDesc);
// available
registry->add(&AnimatableClassDesc);
registry->add(&AnimatableSuperClassDesc);
@ -212,11 +218,12 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
registry->add(&ReferenceTargetClassDesc);
registry->add(&ReferenceTargetSuperClassDesc);
registry->add(&NodeClassDesc);
// node
registry->add(&NodeSuperClassDesc);
// invalid
registry->add(&NullSuperClassDesc);
{
registry->add(&NodeClassDesc);
registry->add(&NodeImplClassDesc);
}
// unimplemented
registry->add(&ControlFloatSuperClassDesc);

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
INode::INode()
INode::INode(CScene *scene) : CReferenceTarget(scene)
{
}
@ -52,7 +52,7 @@ INode::~INode()
}
const ucchar *INode::DisplayName = ucstring("Node").c_str();
const ucstring INode::DisplayName = ucstring("Node Interface");
const char *INode::InternalName = "Node";
const char *INode::InternalNameUnknown = "NodeUnknown";
const NLMISC::CClassId INode::ClassId = NLMISC::CClassId(0x8f5b13, 0x624d477d); /* Not official, please correct */

@ -49,11 +49,11 @@ namespace BUILTIN {
class INode : public CReferenceTarget
{
public:
INode();
INode(CScene *scene);
virtual ~INode();
// class desc
static const ucchar *DisplayName;
static const ucstring DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;

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

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

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

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

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

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

@ -1,59 +0,0 @@
/**
* \file node.cpp
* \brief CNode
* \date 2012-08-22 08:57GMT
* \author Jan Boon (Kaetemi)
* CNode
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include "node.h"
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CNode::CNode()
{
}
CNode::~CNode()
{
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */
/* end of file */

@ -1,63 +0,0 @@
/**
* \file node.h
* \brief CNode
* \date 2012-08-22 08:57GMT
* \author Jan Boon (Kaetemi)
* CNode
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef PIPELINE_NODE_H
#define PIPELINE_NODE_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include "reference_target.h"
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
/**
* \brief CNode
* \date 2012-08-22 08:57GMT
* \author Jan Boon (Kaetemi)
* CNode
*/
class CNode : public CReferenceTarget
{
public:
CNode();
virtual ~CNode();
}; /* class CNode */
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */
#endif /* #ifndef PIPELINE_NODE_H */
/* end of file */

@ -0,0 +1,111 @@
/**
* \file node_impl.cpp
* \brief CNodeImpl
* \date 2012-08-22 20:01GMT
* \author Jan Boon (Kaetemi)
* CNodeImpl
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include "node_impl.h"
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CNodeImpl::CNodeImpl(CScene *scene) : INode(scene)
{
}
CNodeImpl::~CNodeImpl()
{
}
const ucstring CNodeImpl::DisplayName = ucstring("Node");
const char *CNodeImpl::InternalName = "NodeImpl";
const NLMISC::CClassId CNodeImpl::ClassId = NLMISC::CClassId(0x00000001, 0x00000000);
const TSClassId CNodeImpl::SuperClassId = INode::SuperClassId;
const CNodeImplClassDesc NodeImplClassDesc(&DllPluginDescBuiltin);
void CNodeImpl::parse(uint16 version, TParseLevel level)
{
INode::parse(version, level);
}
void CNodeImpl::clean()
{
INode::clean();
}
void CNodeImpl::build(uint16 version)
{
INode::build(version);
}
void CNodeImpl::disown()
{
INode::disown();
}
void CNodeImpl::init()
{
INode::init();
}
bool CNodeImpl::inherits(const NLMISC::CClassId classId) const
{
if (classId == classDesc()->classId()) return true;
return INode::inherits(classId);
}
const ISceneClassDesc *CNodeImpl::classDesc() const
{
return &NodeImplClassDesc;
}
void CNodeImpl::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
INode::toStringLocal(ostream, pad);
}
IStorageObject *CNodeImpl::createChunkById(uint16 id, bool container)
{
return INode::createChunkById(id, container);
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */
/* end of file */

@ -0,0 +1,86 @@
/**
* \file node_impl.h
* \brief CNodeImpl
* \date 2012-08-22 20:01GMT
* \author Jan Boon (Kaetemi)
* CNodeImpl
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef PIPELINE_NODE_IMPL_H
#define PIPELINE_NODE_IMPL_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include "i_node.h"
namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
/**
* \brief CNodeImpl
* \date 2012-08-22 20:01GMT
* \author Jan Boon (Kaetemi)
* CNodeImpl
*/
class CNodeImpl : public INode
{
public:
CNodeImpl(CScene *scene);
virtual ~CNodeImpl();
// class desc
static const ucstring DisplayName;
static const char *InternalName;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
// inherited
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
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;
protected:
// inherited
virtual IStorageObject *createChunkById(uint16 id, bool container);
}; /* class CNodeImpl */
typedef CSceneClassDesc<CNodeImpl> CNodeImplClassDesc;
extern const CNodeImplClassDesc NodeImplClassDesc;
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */
#endif /* #ifndef PIPELINE_NODE_IMPL_H */
/* end of file */

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

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

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

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

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

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

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

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

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

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

@ -63,7 +63,7 @@ namespace BUILTIN {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CReferenceMaker::CReferenceMaker()
CReferenceMaker::CReferenceMaker(CScene *scene) : CAnimatable(scene)
{
}
@ -81,7 +81,7 @@ CReferenceMaker::~CReferenceMaker()
}
}
const ucchar *CReferenceMaker::DisplayName = ucstring("ReferenceMaker").c_str();
const ucstring CReferenceMaker::DisplayName = ucstring("ReferenceMaker");
const char *CReferenceMaker::InternalName = "ReferenceMaker";
const char *CReferenceMaker::InternalNameUnknown = "ReferenceMakerUnknown";
const NLMISC::CClassId CReferenceMaker::ClassId = NLMISC::CClassId(0x2ec43d15, 0x10a270ad); /* Not official, please correct */

@ -50,11 +50,11 @@ namespace BUILTIN {
class CReferenceMaker : public CAnimatable
{
public:
CReferenceMaker();
CReferenceMaker(CScene *scene);
virtual ~CReferenceMaker();
// class desc
static const ucchar *DisplayName;
static const ucstring DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;

@ -42,7 +42,7 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
CReferenceTarget::CReferenceTarget()
CReferenceTarget::CReferenceTarget(CScene *scene) : CReferenceMaker(scene)
{
}
@ -52,7 +52,7 @@ CReferenceTarget::~CReferenceTarget()
}
const ucchar *CReferenceTarget::DisplayName = ucstring("ReferenceTarget").c_str();
const ucstring CReferenceTarget::DisplayName = ucstring("ReferenceTarget");
const char *CReferenceTarget::InternalName = "ReferenceTarget";
const char *CReferenceTarget::InternalNameUnknown = "ReferenceTargetUnknown";
const NLMISC::CClassId CReferenceTarget::ClassId = NLMISC::CClassId(0x5d545dd9, 0xa422e4); /* Not official, please correct */

@ -45,15 +45,16 @@ namespace BUILTIN {
* \date 2012-08-22 08:53GMT
* \author Jan Boon (Kaetemi)
* Dummy class, supposed to send or receive events or something.
* Nice for copy pasting the basic class layout.
*/
class CReferenceTarget : public CReferenceMaker
{
public:
CReferenceTarget();
CReferenceTarget(CScene *scene);
virtual ~CReferenceTarget();
// class desc
static const ucchar *DisplayName;
static const ucstring DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;

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

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

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

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

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

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

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

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

@ -110,7 +110,7 @@ IStorageObject *CScene::createChunkById(uint16 id, bool container)
if (container)
{
// Return the scene class container. There can be only one.
return new CSceneClassContainer(m_SceneClassRegistry, m_DllDirectory, m_ClassDirectory3);
return new CSceneClassContainer(this, m_SceneClassRegistry, m_DllDirectory, m_ClassDirectory3);
}
return CStorageContainer::createChunkById(id, container);
}
@ -119,7 +119,7 @@ IStorageObject *CScene::createChunkById(uint16 id, bool container)
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CSceneClassContainer::CSceneClassContainer(const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3) : m_SceneClassRegistry(sceneClassRegistry), m_DllDirectory(dllDirectory), m_ClassDirectory3(classDirectory3)
CSceneClassContainer::CSceneClassContainer(CScene *scene, const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3) : m_Scene(scene), m_SceneClassRegistry(sceneClassRegistry), m_DllDirectory(dllDirectory), m_ClassDirectory3(classDirectory3)
{
}
@ -167,11 +167,11 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
// Known unknown special identifiers...
case 0x2032:
case 0x2033:
return new CSceneClass(); // TODO: Make dummy dllentry and classentry for these...
return new CSceneClass(m_Scene); // TODO: Make dummy dllentry and classentry for these...
// return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(dllEntry, classEntry));
}
const CClassEntry *classEntry = m_ClassDirectory3->get(id);
CSceneClass *sceneClass = m_SceneClassRegistry->create(classEntry->superClassId(), classEntry->classId());
CSceneClass *sceneClass = m_SceneClassRegistry->create(m_Scene, classEntry->superClassId(), classEntry->classId());
if (sceneClass)
{
return static_cast<IStorageObject *>(sceneClass);
@ -179,7 +179,7 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
else
{
const CDllEntry *dllEntry = m_DllDirectory->get(classEntry->dllIndex());
sceneClass = m_SceneClassRegistry->createUnknown(classEntry->superClassId(), classEntry->classId(), classEntry->displayName(), dllEntry->dllFilename(), dllEntry->dllDescription());
sceneClass = m_SceneClassRegistry->createUnknown(m_Scene, classEntry->superClassId(), classEntry->classId(), classEntry->displayName(), dllEntry->dllFilename(), dllEntry->dllDescription());
if (sceneClass)
{
return static_cast<IStorageObject *>(sceneClass);
@ -187,7 +187,7 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
else
{
// Create an invalid unknown scene class
return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), "SceneClassUnknown", dllEntry->dllFilename(), dllEntry->dllDescription()));
return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(m_Scene,classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), "SceneClassUnknown", dllEntry->dllFilename(), dllEntry->dllDescription()));
}
}
}

@ -93,7 +93,7 @@ private:
class CSceneClassContainer : public CStorageContainer
{
public:
CSceneClassContainer(const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3);
CSceneClassContainer(CScene *scene, const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3);
virtual ~CSceneClassContainer();
// inherited
@ -104,14 +104,26 @@ public:
virtual void build(uint16 version);
virtual void disown();
/// Use while parsing to get an object by it's index
CSceneClass *getByStorageIndex(uint32 index) const;
/// Use while building to get an index for an object
uint32 getOrCreateStorageIndex(CSceneClass *storageObject);
/// TODO: Evaluate the references tree to build new indexes.
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
private:
CScene *m_Scene;
const CSceneClassRegistry *m_SceneClassRegistry;
CDllDirectory *m_DllDirectory;
CClassDirectory3 *m_ClassDirectory3;
std::vector<IStorageObject *> m_StorageObjectByIndex;
std::map<IStorageObject *, uint32> m_StorageObjectToIndex;
}; /* class CSceneClassContainer */
} /* namespace MAX */

@ -61,7 +61,7 @@ namespace MAX {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CSceneClass::CSceneClass()
CSceneClass::CSceneClass(CScene *scene) : m_Scene(scene)
{
}
@ -184,7 +184,7 @@ IStorageObject *CSceneClass::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
const ucchar *CSceneClass::DisplayName = ucstring("Invalid Scene Class").c_str();
const ucstring CSceneClass::DisplayName = ucstring("Invalid Scene Class");
const char *CSceneClass::InternalName = "SceneClass";
const NLMISC::CClassId CSceneClass::ClassId = NLMISC::CClassId::Null; // This class is invalid
const TSClassId CSceneClass::SuperClassId = 0x0000; // This class is invalid

@ -44,6 +44,7 @@
namespace PIPELINE {
namespace MAX {
class CScene;
class ISceneClassDesc;
/**
@ -64,7 +65,7 @@ class ISceneClassDesc;
class CSceneClass : public CStorageContainer, public NLMISC::CRefCount
{
public:
CSceneClass();
CSceneClass(CScene *scene);
virtual ~CSceneClass();
//! \name Inherited functions that are implemented by wrapping around other virtual functions in this class
@ -93,7 +94,7 @@ public:
//! \name Static const variables for the class description
//@{
static const ucchar *DisplayName;
static const ucstring DisplayName;
static const char *InternalName;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
@ -131,6 +132,8 @@ private:
TStorageObjectContainer m_OrphanedChunks;
TStorageObjectIterator m_PutChunkInsert;
CScene *m_Scene;
}; /* class CSceneClass */
/**
@ -142,7 +145,7 @@ private:
class ISceneClassDesc
{
public:
virtual CSceneClass *create() const = 0;
virtual CSceneClass *create(CScene *scene) const = 0;
virtual void destroy(CSceneClass *sc) const = 0;
virtual const ucchar *displayName() const = 0;
virtual const char *internalName() const = 0;
@ -164,9 +167,9 @@ class CSceneClassDesc : public ISceneClassDesc
{
public:
CSceneClassDesc(const IDllPluginDescInternal *dllPluginDesc) : m_DllPluginDesc(dllPluginDesc) { }
virtual CSceneClass *create() const { return static_cast<CSceneClass *>(new T()); }
virtual CSceneClass *create(CScene *scene) const { return static_cast<CSceneClass *>(new T(scene)); }
virtual void destroy(CSceneClass *sc) const { delete static_cast<T *>(sc); }
virtual const ucchar *displayName() const { return T::DisplayName; }
virtual const ucchar *displayName() const { return T::DisplayName.c_str(); }
virtual const char *internalName() const { return T::InternalName; }
virtual NLMISC::CClassId classId() const { return T::ClassId; }
virtual TSClassId superClassId() const { return T::SuperClassId; }

@ -98,18 +98,18 @@ void CSceneClassRegistry::remove(const TSClassId superClassId)
}
/// Create a class by class id
CSceneClass *CSceneClassRegistry::create(const TSClassId superClassId, const NLMISC::CClassId classId) const
CSceneClass *CSceneClassRegistry::create(CScene *scene, const TSClassId superClassId, const NLMISC::CClassId classId) const
{
TKey key(superClassId, classId);
if (m_ClassDescriptions.find(key) == m_ClassDescriptions.end()) { /* nldebug("Try to create class that does not exist"); */ return NULL; }
return m_ClassDescriptions.find(key)->second->create();
return m_ClassDescriptions.find(key)->second->create(scene);
}
/// Create an unknown class by superclass id
CSceneClass *CSceneClassRegistry::createUnknown(TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const
CSceneClass *CSceneClassRegistry::createUnknown(CScene *scene, TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const
{
if (m_SuperClassDescriptions.find(superClassId) == m_SuperClassDescriptions.end()) { nlwarning("Creating superclass 0x%x (%s) %s that does not exist", superClassId, displayName.toUtf8().c_str(), classId.toString().c_str()); return NULL; }
return m_SuperClassDescriptions.find(superClassId)->second->createUnknown(classId, displayName, dllFilename, dllDescription);
return m_SuperClassDescriptions.find(superClassId)->second->createUnknown(scene, classId, displayName, dllFilename, dllDescription);
}
/// Destroy a class by pointer

@ -63,10 +63,10 @@ public:
void remove(const TSClassId superClassId);
/// Create a class by class id
CSceneClass *create(TSClassId superClassId, const NLMISC::CClassId classId) const;
CSceneClass *create(CScene *scene, TSClassId superClassId, const NLMISC::CClassId classId) const;
/// Create an unknown class by superclass id
CSceneClass *createUnknown(TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const;
CSceneClass *createUnknown(CScene *scene, TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const;
/// Destroy a class by pointer
void destroy(CSceneClass *sceneClass) const;

@ -69,7 +69,7 @@ CSceneClassUnknownDesc::CSceneClassUnknownDesc(const NLMISC::CClassId classId, c
}
CSceneClass *CSceneClassUnknownDesc::create() const
CSceneClass *CSceneClassUnknownDesc::create(CScene *scene) const
{
nlassert(false);
}

@ -68,7 +68,7 @@ class CSceneClassUnknownDesc : public ISceneClassDesc
{
public:
CSceneClassUnknownDesc(const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription);
virtual CSceneClass *create() const;
virtual CSceneClass *create(CScene *scene) const;
virtual void destroy(CSceneClass *sc) const;
virtual const ucchar *displayName() const;
virtual const char *internalName() const;
@ -96,7 +96,7 @@ template <typename TSuperClass>
class CSceneClassUnknown : public TSuperClass
{
public:
CSceneClassUnknown(const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription) : m_Desc(classId, superClassId, displayName, internalName, dllFilename, dllDescription) { }
CSceneClassUnknown(CScene *scene, const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription) : TSuperClass(scene), m_Desc(classId, superClassId, displayName, internalName, dllFilename, dllDescription) { }
virtual ~CSceneClassUnknown() { }
// inherited

@ -49,7 +49,7 @@ class ISuperClassDesc
{
public:
/// Create an unknown class that inherits from this superclass
virtual CSceneClass *createUnknown(const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const = 0;
virtual CSceneClass *createUnknown(CScene *scene, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const = 0;
/// Get an internal name associated with unknown classes of this superclass
virtual const char *internalNameUnknown() const = 0;
/// Gets the associated super class id, may be different from classDesc()->superClassId() for non-implemented superclasses
@ -70,7 +70,7 @@ class CSuperClassDesc : public ISuperClassDesc
{
public:
CSuperClassDesc(const ISceneClassDesc *classDesc) : m_ClassDesc(classDesc) { }
virtual CSceneClass *createUnknown(const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast<CSceneClass *>(new CSceneClassUnknown<T>(classId, m_ClassDesc->superClassId(), displayName,internalNameUnknown(), dllFilename, dllDescription)); }
virtual CSceneClass *createUnknown(CScene *scene, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast<CSceneClass *>(new CSceneClassUnknown<T>(scene, classId, m_ClassDesc->superClassId(), displayName,internalNameUnknown(), dllFilename, dllDescription)); }
virtual const char *internalNameUnknown() const { return T::InternalNameUnknown; }
virtual TSClassId superClassId() const { return m_ClassDesc->superClassId(); }
virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; }
@ -89,7 +89,7 @@ class CSuperClassDescUnknown : public ISuperClassDesc
{
public:
CSuperClassDescUnknown(const ISceneClassDesc *classDesc, const char *internalNameUnknown) : m_ClassDesc(classDesc), m_InternalNameUnknown(internalNameUnknown) { }
virtual CSceneClass *createUnknown(const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast<CSceneClass *>(new CSceneClassUnknown<T>(classId, SuperClassId, displayName,internalNameUnknown(), dllFilename, dllDescription)); }
virtual CSceneClass *createUnknown(CScene *scene, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast<CSceneClass *>(new CSceneClassUnknown<T>(scene, classId, SuperClassId, displayName,internalNameUnknown(), dllFilename, dllDescription)); }
virtual const char *internalNameUnknown() const { return m_InternalNameUnknown; }
virtual TSClassId superClassId() const { return SuperClassId; }
virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; }

@ -31,9 +31,9 @@
#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 = "/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/test2008.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/teapot_test_scene.max";
static const char *streamname = "Scene";

Loading…
Cancel
Save