diff --git a/code/nel/tools/pipeline/max/builtin/builtin.cpp b/code/nel/tools/pipeline/max/builtin/builtin.cpp index 2d26bd94e..b211d5fb3 100644 --- a/code/nel/tools/pipeline/max/builtin/builtin.cpp +++ b/code/nel/tools/pipeline/max/builtin/builtin.cpp @@ -46,6 +46,50 @@ namespace PIPELINE { namespace MAX { namespace BUILTIN { +namespace { + +// 0x9003 bezier float control, subclass under control; control is under reftarget +typedef CSuperClassDescUnknown CControlFloatSuperClassDesc; +const CControlFloatSuperClassDesc ControlFloatSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x8 param block, under reftarget directly +typedef CSuperClassDescUnknown CParamBlockSuperClassDesc; +const CParamBlockSuperClassDesc ParamBlockSuperClassDesc(&ReferenceTargetClassDesc); + +// 0xc20 uv gen, sub of mtlbase +typedef CSuperClassDescUnknown CUVGenSuperClassDesc; +const CUVGenSuperClassDesc UVGenSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x82 param block 2, under reftarget directly +typedef CSuperClassDescUnknown CParamBlock2SuperClassDesc; +const CParamBlock2SuperClassDesc ParamBlock2SuperClassDesc(&ReferenceTargetClassDesc); + +// 0xc40 output, textureoutput???, under mtlbase +typedef CSuperClassDescUnknown CTextureOutputSuperClassDesc; +const CTextureOutputSuperClassDesc TextureOutputSuperClassDesc(&ReferenceTargetClassDesc); + +// 0xc10 texmap, under mtlbase +typedef CSuperClassDescUnknown CTexmapSuperClassDesc; +const CTexmapSuperClassDesc TexmapSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x1080 texmap_container, 'Texmaps' under reftarget directly +typedef CSuperClassDescUnknown CTexmapContainerSuperClassDesc; +const CTexmapContainerSuperClassDesc TexmapContainerSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x10b0, shader, under baseshader, under special_Fx +typedef CSuperClassDescUnknown CShaderSuperClassDesc; +const CShaderSuperClassDesc ShaderSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x1110, sampler, under special_fx +typedef CSuperClassDescUnknown CSamplerSuperClassDesc; +const CSamplerSuperClassDesc SamplerSuperClassDesc(&ReferenceTargetClassDesc); + +// 0xc00, mtl 'materials', under mtlbase +typedef CSuperClassDescUnknown CMtlSuperClassDesc; +const CMtlSuperClassDesc MtlSuperClassDesc(&ReferenceTargetClassDesc); + +} /* anonymous namespace */ + CBuiltin::CBuiltin() { @@ -56,6 +100,7 @@ CBuiltin::~CBuiltin() } + void CBuiltin::registerClasses(CSceneClassRegistry *registry) { registry->add(&AnimatableClassDesc); @@ -64,6 +109,18 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry) registry->add(&ReferenceMakerSuperClassDesc); registry->add(&ReferenceTargetClassDesc); registry->add(&ReferenceTargetSuperClassDesc); + + // unimplemented + registry->add(&ControlFloatSuperClassDesc); + registry->add(&ParamBlockSuperClassDesc); + registry->add(&UVGenSuperClassDesc); + registry->add(&ParamBlock2SuperClassDesc); + registry->add(&TextureOutputSuperClassDesc); + registry->add(&TexmapSuperClassDesc); + registry->add(&TexmapContainerSuperClassDesc); + registry->add(&ShaderSuperClassDesc); + registry->add(&SamplerSuperClassDesc); + registry->add(&MtlSuperClassDesc); } } /* namespace BUILTIN */ diff --git a/code/nel/tools/pipeline/max/scene.cpp b/code/nel/tools/pipeline/max/scene.cpp index ea9cd12cc..87fb4f115 100644 --- a/code/nel/tools/pipeline/max/scene.cpp +++ b/code/nel/tools/pipeline/max/scene.cpp @@ -179,8 +179,7 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container) else { const CDllEntry *dllEntry = m_DllDirectory->get(classEntry->dllIndex()); - classEntry->toString(std::cout, ""); - sceneClass = m_SceneClassRegistry->createUnknown(classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), dllEntry->dllFilename(), dllEntry->dllDescription()); + sceneClass = m_SceneClassRegistry->createUnknown(classEntry->superClassId(), classEntry->classId(), classEntry->displayName(), dllEntry->dllFilename(), dllEntry->dllDescription()); if (sceneClass) { return static_cast(sceneClass); diff --git a/code/nel/tools/pipeline/max/scene_class_registry.cpp b/code/nel/tools/pipeline/max/scene_class_registry.cpp index cad1eb2f0..b45e6cb38 100644 --- a/code/nel/tools/pipeline/max/scene_class_registry.cpp +++ b/code/nel/tools/pipeline/max/scene_class_registry.cpp @@ -29,6 +29,7 @@ #include "scene_class_registry.h" // STL includes +#include // NeL includes // #include @@ -82,8 +83,9 @@ void CSceneClassRegistry::remove(const NLMISC::CClassId classId) /// Add a superclass to the registry void CSceneClassRegistry::add(const ISuperClassDesc *desc) { - if (m_SuperClassDescriptions.find(desc->classDesc()->superClassId()) != m_SuperClassDescriptions.end()) { nlerror("Already added this superclass to the registry"); return; } - m_SuperClassDescriptions[desc->classDesc()->superClassId()] = desc; + nldebug("Register superclass 0x%x", desc->superClassId()); + if (m_SuperClassDescriptions.find(desc->superClassId()) != m_SuperClassDescriptions.end()) { nlerror("Already added this superclass to the registry"); return; } + m_SuperClassDescriptions[desc->superClassId()] = desc; } /// Remove a superclass from the registry @@ -101,10 +103,10 @@ CSceneClass *CSceneClassRegistry::create(const NLMISC::CClassId classId) const } /// Create an unknown class by superclass id -CSceneClass *CSceneClassRegistry::createUnknown(const TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const +CSceneClass *CSceneClassRegistry::createUnknown(TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { - if (m_ClassDescriptions.find(classId) == m_ClassDescriptions.end()) { nlwarning("Creating superclass 0x%x (%s) that does not exist", superClassId, displayName.toUtf8().c_str()); return NULL; } - return m_SuperClassDescriptions.find(classId)->second->createUnknown(classId, displayName, dllFilename, dllDescription);; + 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); } /// Destroy a class by pointer diff --git a/code/nel/tools/pipeline/max/scene_class_registry.h b/code/nel/tools/pipeline/max/scene_class_registry.h index 3ade9fd31..1833c0723 100644 --- a/code/nel/tools/pipeline/max/scene_class_registry.h +++ b/code/nel/tools/pipeline/max/scene_class_registry.h @@ -66,7 +66,7 @@ public: CSceneClass *create(const NLMISC::CClassId classId) const; /// Create an unknown class by superclass id - CSceneClass *createUnknown(const TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const; + CSceneClass *createUnknown(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; diff --git a/code/nel/tools/pipeline/max/super_class_desc.h b/code/nel/tools/pipeline/max/super_class_desc.h index 393645f49..dda85bf02 100644 --- a/code/nel/tools/pipeline/max/super_class_desc.h +++ b/code/nel/tools/pipeline/max/super_class_desc.h @@ -52,6 +52,8 @@ public: virtual CSceneClass *createUnknown(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 + virtual TSClassId superClassId() const = 0; /// Return the class description that directly implements this superclass virtual const ISceneClassDesc *classDesc() const = 0; @@ -70,6 +72,7 @@ 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 CSceneClassUnknown(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; } private: const ISceneClassDesc *m_ClassDesc; @@ -81,13 +84,14 @@ private: * \author Jan Boon (Kaetemi) * Template for non-implemented superclass descriptions */ -template +template class CSuperClassDescUnknown : public ISuperClassDesc { public: CSuperClassDescUnknown(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 CSceneClassUnknown(classId, superClassId, displayName,internalNameUnknown(), dllFilename, dllDescription)); } + virtual CSceneClass *createUnknown(const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast(new CSceneClassUnknown(classId, SuperClassId, displayName,internalNameUnknown(), dllFilename, dllDescription)); } virtual const char *internalNameUnknown() const { return T::InternalNameUnknown; } + virtual TSClassId superClassId() const { return SuperClassId; } virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; } private: const ISceneClassDesc *m_ClassDesc;