From e9a179b203ceb7b50e1a96c7f727988b9895560a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 22 Aug 2012 13:03:17 +0200 Subject: [PATCH] Added: #1440 Initial class descriptions --HG-- branch : build_pipeline_v3 --- .../tools/pipeline/max/builtin/animatable.cpp | 44 +++++++++++++++++++ .../tools/pipeline/max/builtin/animatable.h | 22 ++++++++++ .../tools/pipeline/max/builtin/builtin.cpp | 6 +++ code/nel/tools/pipeline/max/builtin/builtin.h | 4 +- code/nel/tools/pipeline/max/scene.cpp | 3 +- code/nel/tools/pipeline/max/scene_class.h | 13 ++++-- .../pipeline/max/scene_class_unknown.cpp | 7 ++- .../tools/pipeline/max/scene_class_unknown.h | 9 ++-- 8 files changed, 93 insertions(+), 15 deletions(-) diff --git a/code/nel/tools/pipeline/max/builtin/animatable.cpp b/code/nel/tools/pipeline/max/builtin/animatable.cpp index e95223b23..21f0aa34b 100644 --- a/code/nel/tools/pipeline/max/builtin/animatable.cpp +++ b/code/nel/tools/pipeline/max/builtin/animatable.cpp @@ -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 MAX */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/max/builtin/animatable.h b/code/nel/tools/pipeline/max/builtin/animatable.h index d824ddf6f..fe588ac43 100644 --- a/code/nel/tools/pipeline/max/builtin/animatable.h +++ b/code/nel/tools/pipeline/max/builtin/animatable.h @@ -35,6 +35,7 @@ // Project includes #include "../scene_class.h" +#include "../scene_class_unknown.h" namespace PIPELINE { namespace MAX { @@ -52,8 +53,29 @@ public: 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 */ +typedef CSceneClassDesc CAnimatableClassDesc; +extern CAnimatableClassDesc AnimatableClassDesc; +typedef CSuperClassDesc > CAnimatableSuperClassDesc; +extern CAnimatableSuperClassDesc AnimatableSuperClassDesc; + } /* namespace BUILTIN */ } /* namespace MAX */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/max/builtin/builtin.cpp b/code/nel/tools/pipeline/max/builtin/builtin.cpp index 214c03d12..45f71b5aa 100644 --- a/code/nel/tools/pipeline/max/builtin/builtin.cpp +++ b/code/nel/tools/pipeline/max/builtin/builtin.cpp @@ -34,6 +34,10 @@ // #include // Project includes +#include "../scene_class_registry.h" +#include "../animatable.h" +#include "../reference_maker.h" +#include "../reference_target.h" // using namespace std; // using namespace NLMISC; @@ -52,6 +56,8 @@ CBuiltin::~CBuiltin() } +CBuiltin::registerClasses( + } /* namespace BUILTIN */ } /* namespace MAX */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/max/builtin/builtin.h b/code/nel/tools/pipeline/max/builtin/builtin.h index 7be92195b..8a65a223a 100644 --- a/code/nel/tools/pipeline/max/builtin/builtin.h +++ b/code/nel/tools/pipeline/max/builtin/builtin.h @@ -34,10 +34,12 @@ // NeL includes // Project includes -#include "../scene_class_registry.h" namespace PIPELINE { namespace MAX { + +class CSceneClassRegistry; + namespace BUILTIN { /** diff --git a/code/nel/tools/pipeline/max/scene.cpp b/code/nel/tools/pipeline/max/scene.cpp index 6339b4cab..4814fc2ac 100644 --- a/code/nel/tools/pipeline/max/scene.cpp +++ b/code/nel/tools/pipeline/max/scene.cpp @@ -178,8 +178,9 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container) else { // 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()); - return static_cast(new CSceneClassUnknown(dllEntry, classEntry)); + return static_cast(new CSceneClassUnknown(classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), "SceneClassUnknown", dllEntry->dllFilename(), dllEntry->dllDescription())); } } diff --git a/code/nel/tools/pipeline/max/scene_class.h b/code/nel/tools/pipeline/max/scene_class.h index 7c2d5cc7c..77146735f 100644 --- a/code/nel/tools/pipeline/max/scene_class.h +++ b/code/nel/tools/pipeline/max/scene_class.h @@ -75,6 +75,12 @@ public: 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 //@{ static const ucchar *DisplayName; @@ -83,10 +89,8 @@ public: 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 virtual const ISceneClassDesc *classDesc(); /// Create a readable representation of this class @@ -187,8 +191,9 @@ public: template 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(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(new TUnknown(classId, m_ClassDesc->superClassId(), displayName,internalNameUnknown(), dllFilename, dllDescription)); } virtual const char *internalNameUnknown() const { return T::InternalNameUnknown; } virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; } private: diff --git a/code/nel/tools/pipeline/max/scene_class_unknown.cpp b/code/nel/tools/pipeline/max/scene_class_unknown.cpp index 94d6f1962..048b5cc7f 100644 --- a/code/nel/tools/pipeline/max/scene_class_unknown.cpp +++ b/code/nel/tools/pipeline/max/scene_class_unknown.cpp @@ -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 { - // TODO: Get by SuperClassId, make like BlahUnknown - return "SceneClassUnknown"; + return m_InternalName.c_str(); } NLMISC::CClassId CSceneClassUnknownDesc::classId() const diff --git a/code/nel/tools/pipeline/max/scene_class_unknown.h b/code/nel/tools/pipeline/max/scene_class_unknown.h index 925a54c71..c27375ed0 100644 --- a/code/nel/tools/pipeline/max/scene_class_unknown.h +++ b/code/nel/tools/pipeline/max/scene_class_unknown.h @@ -35,8 +35,6 @@ // Project includes #include "scene_class.h" -#include "dll_directory.h" -#include "class_directory_3.h" namespace PIPELINE { namespace MAX { @@ -50,7 +48,7 @@ namespace MAX { class CSceneClassUnknownDllPluginDesc : public IDllPluginDescInternal { public: - CSceneClassUnknownDllPluginDesc(const CDllEntry *dllEntry); + CSceneClassUnknownDllPluginDesc(const ucstring &dllFilename, const ucstring &dllDescription); virtual const ucchar *displayName() const; virtual const ucchar *internalName() const; @@ -69,7 +67,7 @@ private: class CSceneClassUnknownDesc : public ISceneClassDesc { 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 void destroy(CSceneClass *sc) const; virtual const ucchar *displayName() const; @@ -80,6 +78,7 @@ public: private: ucstring m_DisplayName; + std::string m_InternalName; NLMISC::CClassId m_ClassId; TSClassId m_SuperClassId; CSceneClassUnknownDllPluginDesc m_DllPluginDesc; @@ -97,7 +96,7 @@ template class CSceneClassUnknown : public TSuperClass { 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() { } // inherited