Commit 51f2f735 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

vtkSMCompoundSourceProxy was blocking Superclass::ReadXMLAttributes.

This was essential otherwise the compound proxy ends up missing elements such as
hints/documentation etc. from the xml definition.

Also fixed vtkSMSourceProxy::ReadXMLAttributes() to handle case where
<OutputPort /> element has a missing "index" attribute.
parent acbb03ea
......@@ -94,7 +94,7 @@ void vtkSMCompoundSourceProxy::PrintSelf(ostream& os, vtkIndent indent)
void vtkSMCompoundSourceProxy::CreateOutputPorts()
{
if (this->Location == 0 ||
this->OutputPortsCreated && this->GetNumberOfOutputPorts())
(this->OutputPortsCreated && this->GetNumberOfOutputPorts() > 0))
{
return;
}
......@@ -175,10 +175,10 @@ void vtkSMCompoundSourceProxy::UpdateVTKObjects()
int vtkSMCompoundSourceProxy::ReadXMLAttributes( vtkSMProxyManager* pm,
vtkPVXMLElement* element)
{
// CAUTION: We changed the default ReadXMLAttributes by using a Locator...
// We overide this method since compound proxy XML definition
// is basically a XML state serialialization of a set of Proxies.
// this->Superclass::ReadXMLAttributes(pm, element);
if (!this->Superclass::ReadXMLAttributes(pm, element))
{
return 0;
}
// Initialise the Proxy based on its definition state
vtkSmartPointer<vtkSMCompoundProxyDefinitionLoader> deserializer;
......@@ -285,7 +285,9 @@ int vtkSMCompoundSourceProxy::ReadXMLAttributes( vtkSMProxyManager* pm,
}
}
}
return 1;
}
//----------------------------------------------------------------------------
// vtkSMSourceProxy guarantees that the output port size is set up correctly
// after CreateVTKObjects(). Hence, we ensure that it is set up correctly.
......
......@@ -223,6 +223,7 @@ int vtkSMSourceProxy::ReadXMLAttributes(vtkSMProxyManager* pm,
}
}
int port_count = 0;
unsigned int numElems = element->GetNumberOfNestedElements();
for (unsigned int cc=0; cc < numElems; cc++)
{
......@@ -231,11 +232,10 @@ int vtkSMSourceProxy::ReadXMLAttributes(vtkSMProxyManager* pm,
strcmp(child->GetName(), "OutputPort")==0)
{
// Load output port configuration.
int index;
int index = 0;
if (!child->GetScalarAttribute("index", &index))
{
vtkErrorMacro("Missing OutputPort attribute 'index'.");
return 0;
index = port_count;
}
const char* portname= child->GetAttribute("name");
if (!portname)
......@@ -243,6 +243,7 @@ int vtkSMSourceProxy::ReadXMLAttributes(vtkSMProxyManager* pm,
vtkErrorMacro("Missing OutputPort attribute 'name'.");
return 0;
}
port_count++;
this->PInternals->EnsureOutputPortsSize(index+1);
this->PInternals->OutputPorts[index].Name = portname;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment