From 543f729d428540555af55503a41d868afc5f6a4a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 22 Aug 2012 18:30:40 +0200 Subject: [PATCH] Added: #1440 More superclass dummies --HG-- branch : build_pipeline_v3 --- .../tools/pipeline/max/builtin/animatable.cpp | 2 +- .../tools/pipeline/max/builtin/builtin.cpp | 48 +++++++++++++++++++ .../pipeline/max/builtin/reference_maker.cpp | 2 +- .../pipeline/max/builtin/reference_target.cpp | 2 +- .../pipeline/max/builtin/reference_target.h | 12 ++++- code/nel/tools/pipeline/max/scene_class.cpp | 26 +++++++++- code/nel/tools/pipeline/max_dump/main.cpp | 4 ++ 7 files changed, 90 insertions(+), 6 deletions(-) diff --git a/code/nel/tools/pipeline/max/builtin/animatable.cpp b/code/nel/tools/pipeline/max/builtin/animatable.cpp index e82a18920..c5076ce99 100644 --- a/code/nel/tools/pipeline/max/builtin/animatable.cpp +++ b/code/nel/tools/pipeline/max/builtin/animatable.cpp @@ -72,7 +72,7 @@ void CAnimatable::clean() void CAnimatable::build(uint16 version) { - CSceneClass:build(version); + CSceneClass::build(version); } void CAnimatable::disown() diff --git a/code/nel/tools/pipeline/max/builtin/builtin.cpp b/code/nel/tools/pipeline/max/builtin/builtin.cpp index 5cadaf784..26f94c399 100644 --- a/code/nel/tools/pipeline/max/builtin/builtin.cpp +++ b/code/nel/tools/pipeline/max/builtin/builtin.cpp @@ -48,6 +48,10 @@ namespace BUILTIN { namespace { +// 0x0 - invalid, default to reftarget +typedef CSuperClassDescUnknown CNullSuperClassDesc; +const CNullSuperClassDesc NullSuperClassDesc(&ReferenceTargetClassDesc); + // 0x9003 bezier float control, subclass under control???; control is under reftarget typedef CSuperClassDescUnknown CControlFloatSuperClassDesc; const CControlFloatSuperClassDesc ControlFloatSuperClassDesc(&ReferenceTargetClassDesc); @@ -136,6 +140,38 @@ const CObjectSuperClassDesc ObjectSuperClassDesc(&ReferenceTargetClassDesc); typedef CSuperClassDescUnknown CHelperObjectSuperClassDesc; const CHelperObjectSuperClassDesc HelperObjectSuperClassDesc(&ReferenceTargetClassDesc); +// 0x10a0 filterkernel, under specialfx (example: area filter) +typedef CSuperClassDescUnknown CFilterKernelSuperClassDesc; +const CFilterKernelSuperClassDesc FilterKernelSuperClassDesc(&ReferenceTargetClassDesc); + +// 0xf00 - renderer ,direct sub of reftarget +typedef CSuperClassDescUnknown CRendererSuperClassDesc; +const CRendererSuperClassDesc RendererSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x9005 - control point3 (also color), under control??? +typedef CSuperClassDescUnknown CControlPoint3SuperClassDesc; +const CControlPoint3SuperClassDesc ControlPoint3SuperClassDesc(&ReferenceTargetClassDesc); + +// 0x1010 - atmospheric, under special effects +typedef CSuperClassDescUnknown CAtmosphericSuperClassDesc; +const CAtmosphericSuperClassDesc AtmosphericSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x9011 - control master block 'block control', under control??? +typedef CSuperClassDescUnknown CControlMasterBlockSuperClassDesc; +const CControlMasterBlockSuperClassDesc ControlMasterBlockSuperClassDesc(&ReferenceTargetClassDesc); + +// 0xfffffe00 - grid reference, not sure where, probably directly under reftarget +typedef CSuperClassDescUnknown CGridReferenceSuperClassDesc; +const CGridReferenceSuperClassDesc GridReferenceSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x1090 - render effect, possibly under special fx +typedef CSuperClassDescUnknown CRenderEffectSuperClassDesc; +const CRenderEffectSuperClassDesc RenderEffectSuperClassDesc(&ReferenceTargetClassDesc); + +// 0x10d0 - shadow type, directly under ref target +typedef CSuperClassDescUnknown CShadowTypeSuperClassDesc; +const CShadowTypeSuperClassDesc ShadowTypeSuperClassDesc(&ReferenceTargetClassDesc); + } /* anonymous namespace */ CBuiltin::CBuiltin() @@ -151,6 +187,7 @@ CBuiltin::~CBuiltin() void CBuiltin::registerClasses(CSceneClassRegistry *registry) { + // available registry->add(&AnimatableClassDesc); registry->add(&AnimatableSuperClassDesc); registry->add(&ReferenceMakerClassDesc); @@ -158,6 +195,9 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry) registry->add(&ReferenceTargetClassDesc); registry->add(&ReferenceTargetSuperClassDesc); + // invalid + registry->add(&NullSuperClassDesc); + // unimplemented registry->add(&ControlFloatSuperClassDesc); registry->add(&ParamBlockSuperClassDesc); @@ -181,6 +221,14 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry) registry->add(&LayerSuperClassDesc); registry->add(&ObjectSuperClassDesc); registry->add(&HelperObjectSuperClassDesc); + registry->add(&FilterKernelSuperClassDesc); + registry->add(&RendererSuperClassDesc); + registry->add(&ControlPoint3SuperClassDesc); + registry->add(&AtmosphericSuperClassDesc); + registry->add(&ControlMasterBlockSuperClassDesc); + registry->add(&GridReferenceSuperClassDesc); + registry->add(&RenderEffectSuperClassDesc); + registry->add(&ShadowTypeSuperClassDesc); } } /* namespace BUILTIN */ diff --git a/code/nel/tools/pipeline/max/builtin/reference_maker.cpp b/code/nel/tools/pipeline/max/builtin/reference_maker.cpp index b7c1abebd..6853f7f26 100644 --- a/code/nel/tools/pipeline/max/builtin/reference_maker.cpp +++ b/code/nel/tools/pipeline/max/builtin/reference_maker.cpp @@ -72,7 +72,7 @@ void CReferenceMaker::clean() void CReferenceMaker::build(uint16 version) { - CAnimatable:build(version); + CAnimatable::build(version); } void CReferenceMaker::disown() diff --git a/code/nel/tools/pipeline/max/builtin/reference_target.cpp b/code/nel/tools/pipeline/max/builtin/reference_target.cpp index 804db210e..85ef3f7c2 100644 --- a/code/nel/tools/pipeline/max/builtin/reference_target.cpp +++ b/code/nel/tools/pipeline/max/builtin/reference_target.cpp @@ -72,7 +72,7 @@ void CReferenceTarget::clean() void CReferenceTarget::build(uint16 version) { - CReferenceMaker:build(version); + CReferenceMaker::build(version); } void CReferenceTarget::disown() diff --git a/code/nel/tools/pipeline/max/builtin/reference_target.h b/code/nel/tools/pipeline/max/builtin/reference_target.h index c955c9833..70cf481d4 100644 --- a/code/nel/tools/pipeline/max/builtin/reference_target.h +++ b/code/nel/tools/pipeline/max/builtin/reference_target.h @@ -32,6 +32,7 @@ // STL includes // NeL includes +#include // Project includes #include "reference_maker.h" @@ -44,9 +45,16 @@ namespace BUILTIN { * \brief CReferenceTarget * \date 2012-08-22 08:53GMT * \author Jan Boon (Kaetemi) - * This is a dummy class + * This class counts the reference. It is recommended to use CRefPtr + * to refer to any pointers to classes inherited from this class. + * NOTE: CRefPtr does not delete the class when references go to + * zero. When you remove a class from the scene, the class will be + * deleted if the reference count is zero. Otherwise, you are + * responsible for deleting it (for example, if you keep the class + * backed up in an undo stack for undeletion). You may use CSmartPtr + * when the class is no longer owned by the scene container. */ -class CReferenceTarget : public CReferenceMaker +class CReferenceTarget : public CReferenceMaker, public NLMISC::CRefCount { public: CReferenceTarget(); diff --git a/code/nel/tools/pipeline/max/scene_class.cpp b/code/nel/tools/pipeline/max/scene_class.cpp index a113f3d15..3689125c5 100644 --- a/code/nel/tools/pipeline/max/scene_class.cpp +++ b/code/nel/tools/pipeline/max/scene_class.cpp @@ -209,7 +209,7 @@ void CSceneClass::toStringLocal(std::ostream &ostream, const std::string &pad) c std::stringstream ss; ss << std::hex << std::setfill('0'); ss << std::setw(4) << it->first; - ostream << "\n" << pad << i << " 0x" << ss.str() << ": "; + ostream << "\n" << pad << "Orphan[" << i << "] 0x" << ss.str() << ": "; it->second->toString(ostream, padpad); ++i; } @@ -217,9 +217,33 @@ void CSceneClass::toStringLocal(std::ostream &ostream, const std::string &pad) c IStorageObject *CSceneClass::getChunk(uint16 id) { + if (m_OrphanedChunks.begin()->first == id) + { + return m_OrphanedChunks.begin()->second; + m_OrphanedChunks.pop_front(); + } + else + { + for (TStorageObjectContainer::iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it) + { + if (it->first == id) + { + nlwarning("Try to get chunk with 0x%x id, but found 0x%x instead. Found the correct chunk at a different position. Unknown chunks, or chunks out of order", (uint32)id, (uint32)m_OrphanedChunks.begin()->first); + IStorageObject *result = it->second; + m_OrphanedChunks.erase(it); + return result; + } + } + } + nldebug("Chunk 0x%x not found, this is allowed, returning NULL", (uint32)id); return NULL; } +void CSceneClass::putChunk(uint16 id, IStorageObject *storageObject) +{ + m_OrphanedChunks.insert(m_PutChunkInsert, TStorageObjectWithId(id, storageObject)); +} + //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// diff --git a/code/nel/tools/pipeline/max_dump/main.cpp b/code/nel/tools/pipeline/max_dump/main.cpp index d1e147b58..3fcc02e35 100644 --- a/code/nel/tools/pipeline/max_dump/main.cpp +++ b/code/nel/tools/pipeline/max_dump/main.cpp @@ -160,11 +160,15 @@ int main(int argc, char **argv) | PIPELINE::MAX::PARSE_BUILTIN)); // parse the structure to readable data scene.clean(); // cleanup unused file structure // TEST -> + nldebug("BUILD"); scene.build(PIPELINE::MAX::VersionUnknown); + nldebug("DISOWN"); scene.disown(); + nldebug("PARSE"); scene.parse(PIPELINE::MAX::VersionUnknown, (PIPELINE::MAX::TParseLevel)( PIPELINE::MAX::PARSE_INTERNAL | PIPELINE::MAX::PARSE_BUILTIN)); // parse the structure to readable data + nldebug("CLEAN"); scene.clean(); // cleanup unused file structure // <- TEST scene.toString(std::cout);