Added: #1440 Initial class descriptions

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 6520b793ad
commit e9a179b203

@ -52,6 +52,50 @@ CAnimatable::~CAnimatable()
} }
const ucchar *CAnimatable::DisplayName = ucstring("Animatable").c_str();
const char *CAnimatable::InternalName = "Animatable";
const char *CAnimatable::InternalNameUnknown = "AnimatableUnknown";
const NLMISC::CClassId CAnimatable::ClassId = NLMISC::CClassId(0x3101497b, 0x24af711b); /* Not official, please correct */
const TSClassId CAnimatable::SuperClassId = 0x77a60fbd;/* Not official, please correct */
CAnimatableClassDesc AnimatableClassDesc(&DllPluginDescBuiltin);
CAnimatableSuperClassDesc AnimatableSuperClassDesc(&AnimatableClassDesc);
void CAnimatable::parse(uint16 version, TParseLevel level)
{
}
void CAnimatable::clean()
{
}
void CAnimatable::build(uint16 version)
{
}
void CAnimatable::disown()
{
}
void CAnimatable::init()
{
}
// inherited
const ISceneClassDesc *CAnimatable::classDesc()
{
return &AnimatableClassDesc;
}
void CAnimatable::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
}
} /* namespace BUILTIN */ } /* namespace BUILTIN */
} /* namespace MAX */ } /* namespace MAX */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -35,6 +35,7 @@
// Project includes // Project includes
#include "../scene_class.h" #include "../scene_class.h"
#include "../scene_class_unknown.h"
namespace PIPELINE { namespace PIPELINE {
namespace MAX { namespace MAX {
@ -52,8 +53,29 @@ public:
CAnimatable(); CAnimatable();
virtual ~CAnimatable(); virtual ~CAnimatable();
// class desc
static const ucchar *DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
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 const ISceneClassDesc *classDesc();
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CAnimatable */ }; /* class CAnimatable */
typedef CSceneClassDesc<CAnimatable> CAnimatableClassDesc;
extern CAnimatableClassDesc AnimatableClassDesc;
typedef CSuperClassDesc<CAnimatable, CSceneClassUnknown<CAnimatable> > CAnimatableSuperClassDesc;
extern CAnimatableSuperClassDesc AnimatableSuperClassDesc;
} /* namespace BUILTIN */ } /* namespace BUILTIN */
} /* namespace MAX */ } /* namespace MAX */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -34,6 +34,10 @@
// #include <nel/misc/debug.h> // #include <nel/misc/debug.h>
// Project includes // Project includes
#include "../scene_class_registry.h"
#include "../animatable.h"
#include "../reference_maker.h"
#include "../reference_target.h"
// using namespace std; // using namespace std;
// using namespace NLMISC; // using namespace NLMISC;
@ -52,6 +56,8 @@ CBuiltin::~CBuiltin()
} }
CBuiltin::registerClasses(
} /* namespace BUILTIN */ } /* namespace BUILTIN */
} /* namespace MAX */ } /* namespace MAX */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -34,10 +34,12 @@
// NeL includes // NeL includes
// Project includes // Project includes
#include "../scene_class_registry.h"
namespace PIPELINE { namespace PIPELINE {
namespace MAX { namespace MAX {
class CSceneClassRegistry;
namespace BUILTIN { namespace BUILTIN {
/** /**

@ -178,8 +178,9 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
else else
{ {
// Create an unknown scene class; TODO: By TSClassId, maybe the registry should have a createUnknown(TSuperClassId) // Create an unknown scene class; TODO: By TSClassId, maybe the registry should have a createUnknown(TSuperClassId)
// const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::strin &internalName, const ucstring &dllFilename, const ucstring &dllDescription
const CDllEntry *dllEntry = m_DllDirectory->get(classEntry->dllIndex()); const CDllEntry *dllEntry = m_DllDirectory->get(classEntry->dllIndex());
return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(dllEntry, classEntry)); return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), "SceneClassUnknown", dllEntry->dllFilename(), dllEntry->dllDescription()));
} }
} }

@ -75,6 +75,12 @@ public:
virtual void disown(); virtual void disown();
//@} //@}
//! \name Virtual functionality for inheriting classes to implement
//@{
/// Initialize this class from scratch, call the parent first
virtual void init();
//@}
//! \name Static const variables for the class description //! \name Static const variables for the class description
//@{ //@{
static const ucchar *DisplayName; static const ucchar *DisplayName;
@ -83,10 +89,8 @@ public:
static const TSClassId SuperClassId; static const TSClassId SuperClassId;
//@} //@}
//! \name Virtual functionality for inheriting classes to implement //! \name More virtual functionality for inheriting classes to implement
//@{ //@{
/// Initialize this class from scratch, call the parent first
virtual void init();
/// Return the class description of the inheriting class /// Return the class description of the inheriting class
virtual const ISceneClassDesc *classDesc(); virtual const ISceneClassDesc *classDesc();
/// Create a readable representation of this class /// Create a readable representation of this class
@ -187,8 +191,9 @@ public:
template <typename T, typename TUnknown> template <typename T, typename TUnknown>
class CSuperClassDesc : public ISuperClassDesc class CSuperClassDesc : public ISuperClassDesc
{ {
public:
CSuperClassDesc(const ISceneClassDesc *classDesc) : m_ClassDesc(classDesc) { } 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 TUnknown(classId, displayName, dllFilename, dllDescription)); } virtual CSceneClass *createUnknown(const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast<CSceneClass *>(new TUnknown(classId, m_ClassDesc->superClassId(), displayName,internalNameUnknown(), dllFilename, dllDescription)); }
virtual const char *internalNameUnknown() const { return T::InternalNameUnknown; } virtual const char *internalNameUnknown() const { return T::InternalNameUnknown; }
virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; } virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; }
private: private:

@ -45,7 +45,7 @@ namespace MAX {
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
CSceneClassUnknownDllPluginDesc::CSceneClassUnknownDllPluginDesc(const CDllEntry *dllEntry) : m_DisplayName(dllEntry->dllDescription()), m_InternalName(dllEntry->dllFilename()) CSceneClassUnknownDllPluginDesc::CSceneClassUnknownDllPluginDesc(const ucstring &dllFilename, const ucstring &dllDescription) : m_DisplayName(dllFilename), m_InternalName(dllDescription)
{ {
} }
@ -64,7 +64,7 @@ const ucchar *CSceneClassUnknownDllPluginDesc::internalName() const
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
CSceneClassUnknownDesc::CSceneClassUnknownDesc(const CDllEntry *dllEntry, const CClassEntry *classEntry) : m_DisplayName(classEntry->displayName()), m_ClassId(classEntry->classId()), m_SuperClassId(classEntry->superClassId()), m_DllPluginDesc(dllEntry) CSceneClassUnknownDesc::CSceneClassUnknownDesc(const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription) : m_DisplayName(displayName), m_InternalName(internalName), m_ClassId(classId), m_SuperClassId(superClassId), m_DllPluginDesc(dllFilename, dllDescription)
{ {
} }
@ -86,8 +86,7 @@ const ucchar *CSceneClassUnknownDesc::displayName() const
const char *CSceneClassUnknownDesc::internalName() const const char *CSceneClassUnknownDesc::internalName() const
{ {
// TODO: Get by SuperClassId, make like BlahUnknown return m_InternalName.c_str();
return "SceneClassUnknown";
} }
NLMISC::CClassId CSceneClassUnknownDesc::classId() const NLMISC::CClassId CSceneClassUnknownDesc::classId() const

@ -35,8 +35,6 @@
// Project includes // Project includes
#include "scene_class.h" #include "scene_class.h"
#include "dll_directory.h"
#include "class_directory_3.h"
namespace PIPELINE { namespace PIPELINE {
namespace MAX { namespace MAX {
@ -50,7 +48,7 @@ namespace MAX {
class CSceneClassUnknownDllPluginDesc : public IDllPluginDescInternal class CSceneClassUnknownDllPluginDesc : public IDllPluginDescInternal
{ {
public: public:
CSceneClassUnknownDllPluginDesc(const CDllEntry *dllEntry); CSceneClassUnknownDllPluginDesc(const ucstring &dllFilename, const ucstring &dllDescription);
virtual const ucchar *displayName() const; virtual const ucchar *displayName() const;
virtual const ucchar *internalName() const; virtual const ucchar *internalName() const;
@ -69,7 +67,7 @@ private:
class CSceneClassUnknownDesc : public ISceneClassDesc class CSceneClassUnknownDesc : public ISceneClassDesc
{ {
public: public:
CSceneClassUnknownDesc(const CDllEntry *dllEntry, const CClassEntry *classEntry); 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() const;
virtual void destroy(CSceneClass *sc) const; virtual void destroy(CSceneClass *sc) const;
virtual const ucchar *displayName() const; virtual const ucchar *displayName() const;
@ -80,6 +78,7 @@ public:
private: private:
ucstring m_DisplayName; ucstring m_DisplayName;
std::string m_InternalName;
NLMISC::CClassId m_ClassId; NLMISC::CClassId m_ClassId;
TSClassId m_SuperClassId; TSClassId m_SuperClassId;
CSceneClassUnknownDllPluginDesc m_DllPluginDesc; CSceneClassUnknownDllPluginDesc m_DllPluginDesc;
@ -97,7 +96,7 @@ template <typename TSuperClass>
class CSceneClassUnknown : public TSuperClass class CSceneClassUnknown : public TSuperClass
{ {
public: public:
CSceneClassUnknown(const CDllEntry *dllEntry, const CClassEntry *classEntry) : m_Desc(dllEntry, classEntry) { } 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) { }
virtual ~CSceneClassUnknown() { } virtual ~CSceneClassUnknown() { }
// inherited // inherited

Loading…
Cancel
Save