Added: #1440 Plugin process handler identifier

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 0400a422f0
commit f32f82a385

@ -115,6 +115,7 @@ CPipelineWorkspace::~CPipelineWorkspace()
void CPipelineWorkspace::getProcessPlugins(std::vector<CProcessPluginInfo> &result, const std::string &process)
{
uint16 pluginId = 0;
for (std::vector<NLMISC::CRefPtr<NLGEORGES::UForm> >::iterator it = m_Plugins.begin(), end = m_Plugins.end(); it != end; ++it)
{
UFormElm *processHandlers;
@ -142,6 +143,8 @@ void CPipelineWorkspace::getProcessPlugins(std::vector<CProcessPluginInfo> &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<CProcessPluginInfo> &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<NLGEORGES::UForm> 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<std::string, CPipelineProject *>::const_iterator it = m_Projects.find(project);

@ -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<CProcessPluginInfo> &result, const std::string &process);
CPipelineProject *getProject(const std::string &project);
bool getProcessPlugin(CProcessPluginInfo &result, uint32 globalId);
}; /* class CPipelineWorkspace */

Loading…
Cancel
Save