From f32f82a385bf1f13da996887f2568ee029eec117 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 4 Mar 2012 14:13:32 +0100 Subject: [PATCH] Added: #1440 Plugin process handler identifier --HG-- branch : build_pipeline_v3 --- .../pipeline/service/pipeline_workspace.cpp | 33 +++++++++++++++++++ .../pipeline/service/pipeline_workspace.h | 15 +++++++++ 2 files changed, 48 insertions(+) diff --git a/code/nel/tools/pipeline/service/pipeline_workspace.cpp b/code/nel/tools/pipeline/service/pipeline_workspace.cpp index fa2901127..efd1b7131 100644 --- a/code/nel/tools/pipeline/service/pipeline_workspace.cpp +++ b/code/nel/tools/pipeline/service/pipeline_workspace.cpp @@ -115,6 +115,7 @@ CPipelineWorkspace::~CPipelineWorkspace() void CPipelineWorkspace::getProcessPlugins(std::vector &result, const std::string &process) { + uint16 pluginId = 0; for (std::vector >::iterator it = m_Plugins.begin(), end = m_Plugins.end(); it != end; ++it) { UFormElm *processHandlers; @@ -142,6 +143,8 @@ void CPipelineWorkspace::getProcessPlugins(std::vector &resu { processPlugin.HandlerType = (TPluginType)handlerType; processPlugin.InfoType = (TPluginType)infoType; + processPlugin.Id.Sub.Plugin = pluginId; + processPlugin.Id.Sub.Handler = i; result.push_back(processPlugin); nldebug("Found '%s': '%s', '%s'", process.c_str(), processPlugin.Handler.c_str(), processPlugin.Info.c_str()); @@ -167,9 +170,39 @@ void CPipelineWorkspace::getProcessPlugins(std::vector &resu { nlwarning("Missing 'ProcessHandlers' in '%s'", (*it)->getFilename().c_str()); } + ++pluginId; } } +bool CPipelineWorkspace::getProcessPlugin(CProcessPluginInfo &result, uint32 globalId) +{ + CProcessPluginId id; + id.Global = globalId; + if (id.Sub.Plugin >= m_Plugins.size()) + { + nlwarning("Plugin id out of range"); + return false; + } + NLMISC::CRefPtr pluginForm = m_Plugins[id.Sub.Plugin]; + UFormElm *processHandlers; + if (!pluginForm->getRootNode().getNodeByName(&processHandlers, "ProcessHandlers")) return false; + UFormElm *handler; + if (!processHandlers->getArrayNode(&handler, id.Sub.Handler)) return false; + uint32 handlerType; + uint32 infoType; + if (handler->getValueByName(handlerType, "HandlerType") + && handler->getValueByName(result.Handler, "Handler") + && handler->getValueByName(infoType, "InfoType") + && handler->getValueByName(result.Info, "Info")) + { + result.HandlerType = (TPluginType)handlerType; + result.InfoType = (TPluginType)infoType; + result.Id = id; + return true; + } + else return false; +} + CPipelineProject *CPipelineWorkspace::getProject(const std::string &project) { std::map::const_iterator it = m_Projects.find(project); diff --git a/code/nel/tools/pipeline/service/pipeline_workspace.h b/code/nel/tools/pipeline/service/pipeline_workspace.h index 0f41626e1..7e48f04bd 100644 --- a/code/nel/tools/pipeline/service/pipeline_workspace.h +++ b/code/nel/tools/pipeline/service/pipeline_workspace.h @@ -48,8 +48,22 @@ enum TPluginType PLUGIN_LUA_SCRIPT, }; +struct CProcessPluginId +{ + union + { + struct + { + uint16 Plugin; + uint16 Handler; + } Sub; + uint32 Global; + }; +}; + struct CProcessPluginInfo { + CProcessPluginId Id; TPluginType HandlerType; std::string Handler; TPluginType InfoType; @@ -78,6 +92,7 @@ public: void getProcessPlugins(std::vector &result, const std::string &process); CPipelineProject *getProject(const std::string &project); + bool getProcessPlugin(CProcessPluginInfo &result, uint32 globalId); }; /* class CPipelineWorkspace */