Commit 0b81327e authored by Sebastien Jourdain's avatar Sebastien Jourdain
Browse files

Start python support

parent bceb9775
......@@ -23,6 +23,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkPVDataInformation.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkSMSessionCore.h"
#include "vtkSMProxyIterator.h"
#include "paraview.h"
......@@ -50,6 +51,7 @@ int main(int argc, char* argv[])
cout << "Starting..." << endl;
vtkSMProxyManager* pxm = session->GetProxyManager();
vtkProcessModule::GetProcessModule()->RegisterSession(session);
//================= View test =======================
......@@ -187,6 +189,22 @@ int main(int argc, char* argv[])
return_value = EXIT_FAILURE;
}
pxm->RegisterProxy("test", "source", proxy);
pxm->RegisterProxy("test", "shrink", shrink);
pxm->RegisterProxy("test", "writer", writer);
vtkSMProxyIterator *iter = vtkSMProxyIterator::New();
iter->Begin();
while(!iter->IsAtEnd())
{
cout << "Iterate over proxy " << iter->GetGroup() << ":" << iter->GetKey() << endl;
iter->Next();
}
iter->Delete();
pxm->UnRegisterProxy(proxy);
pxm->UnRegisterProxy(shrink);
pxm->UnRegisterProxy(writer);
writer->Delete();
proxy->Delete();
shrink->Delete();
......@@ -222,6 +240,8 @@ int main(int argc, char* argv[])
}
}
cout << "Exiting..." << endl;
session->Delete();
......
......@@ -24,6 +24,7 @@ SET (Kit_SRCS
vtkPMArraySelectionProperty.cxx
vtkPMDataArrayProperty.cxx
vtkPMDoubleVectorProperty.cxx
vtkPMFileSeriesReaderProxy.cxx
vtkPMIdTypeVectorProperty.cxx
vtkPMInputProperty.cxx
vtkPMIntVectorProperty.cxx
......@@ -49,12 +50,14 @@ SET (Kit_SRCS
vtkSMCompoundSourceProxy.cxx
vtkSMCompoundSourceProxyDefinitionBuilder.cxx
vtkSMContextViewProxy.cxx
vtkSMCSVExporterProxy.cxx
vtkSMDeserializer.cxx
vtkSMDeserializer.cxx
vtkSMDocumentation.cxx
vtkSMDomain.cxx
vtkSMDomainIterator.cxx
vtkSMDoubleVectorProperty.cxx
vtkSMExporterProxy.cxx
vtkSMGlobalPropertiesManager.cxx
vtkSMIdTypeVectorProperty.cxx
vtkSMInputProperty.cxx
......@@ -149,8 +152,10 @@ SET(Kit_SRCS
vtkSMAnimationSceneProxy.cxx
vtkSMAnimationSceneWriter.cxx
vtkSMApplication.cxx
vtkSMBooleanKeyFrameProxy.cxx
vtkSMBoxRepresentationProxy.cxx
vtkSMBoxRepresentationProxy.cxx # ---- don't know how to setup transform...
vtkSMCameraConfigurationReader.cxx
vtkSMCameraConfigurationWriter.cxx
vtkSMCameraKeyFrameProxy.cxx
......@@ -166,31 +171,39 @@ SET(Kit_SRCS
vtkSMConnectionCleanerProxy.cxx
vtkSMContextArraysInformationHelper.cxx #---- SM Side only, not managed yet...
vtkSMContextNamedOptionsProxy.cxx
vtkSMCSVExporterProxy.cxx
vtkSMDataSourceProxy.cxx #---- Who use it ? --- Make a special property type ?
vtkSMDistanceRepresentation2DProxy.cxx
vtkSMExponentialKeyFrameProxy.cxx
vtkSMExporterProxy.cxx
vtkSMFileSeriesReaderProxy.cxx
vtkSMGlobalPropertiesLinkUndoElement.cxx #--------------------------------
vtkSMHardwareSelector.cxx
vtkSMFetchDataProxy.cxx
vtkSMImageTextureProxy.cxx
vtkSMImplicitPlaneRepresentationProxy.cxx
vtkSMInteractionUndoStackBuilder.cxx#--------------------------------
vtkSMKeyFrameAnimationCueManipulatorProxy.cxx
vtkSMKeyFrameProxy.cxx
vtkSMLinearAnimationCueManipulatorProxy.cxx
vtkSMLookupTableProxy.cxx
vtkSMMaterialLoaderProxy.cxx
vtkSMNamedPropertyIterator.cxx
vtkSMNewWidgetRepresentationProxy.cxx
vtkSMOrderedPropertyIterator.cxx
vtkSMNetworkImageSourceProxy.cxx
vtkSMOrderedPropertyIterator.cxx
vtkSMPQStateLoader.cxx
vtkSMPluginManager.cxx
vtkSMPluginProxy.cxx
# vtkSMPluginInformationHelper.cxx
vtkSMPropertyAdaptor.cxx
vtkSMNamedPropertyIterator.cxx
vtkSMPropertyModificationUndoElement.cxx#--------------------------------
vtkSMProxyConfigurationReader.cxx
vtkSMProxyConfigurationWriter.cxx
......@@ -200,10 +213,12 @@ SET(Kit_SRCS
vtkSMProxyUnRegisterUndoElement.cxx#--------------------------------
vtkSMPythonTraceObserver.cxx
vtkSMPVLookupTableProxy.cxx
vtkSMRampKeyFrameProxy.cxx
vtkSMReaderFactory.cxx
vtkSMRenderViewExporterProxy.cxx
vtkSMRepresentationAnimationHelperProxy.cxx
vtkSMScalarBarActorProxy.cxx
vtkSMScalarBarWidgetRepresentationProxy.cxx
# vtkSMScatterPlotArraysInformationHelper.cxx
......@@ -214,18 +229,21 @@ SET(Kit_SRCS
vtkSMServerSideAnimationPlayer.cxx
vtkSMSILModel.cxx
vtkSMSinusoidKeyFrameProxy.cxx
# vtkSMTemporalInputDomain.cxx
vtkSMTesting.cxx
vtkSMTextWidgetRepresentationProxy.cxx
vtkSMTimeAnimationCueProxy.cxx
vtkSMTimeKeeperProxy.cxx
vtkSMTransformProxy.cxx
vtkSMUndoRedoStateLoader.cxx#-------------------------------- should be DELETE
vtkSMUpdateInformationUndoElement.cxx#--------------------------------
vtkSMWidgetRepresentationProxy.cxx
vtkSMWriterProxy.cxx
vtkSMXMLPVAnimationWriterProxy.cxx
vtkSMDataSourceProxy.cxx
)
SET( ServerManagerNonWrapped_SRCS
......@@ -256,6 +274,7 @@ SET_SOURCE_FILES_PROPERTIES(
vtkSMPropertyHelper.cxx
vtkSMStateVersionControllerBase.cxx
vtkSMUndoElement.cxx
vtkSMExporterProxy.cxx
ABSTRACT
)
......@@ -274,7 +293,6 @@ SET_SOURCE_FILES_PROPERTIES(
vtkSMProxyManagerReviver.cxx
vtkSMStateVersionControllerBase.cxx
vtkSMStateVersionControllerBase.cxx
vtkSMExporterProxy.cxx
ABSTRACT
)
......@@ -359,7 +377,6 @@ IF (PARAVIEW_ENABLE_PYTHON)
SET(Kit_PYTHON_EXTRA_SRCS)
SET (Kit_SRCS
${Kit_SRCS}
vtkSMXMLParser.cxx
)
SET(KIT_PYTHON_LIBS
vtkPVServerCommonPythonD vtk${KIT}
......
......@@ -3874,6 +3874,9 @@ The Triangle Strips filter converts triangles into triangle strips and lines int
</SourceProxy>
<!-- ==================================================================== -->
<!-- FIXME comment out Compound proxy !!!!
<CompoundSourceProxy name="PlotOnIntersectionCurves" label="Plot On Intersection Curves">
<Documentation
short_help="Extracts the edges in a 2D plane and plots them"
......@@ -3982,11 +3985,14 @@ The Triangle Strips filter converts triangles into triangle strips and lines int
</ExposedProperties>
<OutputPort name="Output" proxy="PlotEdges1" port_index="0"/>
<Hints>
<!-- View can be used to specify the preferred view for the proxy -->
<View type="XYChartView" />
<View type="XYChartView"
help="View can be used to specify the preferred view for the proxy"/>
<Plotable />
</Hints>
</CompoundSourceProxy>
-->
<!-- ==================================================================== -->
<SourceProxy name="Subdivide" class="vtkLinearSubdivisionFilter">
<Documentation
......@@ -5699,6 +5705,9 @@ The Probe filter samples the data set attributes of the current data set at the
</SourceProxy>
<!-- ==================================================================== -->
<!-- FIXME comment out Compound proxy !!!!
<CompoundSourceProxy name="ProbeLine" label="Plot Over Line">
<Documentation
long_help="Sample data attributes at the points along a line. Probed lines will be displayed in a graph of the attributes."
......@@ -5726,13 +5735,16 @@ The Probe filter samples the data set attributes of the current data set at the
<OutputPort name="Output" proxy="AppendArcLength1" port_index="0"/>
<Hints>
<Visibility replace_input="0" />
<!-- View can be used to specify the preferred view for the proxy -->
<View type="XYChartView" />
<View type="XYChartView"
help="View can be used to specify the preferred view for the proxy"/>
<Plotable />
</Hints>
<!-- End ProbeLine -->
</CompoundSourceProxy>
-->
<!-- End ProbeLine -->
<!-- ==================================================================== -->
<SourceProxy name="Probe" class="vtkPProbeFilter"
label="Resample With Dataset">
......@@ -8838,6 +8850,9 @@ This property controls how the filter works to generate tensor cell data. You ca
</SourceProxy>
<!-- ==================================================================== -->
<!-- FIXME comment out Compound proxy !!!!
<CompoundSourceProxy name="NormalGlyphs" label="Normal Glyphs">
<Documentation short_help="Filter computing surface normals."
long_help="Filter computing surface normals.">
......@@ -9057,15 +9072,16 @@ This property controls how the filter works to generate tensor cell data. You ca
</ExposedProperties>
<OutputPort name="Output" proxy="Glyph1" port_index="0"/>
<Hints>
<!-- Visibility Element can be used to suggest the GUI about
visibility of this filter (or its input) on creation.
replace_input="0" implies that the input visibility is not
changed on creation of this filter (defaults to "1")
-->
<Visibility replace_input="0" />
<Visibility replace_input="0"
help="Visibility Element can be used to suggest the GUI about
visibility of this filter (or its input) on creation.
replace_input='0' implies that the input visibility is not
changed on creation of this filter (defaults to '1')"/>
</Hints>
</CompoundSourceProxy>
-->
<!-- ==================================================================== -->
<SourceProxy name="TableToPolyData"
class="vtkTableToPolyData"
......@@ -9223,6 +9239,9 @@ This property controls how the filter works to generate tensor cell data. You ca
</SourceProxy>
<!-- ================================================================== -->
<!-- FIXME comment out Compound proxy !!!!
<CompoundSourceProxy name="FFTSelectionOverTime"
label="FFT Of Selection Over Time">
<Documentation
......@@ -9299,11 +9318,14 @@ This property controls how the filter works to generate tensor cell data. You ca
</ExposedProperties>
<OutputPort name="Output" proxy="TableFFT1" port_index="0"/>
<Hints>
<!-- View can be used to specify the preferred view for the proxy -->
<View type="XYChartView" />
<View type="XYChartView"
help="View can be used to specify the preferred view for the proxy"/>
<Plotable />
</Hints>
</CompoundSourceProxy> <!-- FFTSelectionOverTime -->
</CompoundSourceProxy>
-->
<!-- FFTSelectionOverTime -->
<!-- ================================================================== -->
<SourceProxy name="AttributeDataToTableFilter"
......
This diff is collapsed.
......@@ -81,8 +81,7 @@ void vtkSMBoxRepresentationProxy::UpdatePropertyInformation()
vtkBoxRepresentation* repr = vtkBoxRepresentation::SafeDownCast(
this->GetClientSideObject());
vtkTransform* transform = vtkTransform::SafeDownCast(
vtkProcessModule::GetProcessModule()->GetObjectFromID(
this->GetSubProxy("Transform")->GetID()));
this->GetSubProxy("Transform")->GetClientSideObject());
repr->GetTransform(transform);
this->Superclass::UpdatePropertyInformation();
......
......@@ -57,6 +57,13 @@ void vtkSMContextViewProxy::CreateVTKObjects()
return;
}
this->Superclass::CreateVTKObjects();
// If prototype, no need to go thurther...
if(this->Location == 0)
{
return;
}
if (!this->ObjectsCreated)
{
return;
......
......@@ -33,7 +33,7 @@ vtkSMDataSourceProxy::~vtkSMDataSourceProxy()
//----------------------------------------------------------------------------
void vtkSMDataSourceProxy::CopyData(vtkSMSourceProxy *sourceProxy)
{
if (!sourceProxy || this->Servers != sourceProxy->GetServers())
if (!sourceProxy || this->Location != sourceProxy->GetLocation())
{
return;
}
......
......@@ -26,7 +26,7 @@ vtkSMExporterProxy::vtkSMExporterProxy()
this->View = 0;
this->FileExtension = 0;
this->SetFileExtension("txt");
this->SetServers(vtkProcessModule::CLIENT);
this->SetLocation(vtkProcessModule::CLIENT);
}
//----------------------------------------------------------------------------
......
/*=========================================================================
Program: ParaView
Module: vtkSMFileSeriesReaderProxy.cxx
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkSMFileSeriesReaderProxy.h"
#include "vtkClientServerStream.h"
#include "vtkObjectFactory.h"
#include "vtkPVXMLElement.h"
#include "vtkProcessModule.h"
#include "vtkSMProxyProperty.h"
vtkStandardNewMacro(vtkSMFileSeriesReaderProxy);
//-----------------------------------------------------------------------------
vtkSMFileSeriesReaderProxy::vtkSMFileSeriesReaderProxy()
{
this->FileNameMethod = 0;
}
//-----------------------------------------------------------------------------
vtkSMFileSeriesReaderProxy::~vtkSMFileSeriesReaderProxy()
{
this->SetFileNameMethod(0);
}
//-----------------------------------------------------------------------------
void vtkSMFileSeriesReaderProxy::CreateVTKObjects()
{
if (this->ObjectsCreated)
{
return;
}
this->Superclass::CreateVTKObjects();
if (!this->ObjectsCreated)
{
return;
}
vtkSMSourceProxy* reader =
vtkSMSourceProxy::SafeDownCast(this->GetSubProxy("Reader"));
if (!reader)
{
vtkErrorMacro("Missing subproxy: Reader");
return;
}
vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
vtkClientServerStream stream;
stream << vtkClientServerStream::Invoke
<< this->GetID() << "SetReader" << reader->GetID()
<< vtkClientServerStream::End;
if (this->GetFileNameMethod())
{
stream << vtkClientServerStream::Invoke
<< this->GetID()
<< "SetFileNameMethod"
<< this->GetFileNameMethod()
<< vtkClientServerStream::End;
}
pm->SendStream(this->ConnectionID, this->Servers, stream);
}
//---------------------------------------------------------------------------
int vtkSMFileSeriesReaderProxy::ReadXMLAttributes(
vtkSMProxyManager* pm, vtkPVXMLElement* element)
{
const char* setFileNameMethod = element->GetAttribute("file_name_method");
if(setFileNameMethod)
{
this->SetFileNameMethod(setFileNameMethod);
}
return this->Superclass::ReadXMLAttributes(pm, element);
}
//-----------------------------------------------------------------------------
void vtkSMFileSeriesReaderProxy::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
/*=========================================================================
Program: ParaView
Module: vtkSMFileSeriesReaderProxy.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkSMFileSeriesReaderProxy - Proxy for vtkFileSeriesReader
// .SECTION Description
// vtkSMFileSeriesReaderProxy is used to manager vtkFileSeriesReaders.
// It creates the internal reader as a sub-proxy and sets it on the
// meta-reader in CreateVTKObjects(). It also sets FileNameMethod from
// the xml attribute file_name_method.
// .SECTION See Also
// vtkFileSeriesReader
#ifndef __vtkSMFileSeriesReaderProxy_h
#define __vtkSMFileSeriesReaderProxy_h
#include "vtkSMSourceProxy.h"
class VTK_EXPORT vtkSMFileSeriesReaderProxy : public vtkSMSourceProxy
{
public:
static vtkSMFileSeriesReaderProxy* New();
vtkTypeMacro(vtkSMFileSeriesReaderProxy, vtkSMSourceProxy);
void PrintSelf(ostream& os, vtkIndent indent);
protected:
vtkSMFileSeriesReaderProxy();
~vtkSMFileSeriesReaderProxy();
// Description:
// Read attributes from an XML element.
virtual int ReadXMLAttributes(vtkSMProxyManager* pm, vtkPVXMLElement* element);
virtual void CreateVTKObjects();
// This is the name of the method used to set the file name on the
// internal reader. See vtkFileSeriesReader for details.
vtkSetStringMacro(FileNameMethod);
vtkGetStringMacro(FileNameMethod);
char* FileNameMethod;
private:
vtkSMFileSeriesReaderProxy(const vtkSMFileSeriesReaderProxy&); // Not implemented.
void operator=(const vtkSMFileSeriesReaderProxy&); // Not implemented.
};
#endif
......@@ -72,7 +72,6 @@ class vtkSMDomainIterator;
class vtkSMInformationHelper;
class vtkSMProxy;
class vtkSMProxyLocator;
class vtkSMXMLParser;
//BTX
struct vtkSMPropertyInternals;
//ETX
......
......@@ -537,7 +537,7 @@ void vtkSMProxy::UpdateVTKObjects()
{
this->CreateVTKObjects();
if (!this->ObjectsCreated || this->InUpdateVTKObjects ||
!this->ArePropertiesModified())
!this->ArePropertiesModified() || this->Location == 0)
{
return;
}
......@@ -656,6 +656,12 @@ void vtkSMProxy::CreateVTKObjects()
this->ObjectsCreated = 1;
this->WarnIfDeprecated();
// If no location, it means no state...
if(this->Location == 0)
{
return;
}
vtkSMMessage message;
message.SetExtension(DefinitionHeader::client_class, this->GetClassName());
message.SetExtension(DefinitionHeader::server_class, this->GetKernelClassName());
......@@ -1357,7 +1363,7 @@ int vtkSMProxy::CreateSubProxiesAndProperties(vtkSMProxyManager* pm,
}
else
{
subproxy = pm->NewProxy(subElement, 0, 0);
subproxy = pm->NewProxy(subElement, "inline-proxy", name); // FIXME !!!!
}
if (!subproxy)
{
......
......@@ -210,7 +210,10 @@ void vtkSMProxyManager::InstantiateGroupPrototypes(const char* groupName)
vtkSMProxy* proxy = this->NewProxy(groupName, xml_name);
if (proxy)
{
cout << "NewPrototype proxy " << groupName << " " << xml_name << endl
<< " - proxy: " << proxy->GetXMLGroup() << " " << proxy->GetXMLName() << endl;
proxy->SetSession(NULL);
proxy->SetLocation(0);
this->RegisterProxy(newgroupname.str().c_str(), xml_name, proxy);
proxy->FastDelete();
}
......
......@@ -108,6 +108,11 @@ void vtkSMRemoteObject::SetGlobalID(vtkTypeUInt32 guid)
//---------------------------------------------------------------------------
void vtkSMRemoteObject::PushState(vtkSMMessage* msg)
{
if(this->Location == 0)
{
return; // This object is a prototype and has no location
}
// Check if a GUID has been assigned to that object otherwise assign a new one
vtkTypeUInt32 gid = this->GetGlobalID();
msg->set_global_id(gid);
......@@ -116,7 +121,7 @@ void vtkSMRemoteObject::PushState(vtkSMMessage* msg)
{
this->GetSession()->PushState(msg);
}
else
else // FIXME this case occurs for prototype...
{
vtkErrorMacro("No session found");
// FIXME Throw exception or error feed back : Not PVSession found !
......@@ -126,6 +131,11 @@ void vtkSMRemoteObject::PushState(vtkSMMessage* msg)
//---------------------------------------------------------------------------
bool vtkSMRemoteObject::PullState(vtkSMMessage* msg)
{
if(this->Location == 0)
{
return true; // This object is a prototype and has no location
}
msg->set_global_id(this->GlobalID);
msg->set_location(this->Location);
if(this->GetSession())
......
......@@ -223,6 +223,12 @@ void vtkSMRenderViewProxy::CreateVTKObjects()
this->Superclass::CreateVTKObjects();
// If prototype, no need to go thurther...
if(this->Location == 0)
{
return;
}
if (!this->ObjectsCreated)
{
return;
......
......@@ -47,6 +47,12 @@ void vtkSMRepresentationProxy::CreateVTKObjects()
this->Superclass::CreateVTKObjects();
// If prototype, no need to add listeners...
if(this->Location == 0)
{
return;
}
vtkMemberFunctionCommand<vtkSMRepresentationProxy>* observer =
vtkMemberFunctionCommand<vtkSMRepresentationProxy>::New();
observer->SetCallback(*this, &vtkSMRepresentationProxy::RepresentationUpdated);
......
......@@ -195,7 +195,7 @@ public:
(*this->DebugLogFile) << header << endl;
this->DebugLogFile->write( messageToWrite->DebugString().c_str(),
messageToWrite->DebugString().length());