Added: #1440 Dummy descriptions for encountered unimplemented superclasses

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent e9fcadb737
commit bf38e47579

@ -46,6 +46,50 @@ namespace PIPELINE {
namespace MAX {
namespace BUILTIN {
namespace {
// 0x9003 bezier float control, subclass under control; control is under reftarget
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009003> CControlFloatSuperClassDesc;
const CControlFloatSuperClassDesc ControlFloatSuperClassDesc(&ReferenceTargetClassDesc);
// 0x8 param block, under reftarget directly
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000008> CParamBlockSuperClassDesc;
const CParamBlockSuperClassDesc ParamBlockSuperClassDesc(&ReferenceTargetClassDesc);
// 0xc20 uv gen, sub of mtlbase
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c20> CUVGenSuperClassDesc;
const CUVGenSuperClassDesc UVGenSuperClassDesc(&ReferenceTargetClassDesc);
// 0x82 param block 2, under reftarget directly
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000082> CParamBlock2SuperClassDesc;
const CParamBlock2SuperClassDesc ParamBlock2SuperClassDesc(&ReferenceTargetClassDesc);
// 0xc40 output, textureoutput???, under mtlbase
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c40> CTextureOutputSuperClassDesc;
const CTextureOutputSuperClassDesc TextureOutputSuperClassDesc(&ReferenceTargetClassDesc);
// 0xc10 texmap, under mtlbase
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c10> CTexmapSuperClassDesc;
const CTexmapSuperClassDesc TexmapSuperClassDesc(&ReferenceTargetClassDesc);
// 0x1080 texmap_container, 'Texmaps' under reftarget directly
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001080> CTexmapContainerSuperClassDesc;
const CTexmapContainerSuperClassDesc TexmapContainerSuperClassDesc(&ReferenceTargetClassDesc);
// 0x10b0, shader, under baseshader, under special_Fx
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010b0> CShaderSuperClassDesc;
const CShaderSuperClassDesc ShaderSuperClassDesc(&ReferenceTargetClassDesc);
// 0x1110, sampler, under special_fx
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001110> CSamplerSuperClassDesc;
const CSamplerSuperClassDesc SamplerSuperClassDesc(&ReferenceTargetClassDesc);
// 0xc00, mtl 'materials', under mtlbase
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c00> 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 */

@ -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<IStorageObject *>(sceneClass);

@ -29,6 +29,7 @@
#include "scene_class_registry.h"
// STL includes
#include <iostream>
// NeL includes
// #include <nel/misc/debug.h>
@ -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

@ -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;

@ -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<CSceneClass *>(new CSceneClassUnknown<T>(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 <typename T, TSClassId superClassId>
template <typename T, TSClassId SuperClassId>
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<CSceneClass *>(new CSceneClassUnknown<T>(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<CSceneClass *>(new CSceneClassUnknown<T>(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;

Loading…
Cancel
Save