From 76b33139e21859092b57d3c582be9a722c51cf8c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 24 Aug 2012 14:55:19 +0200 Subject: [PATCH] Added: #1440 Parse scene references --HG-- branch : build_pipeline_v3 --- .../tools/pipeline/max/builtin/scene_impl.cpp | 95 ++++++++++++++++++- .../tools/pipeline/max/builtin/scene_impl.h | 19 ++++ 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/code/nel/tools/pipeline/max/builtin/scene_impl.cpp b/code/nel/tools/pipeline/max/builtin/scene_impl.cpp index 8efa76247..75717d8a3 100644 --- a/code/nel/tools/pipeline/max/builtin/scene_impl.cpp +++ b/code/nel/tools/pipeline/max/builtin/scene_impl.cpp @@ -58,9 +58,21 @@ const NLMISC::CClassId CSceneImpl::ClassId = NLMISC::CClassId(0x00002222, 0x0000 const TSClassId CSceneImpl::SuperClassId = CReferenceMaker::SuperClassId; const CSceneImplClassDesc SceneImplClassDesc(&DllPluginDescBuiltin); -void CSceneImpl::parse(uint16 version, TParseLevel level) +void CSceneImpl::parse(uint16 version_, TParseLevel level) { - CReferenceMaker::parse(version, level); + CReferenceMaker::parse(version_, level); + nlassert(m_MaterialEditor); + nlassert(m_MtlBaseLib); + nlassert(m_Sound); + nlassert(m_RootNode); + nlassert(m_RenderEnvironment); + nlassert(m_NamedSelSetList); + nlassert(m_TVNode); + nlassert(m_GridReference); + nlassert(m_RenderEffects); + nlassert(m_ShadowMap); + nlassert(m_LayerManager); + if (version() > Version3) nlassert(m_TrackSetList); } void CSceneImpl::clean() @@ -99,6 +111,85 @@ void CSceneImpl::toStringLocal(std::ostream &ostream, const std::string &pad) co CReferenceMaker::toStringLocal(ostream, pad); } +CReferenceMaker *CSceneImpl::getReference(uint index) const +{ + switch (index) + { + case 0: + return m_MaterialEditor; + case 1: + return m_MtlBaseLib; + case 2: + return m_Sound; + case 3: + return m_RootNode; + case 4: + return m_RenderEnvironment; + case 5: + return m_NamedSelSetList; + case 6: + return m_TVNode; + case 7: + return m_GridReference; + case 8: + return m_RenderEffects; + case 9: + return m_ShadowMap; + case 10: + return m_LayerManager; + case 11: + return m_TrackSetList; + } +} + +void CSceneImpl::setReference(uint index, CReferenceMaker *reference) +{ + switch (index) + { + case 0: + m_MaterialEditor = reference; + break; + case 1: + m_MtlBaseLib = reference; + break; + case 2: + m_Sound = reference; + break; + case 3: + m_RootNode = reference; + break; + case 4: + m_RenderEnvironment = reference; + break; + case 5: + m_NamedSelSetList = reference; + break; + case 6: + m_TVNode = reference; + break; + case 7: + m_GridReference = reference; + break; + case 8: + m_RenderEffects = reference; + break; + case 9: + m_ShadowMap = reference; + break; + case 10: + m_LayerManager = reference; + break; + case 11: + m_TrackSetList = reference; + break; + } +} + +uint CSceneImpl::nbReferences() const +{ + return m_TrackSetList ? 12 : 11; +} + IStorageObject *CSceneImpl::createChunkById(uint16 id, bool container) { return CReferenceMaker::createChunkById(id, container); diff --git a/code/nel/tools/pipeline/max/builtin/scene_impl.h b/code/nel/tools/pipeline/max/builtin/scene_impl.h index fd1450f91..c0f2192f5 100644 --- a/code/nel/tools/pipeline/max/builtin/scene_impl.h +++ b/code/nel/tools/pipeline/max/builtin/scene_impl.h @@ -68,10 +68,29 @@ public: virtual const ISceneClassDesc *classDesc() const; virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const; + // reference maker + virtual CReferenceMaker *getReference(uint index) const; + virtual void setReference(uint index, CReferenceMaker *reference); + virtual uint nbReferences() const; + protected: // inherited virtual IStorageObject *createChunkById(uint16 id, bool container); +private: + NLMISC::CRefPtr m_MaterialEditor; + NLMISC::CRefPtr m_MtlBaseLib; + NLMISC::CRefPtr m_Sound; + NLMISC::CRefPtr m_RootNode; + NLMISC::CRefPtr m_RenderEnvironment; + NLMISC::CRefPtr m_NamedSelSetList; + NLMISC::CRefPtr m_TVNode; + NLMISC::CRefPtr m_GridReference; + NLMISC::CRefPtr m_RenderEffects; + NLMISC::CRefPtr m_ShadowMap; + NLMISC::CRefPtr m_LayerManager; + NLMISC::CRefPtr m_TrackSetList; // Does not exist in R3 + }; /* class CSceneImpl */ typedef CSceneClassDesc CSceneImplClassDesc;