From 9da45fc9f0eb40e91bb73caac5bad23735ac6c6a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 5 Aug 2012 20:00:19 +0200 Subject: [PATCH] Changed: #1440 Simplify reading the configuration --HG-- branch : build_pipeline_v3 --- .../plugin_library/pipeline_process.cpp | 22 ++++++++++++ .../plugin_library/pipeline_process.h | 1 + .../pipeline/plugin_nel/process_interface.cpp | 35 +------------------ .../plugin_nel/process_texture_dds.cpp | 6 ++-- 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/code/nel/tools/pipeline/plugin_library/pipeline_process.cpp b/code/nel/tools/pipeline/plugin_library/pipeline_process.cpp index 20afc9a71..58469ce65 100644 --- a/code/nel/tools/pipeline/plugin_library/pipeline_process.cpp +++ b/code/nel/tools/pipeline/plugin_library/pipeline_process.cpp @@ -30,6 +30,7 @@ // STL includes #include +#include // NeL includes #include @@ -92,6 +93,27 @@ bool IPipelineProcess::getValue(sint &result, const std::string &name) return true; } +bool IPipelineProcess::getValuesRecurse(std::vector &resultAppend, const std::string &name) +{ + std::string::size_type split = name.find("[]"); + if (split == std::string::npos) return getValues(resultAppend, name); + else + { + std::string subname = name.substr(0, split); + uint nb; + if (!getValueNb(nb, subname)) return false; + std::string begname = name.substr(0, split + 1); + std::string endname = name.substr(split + 1); + for (uint i = 0; i < nb; ++i) + { + std::stringstream ss; + ss << begname << i << endname; + if (!getValuesRecurse(resultAppend, ss.str())) return false; + } + } + return true; +} + } /* namespace PIPELINE */ /* end of file */ diff --git a/code/nel/tools/pipeline/plugin_library/pipeline_process.h b/code/nel/tools/pipeline/plugin_library/pipeline_process.h index ba4b5d7ed..cde203961 100644 --- a/code/nel/tools/pipeline/plugin_library/pipeline_process.h +++ b/code/nel/tools/pipeline/plugin_library/pipeline_process.h @@ -95,6 +95,7 @@ public: bool getValue(sint &result, const std::string &name); virtual bool getValues(std::vector &resultAppend, const std::string &name) = 0; virtual bool getValueNb(uint &result, const std::string &name) = 0; + bool getValuesRecurse(std::vector &resultAppend, const std::string &name); /// Find out if the plugin needs to rebuild. Input can be files or directories, output can only be files virtual bool needsToBeRebuilt(const std::vector &inputPaths, const std::vector &outputPaths, bool inputDepends) = 0; diff --git a/code/nel/tools/pipeline/plugin_nel/process_interface.cpp b/code/nel/tools/pipeline/plugin_nel/process_interface.cpp index e58aa2b2f..31f0bf825 100644 --- a/code/nel/tools/pipeline/plugin_nel/process_interface.cpp +++ b/code/nel/tools/pipeline/plugin_nel/process_interface.cpp @@ -99,40 +99,7 @@ void CProcessInterface::build() void CProcessInterfaceInfo::getDependentDirectories(std::vector &resultAppend) { - { - uint nb; - if (m_PipelineProcess->getValueNb(nb, "Interface.Atlas")) - { - for (uint i = 0; i < nb; ++i) - { - std::stringstream ss; - ss << "Interface.Atlas[" << i << "].SrcDirectories"; - m_PipelineProcess->getValues(resultAppend, ss.str()); - } - } - } - /*{ - uint nb; - if (m_PipelineProcess->getValueNb(nb, "Interface.AtlasDxtc")) - { - for (uint i = 0; i < nb; ++i) - { - std::stringstream ss; - ss << "Interface.AtlasDxtc[" << i << "].SrcDirectories"; - m_PipelineProcess->getValues(resultAppend, ss.str()); - } - } - } - { - std::stringstream ss; - ss << "Interface.Fullscreen.SrcDirectories"; - m_PipelineProcess->getValues(resultAppend, ss.str()); - } - { - std::stringstream ss; - ss << "Interface.3D.SrcDirectories"; - m_PipelineProcess->getValues(resultAppend, ss.str()); - }*/ + m_PipelineProcess->getValuesRecurse(resultAppend, "Interface.Atlas[].SrcDirectories"); } void CProcessInterfaceInfo::getDependentFiles(std::vector &resultAppend) diff --git a/code/nel/tools/pipeline/plugin_nel/process_texture_dds.cpp b/code/nel/tools/pipeline/plugin_nel/process_texture_dds.cpp index 8f4f76428..5ae43dac4 100644 --- a/code/nel/tools/pipeline/plugin_nel/process_texture_dds.cpp +++ b/code/nel/tools/pipeline/plugin_nel/process_texture_dds.cpp @@ -131,7 +131,9 @@ void CProcessTextureDDS::build() void CProcessTextureDDSInfo::getDependentDirectories(std::vector &resultAppend) { - { + m_PipelineProcess->getValuesRecurse(resultAppend, "Texture.DDS[].SrcDirectories"); + + /*{ uint nb; if (m_PipelineProcess->getValueNb(nb, "Texture.DDS")) { @@ -142,7 +144,7 @@ void CProcessTextureDDSInfo::getDependentDirectories(std::vector &r m_PipelineProcess->getValues(resultAppend, ss.str()); } } - } + }*/ } void CProcessTextureDDSInfo::getDependentFiles(std::vector &resultAppend)