From ab57e977822670718ef8de26ca47879eb44a3144 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 20 Aug 2012 14:17:04 +0200 Subject: [PATCH] Added: #1440 Functionality between ClassDirectory3 and DllDirectory --HG-- branch : build_pipeline_v3 --- code/nel/tools/pipeline/max/class_directory_3.cpp | 9 +++++---- code/nel/tools/pipeline/max/class_directory_3.h | 2 +- code/nel/tools/pipeline/max/dll_directory.cpp | 4 ++-- code/nel/tools/pipeline/max/dll_directory.h | 4 ++-- code/nel/tools/pipeline/max/scene_class.cpp | 6 +++--- code/nel/tools/pipeline/max/scene_class.h | 6 ++++++ 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/code/nel/tools/pipeline/max/class_directory_3.cpp b/code/nel/tools/pipeline/max/class_directory_3.cpp index 2cae1278a..e64ea3550 100644 --- a/code/nel/tools/pipeline/max/class_directory_3.cpp +++ b/code/nel/tools/pipeline/max/class_directory_3.cpp @@ -35,8 +35,9 @@ // #include // Project includes +#include "dll_directory.h" -using namespace std; +// using namespace std; // using namespace NLMISC; namespace PIPELINE { @@ -264,7 +265,7 @@ uint16 CClassDirectory3::getOrCreateIndex(const ISceneClassDesc *sceneClassDesc) return it->second; // Create new entry - CClassEntry *classEntry = new CClassEntry(sceneClassDesc); + CClassEntry *classEntry = new CClassEntry(m_DllDirectory, sceneClassDesc); uint16 index = m_Entries.size(); m_ClassIdToIndex[classEntry->classId()] = index; m_Entries.push_back(classEntry); @@ -299,11 +300,11 @@ CClassEntry::CClassEntry() : m_Header(NULL), m_Name(NULL) } -CClassEntry::CClassEntry(const ISceneClassDesc *sceneClassDesc) : m_Header(new CClassEntryHeader()), m_Name(new CStorageValue()) +CClassEntry::CClassEntry(CDllDirectory *dllDirectory, const ISceneClassDesc *sceneClassDesc) : m_Header(new CClassEntryHeader()), m_Name(new CStorageValue()) { Chunks.push_back(TStorageObjectWithId(0x2060, m_Header)); Chunks.push_back(TStorageObjectWithId(0x2042, m_Name)); - m_Header->DllIndex = -9; // Invalid temporary value + m_Header->DllIndex = dllDirectory->getOrCreateIndex(sceneClassDesc->dllPluginDesc()); m_Header->ClassId = sceneClassDesc->classId(); m_Header->SuperClassId = sceneClassDesc->superClassId(); m_Name->Value = sceneClassDesc->displayName(); diff --git a/code/nel/tools/pipeline/max/class_directory_3.h b/code/nel/tools/pipeline/max/class_directory_3.h index d3f8dbd76..f6e3e9b15 100644 --- a/code/nel/tools/pipeline/max/class_directory_3.h +++ b/code/nel/tools/pipeline/max/class_directory_3.h @@ -121,7 +121,7 @@ class CClassEntry : public CStorageContainer { public: CClassEntry(); - CClassEntry(const ISceneClassDesc *sceneClassDesc); + CClassEntry(CDllDirectory *dllDirectory, const ISceneClassDesc *sceneClassDesc); virtual ~CClassEntry(); // inherited diff --git a/code/nel/tools/pipeline/max/dll_directory.cpp b/code/nel/tools/pipeline/max/dll_directory.cpp index 01a565e30..c38232c5e 100644 --- a/code/nel/tools/pipeline/max/dll_directory.cpp +++ b/code/nel/tools/pipeline/max/dll_directory.cpp @@ -253,7 +253,7 @@ void CDllDirectory::reset() } // Parallel to CClassDirectory3 -uint16 CDllDirectory::getOrCreateIndex(const IDllPluginDesc *dllPluginDesc) +uint16 CDllDirectory::getOrCreateIndex(const IDllPluginDescInternal *dllPluginDesc) { nlassert(!ChunksOwnsPointers); std::map::iterator it = m_InternalNameToIndex.find(NLMISC::toLower(ucstring(dllPluginDesc->internalName()))); @@ -303,7 +303,7 @@ CDllEntry::CDllEntry() : m_DllDescription(NULL), m_DllFilename(NULL) } -CDllEntry::CDllEntry(const IDllPluginDesc *dllPluginDesc) : m_DllDescription(new CStorageValue()), m_DllFilename(new CStorageValue()) +CDllEntry::CDllEntry(const IDllPluginDescInternal *dllPluginDesc) : m_DllDescription(new CStorageValue()), m_DllFilename(new CStorageValue()) { Chunks.push_back(TStorageObjectWithId(0x2039, m_DllDescription)); Chunks.push_back(TStorageObjectWithId(0x2037, m_DllFilename)); diff --git a/code/nel/tools/pipeline/max/dll_directory.h b/code/nel/tools/pipeline/max/dll_directory.h index 0de5312c2..728fbdce5 100644 --- a/code/nel/tools/pipeline/max/dll_directory.h +++ b/code/nel/tools/pipeline/max/dll_directory.h @@ -69,7 +69,7 @@ public: // Reset the dll directory, all dll entry pointers become invalid, use internal name and dll plugin registry void reset(); // Get or create the chunk index for a dll by dll plugin description - uint16 getOrCreateIndex(const IDllPluginDesc *dllPluginDesc); + uint16 getOrCreateIndex(const IDllPluginDescInternal *dllPluginDesc); protected: virtual IStorageObject *createChunkById(uint16 id, bool container); @@ -91,7 +91,7 @@ class CDllEntry : public CStorageContainer { public: CDllEntry(); - CDllEntry(const IDllPluginDesc *dllPluginDesc); + CDllEntry(const IDllPluginDescInternal *dllPluginDesc); virtual ~CDllEntry(); // inherited diff --git a/code/nel/tools/pipeline/max/scene_class.cpp b/code/nel/tools/pipeline/max/scene_class.cpp index 6d4acce01..6a0ec6330 100644 --- a/code/nel/tools/pipeline/max/scene_class.cpp +++ b/code/nel/tools/pipeline/max/scene_class.cpp @@ -92,11 +92,11 @@ IStorageObject *CSceneClass::createChunkById(uint16 id, bool container) const ucchar *CSceneClass::DisplayName = ucstring("Scene Class").c_str(); const char *CSceneClass::InternalName = "SceneClass"; -const NLMISC::CClassId CSceneClass::ClassId = NLMISC::CClassId::Null; -const TSClassId CSceneClass::SuperClassId = 0x0000; +const NLMISC::CClassId CSceneClass::ClassId = NLMISC::CClassId::Null; // This class is invalid +const TSClassId CSceneClass::SuperClassId = 0x0000; // This class is invalid namespace { -static const CSceneClassDesc SceneClassDesc; +static const CSceneClassDesc SceneClassDesc(static_cast(&DllPluginDescBuiltin)); } /* anonymous namespace */ const ISceneClassDesc *CSceneClass::getClassDesc() diff --git a/code/nel/tools/pipeline/max/scene_class.h b/code/nel/tools/pipeline/max/scene_class.h index 43e4431d2..f9fb62673 100644 --- a/code/nel/tools/pipeline/max/scene_class.h +++ b/code/nel/tools/pipeline/max/scene_class.h @@ -37,6 +37,7 @@ // Project includes #include "storage_object.h" #include "storage_value.h" +#include "dll_plugin_desc.h" namespace PIPELINE { namespace MAX { @@ -95,6 +96,7 @@ public: virtual const char *internalName() const = 0; virtual NLMISC::CClassId classId() const = 0; virtual TSClassId superClassId() const = 0; + virtual const IDllPluginDescInternal *dllPluginDesc() const = 0; }; /* class ISceneClassDesc */ @@ -109,12 +111,16 @@ template class CSceneClassDesc : public ISceneClassDesc { public: + CSceneClassDesc(const IDllPluginDescInternal *dllPluginDesc) : m_DllPluginDesc(dllPluginDesc) { } virtual CSceneClass *create() const { return static_cast(new T()); } virtual void destroy(CSceneClass *sc) const { delete static_cast(sc); } virtual const ucchar *displayName() const { return T::DisplayName; } virtual const char *internalName() const { return T::InternalName; } virtual NLMISC::CClassId classId() const { return T::ClassId; } virtual TSClassId superClassId() const { return T::SuperClassId; } + virtual const IDllPluginDescInternal *dllPluginDesc() const { return m_DllPluginDesc; } +private: + const IDllPluginDescInternal *m_DllPluginDesc; }; /* class CSceneClassDesc */