Commit 78432508 authored by David E. DeMarle's avatar David E. DeMarle

implementation revisions for new catalyst exporter

This is a better separation of regular and catalyst export
definitions. The catalyst specific state is no longer on the
regular writer and screenshot definitions. Instead we have
a new catalyst specific groups where in we use proxy inheritance
to add catalyst specific properties to the normal export proxy
definitions. With this the catalyst and cinema specific writers
and properties no longer show up in regular export dialogs.
parent 507a10dd
......@@ -27,6 +27,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkSMWriterFactory.h"
#include "vtkSMWriterProxy.h"
#include "vtkSmartPointer.h"
#include "vtkStringList.h"
class vtkSMExportProxyDepot::Internal
{
......@@ -134,14 +135,21 @@ vtkSMSourceProxy* vtkSMExportProxyDepot::GetWriterProxy(
{
// first time accessed, make it
vtkSmartPointer<vtkSMWriterFactory> wf = vtkSmartPointer<vtkSMWriterFactory>::New();
auto sl = vtkSmartPointer<vtkStringList>::New();
wf->GetGroups(sl);
// we want our particular approved writers
for (int i = 0; i < sl->GetNumberOfStrings(); i++)
{
wf->RemoveGroup(sl->GetString(i));
}
wf->AddGroup("insitu2_writer_parameters");
wf->UpdateAvailableWriters();
writerProxy =
vtkSMWriterProxy::SafeDownCast(wf->CreateWriter(format, filter, 0, true, "CatalystApproved"));
writerProxy = vtkSMWriterProxy::SafeDownCast(wf->CreateWriter(format, filter, 0, true));
vtkPVXMLElement* hint = writerProxy->GetHints();
std::string extension = "";
// use first entry in the hint to choose a default fileextension
// use first entry in the hint to choose a default file extension
if (hint != nullptr)
{
vtkPVXMLElement* factory = hint->FindNestedElementByName("WriterFactory");
......@@ -227,7 +235,7 @@ vtkSMProxy* vtkSMExportProxyDepot::GetScreenshotProxy(
if (!ssProxy)
{
// first time accessed, make it
ssProxy = this->Session->NewProxy("misc", "SaveScreenshot");
ssProxy = this->Session->NewProxy("insitu2_writer_parameters", "SaveScreenshot");
if (!ssProxy)
{
return nullptr;
......
......@@ -85,7 +85,7 @@ public:
}
// Returns true if the data from the given output port can be written.
bool CanWrite(vtkSMSourceProxy* source, unsigned int port, const char* requiredHint = nullptr)
bool CanWrite(vtkSMSourceProxy* source, unsigned int port)
{
vtkSMSessionProxyManager* pxm = source->GetSession()->GetSessionProxyManager();
vtkSMProxy* prototype = pxm->GetPrototypeProxy(this->Group.c_str(), this->Name.c_str());
......@@ -121,27 +121,11 @@ public:
{
if (writer->GetParallelOnly())
{
if (!requiredHint ||
strcmp("CatalystApproved", requiredHint) !=
0) // Catalyst export can access parallel defs in serial
{
return false;
}
return false;
}
}
}
if (requiredHint && writer)
{
if (!writer->GetHints())
{
return false;
}
if (!writer->GetHints()->FindNestedElementByName(requiredHint))
{
return false;
}
}
vtkSMInputProperty* pp = vtkSMInputProperty::SafeDownCast(prototype->GetProperty("Input"));
if (!pp)
{
......@@ -292,8 +276,8 @@ void vtkSMWriterFactory::UpdateAvailableWriters()
}
//----------------------------------------------------------------------------
vtkSMProxy* vtkSMWriterFactory::CreateWriter(const char* filename, vtkSMSourceProxy* source,
unsigned int outputport, bool proxybyname, const char* requiredHint)
vtkSMProxy* vtkSMWriterFactory::CreateWriter(
const char* filename, vtkSMSourceProxy* source, unsigned int outputport, bool proxybyname)
{
if (!filename || filename[0] == 0)
{
......@@ -338,7 +322,7 @@ vtkSMProxy* vtkSMWriterFactory::CreateWriter(const char* filename, vtkSMSourcePr
iter->second.FillInformation(source->GetSession());
if (iter->second.CanCreatePrototype(source) &&
(proxybyname || iter->second.ExtensionTest(extension.c_str())) &&
iter->second.CanWrite(source, outputport, requiredHint))
iter->second.CanWrite(source, outputport))
{
if (proxybyname)
{
......@@ -412,7 +396,7 @@ const char* vtkSMWriterFactory::GetSupportedFileTypes(
//----------------------------------------------------------------------------
const char* vtkSMWriterFactory::GetSupportedWriterProxies(
vtkSMSourceProxy* source, unsigned int outputport, const char* requiredHint)
vtkSMSourceProxy* source, unsigned int outputport)
{
std::set<std::string> sorted_types;
......@@ -420,8 +404,7 @@ const char* vtkSMWriterFactory::GetSupportedWriterProxies(
for (iter = this->Internals->Prototypes.begin(); iter != this->Internals->Prototypes.end();
++iter)
{
if (iter->second.CanCreatePrototype(source) &&
iter->second.CanWrite(source, outputport, requiredHint))
if (iter->second.CanCreatePrototype(source) && iter->second.CanWrite(source, outputport))
{
iter->second.FillInformation(source->GetSession());
if (iter->second.Extensions.size() > 0)
......
......@@ -73,10 +73,9 @@ public:
* CreateWriter call.
* The proxybyname flag tells the factory to use the proxy name rather than
* a filename.extension to lookup the right proxy.
* The requiredHint restricts to proxies with the XML hint, for example "CatalystApproved".
*/
vtkSMProxy* CreateWriter(const char* filename, vtkSMSourceProxy*, unsigned int outputport,
bool proxyname = false, const char* requiredHint = nullptr);
vtkSMProxy* CreateWriter(
const char* filename, vtkSMSourceProxy*, unsigned int outputport, bool proxyname = false);
vtkSMProxy* CreateWriter(const char* filename, vtkSMSourceProxy* pxy)
{
return this->CreateWriter(filename, pxy, 0);
......@@ -97,8 +96,7 @@ public:
/**
* A variation on GetSupportedFileTypes that obtains a list of prototype proxy names.
*/
const char* GetSupportedWriterProxies(
vtkSMSourceProxy* source, unsigned int outputport, const char* requiredHint = nullptr);
const char* GetSupportedWriterProxies(vtkSMSourceProxy* source, unsigned int outputport);
// Returns the number of registered prototypes.
unsigned int GetNumberOfRegisteredPrototypes();
......
......@@ -4444,72 +4444,6 @@
file_description="Bitmap images" />
</Hints>
</Proxy>
<Proxy name="CDB" processes="client">
<Documentation>
Global setup for Cinema Image Database output.
</Documentation>
<IntVectorProperty name="Deferred Rendering"
number_of_elements="1"
default_values="0">
<Documentation>
Deferred rendering cabability level of this database. None means that static images are created at each viewpoint (aka 'SpecA'). Composeable (aka 'SpecC') adds ability to hide/show individual objects. Recolorable adds colormap editability.
</Documentation>
<EnumerationDomain name="enum">
<Entry text="None" value="0" />
<Entry text="Composable" value="1" />
<Entry text="Composable+Recolorable" value="2" />
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty name="Camera Model"
number_of_elements="1"
default_values="0">
<Documentation>
Specify camera capability level for this database. Static means the camera is fixed, phi-theta is an inward facing rectilinear sampling of the sphere, the pose cameras sparsely sample and maintain an orientation matrix.
</Documentation>
<EnumerationDomain name="enum">
<Entry text="Static" value="0" />
<Entry text="Phi-Theta" value="1" />
<Entry text="Inward Pose" value="2" />
<Entry text="Outward Pose" value="3" />
</EnumerationDomain>
</IntVectorProperty>
<StringVectorProperty name="Track Object"
number_of_elements="1"
default_values="None">
<Documentation>
Name of a pipeline object to orient the camera with. Only meaningful for Inward and Outward Pose Cameras.
</Documentation>
</StringVectorProperty>
<IntVectorProperty name="Camera Phi Divisions"
number_of_elements="1"
default_values="12">
<Documentation>
Specify number of longitudinal divisions. Only meaningful for Phi-Theta and Pose Cameras.
</Documentation>
<IntRangeDomain name="range" min="1" max="64" />
</IntVectorProperty>
<IntVectorProperty name="Camera Theta Divisions"
number_of_elements="1"
default_values="7">
<Documentation>
Specify number of latitudinal divisions. Only meaningful for Phi-Theta and Pose Cameras.
</Documentation>
<IntRangeDomain name="range" min="1" max="32" />
</IntVectorProperty>
<IntVectorProperty name="Camera Roll Divisions"
number_of_elements="1"
default_values="1">
<Documentation>
Specify number of roll divisions. Only meaningful for Inward and Outward Pose Cameras.
</Documentation>
<IntRangeDomain name="range" min="1" max="64" />
</IntVectorProperty>
<Hints>
<FormatOptions extensions="cdb"
file_description="Cinema Image Exports" />
</Hints>
</Proxy>
</ProxyGroup>
<ProxyGroup name="misc">
......@@ -4684,20 +4618,6 @@
<PropertyGroup label="Image Options">
<Property name="Format" />
</PropertyGroup>
<SubProxy>
<Proxy name="CatalystOptions"
proxygroup="misc"
proxyname="CatalystOptions"></Proxy>
<ExposedProperties>
<PropertyGroup label="Catalyst Options">
<Property name="WriteFrequency" />
<Property name="CatalystFilePattern" />
<Property name="CatalystFitToScreen" />
</PropertyGroup>
</ExposedProperties>
</SubProxy>
</SaveScreenshotProxy>
</ProxyGroup>
......@@ -4748,4 +4668,131 @@
</IntVectorProperty>
</LoadStateOptionsProxy>
</ProxyGroup>
<!-- ================================================================= -->
<ProxyGroup name="insitu2_misc">
<Proxy name="CDB" processes="client">
<Documentation>
Global setup for Cinema Image Database output.
</Documentation>
<IntVectorProperty name="Deferred Rendering"
number_of_elements="1"
default_values="0">
<Documentation>
Deferred rendering cabability level of this database. None means that static images are created at each viewpoint (aka 'SpecA'). Composeable (aka 'SpecC') adds ability to hide/show individual objects. Recolorable adds colormap editability.
</Documentation>
<EnumerationDomain name="enum">
<Entry text="None" value="0" />
<Entry text="Composable" value="1" />
<Entry text="Composable+Recolorable" value="2" />
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty name="Camera Model"
number_of_elements="1"
default_values="0">
<Documentation>
Specify camera capability level for this database. Static means the camera is fixed, phi-theta is an inward facing rectilinear sampling of the sphere, the pose cameras sparsely sample and maintain an orientation matrix.
</Documentation>
<EnumerationDomain name="enum">
<Entry text="Static" value="0" />
<Entry text="Phi-Theta" value="1" />
<Entry text="Inward Pose" value="2" />
<Entry text="Outward Pose" value="3" />
</EnumerationDomain>
</IntVectorProperty>
<StringVectorProperty name="Track Object"
number_of_elements="1"
default_values="None">
<Documentation>
Name of a pipeline object to orient the camera with. Only meaningful for Inward and Outward Pose Cameras.
</Documentation>
</StringVectorProperty>
<IntVectorProperty name="Camera Phi Divisions"
number_of_elements="1"
default_values="12">
<Documentation>
Specify number of longitudinal divisions. Only meaningful for Phi-Theta and Pose Cameras.
</Documentation>
<IntRangeDomain name="range" min="1" max="64" />
</IntVectorProperty>
<IntVectorProperty name="Camera Theta Divisions"
number_of_elements="1"
default_values="7">
<Documentation>
Specify number of latitudinal divisions. Only meaningful for Phi-Theta and Pose Cameras.
</Documentation>
<IntRangeDomain name="range" min="1" max="32" />
</IntVectorProperty>
<IntVectorProperty name="Camera Roll Divisions"
number_of_elements="1"
default_values="1">
<Documentation>
Specify number of roll divisions. Only meaningful for Inward and Outward Pose Cameras.
</Documentation>
<IntRangeDomain name="range" min="1" max="64" />
</IntVectorProperty>
<Hints>
<FormatOptions extensions="cdb"
file_description="Cinema Image Exports" />
</Hints>
</Proxy>
</ProxyGroup>
<ProxyGroup name="insitu2_writer_parameters">
<SaveScreenshotProxy
base_proxygroup="misc"
base_proxyname="SaveScreenshotBase"
name="SaveScreenshot"
processes="client">
<Documentation>
Variation with catalyst specific extensions.
</Documentation>
<ProxyProperty name="Format">
<ProxyListDomain name="proxy_list">
<Group name="screenshot_writers" />
<Group name="insitu2_misc" />
</ProxyListDomain>
<Hints>
<ProxySelectionWidget enabled="0" />
</Hints>
</ProxyProperty>
<PropertyGroup label="Size and Scaling">
<Property name="SaveAllViews" />
<Property name="ImageResolution" />
<Property name="FontScaling" />
</PropertyGroup>
<PropertyGroup label="Separator Options" >
<Property name="SeparatorWidth" />
<Property name="SeparatorColor" />
</PropertyGroup>
<PropertyGroup label="Coloring">
<Property name="OverrideColorPalette" />
<Property name="StereoMode" />
<Property name="TransparentBackground" />
</PropertyGroup>
<PropertyGroup label="Image Options">
<Property name="Format" />
</PropertyGroup>
<SubProxy>
<Proxy name="CatalystOptions"
proxygroup="misc"
proxyname="CatalystOptions"></Proxy>
<ExposedProperties>
<PropertyGroup label="Catalyst Options">
<Property name="WriteFrequency" />
<Property name="CatalystFilePattern" />
<Property name="CatalystFitToScreen" />
</PropertyGroup>
</ExposedProperties>
</SubProxy>
</SaveScreenshotProxy>
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -54,6 +54,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSMSourceProxy.h"
#include "vtkSMViewProxy.h"
#include "vtkSMWriterFactory.h"
#include "vtkStringList.h"
#include <sstream>
......@@ -256,7 +257,17 @@ void pqCatalystExportInspector::PopulateWriterFormats()
// discover the list of all possible writers for the current filter
vtkSmartPointer<vtkSMWriterFactory> wf = vtkSmartPointer<vtkSMWriterFactory>::New();
auto sl = vtkSmartPointer<vtkStringList>::New();
wf->GetGroups(sl);
// we want our particular approved writers
for (int i = 0; i < sl->GetNumberOfStrings(); i++)
{
wf->RemoveGroup(sl->GetString(i));
}
wf->AddGroup("insitu2_writer_parameters");
wf->UpdateAvailableWriters();
vtkSMSourceProxy* filter;
int portnum;
::getFilterProxyAndPort(filterName, filter, portnum);
......@@ -264,7 +275,7 @@ void pqCatalystExportInspector::PopulateWriterFormats()
{
return;
}
std::string availproxies = wf->GetSupportedWriterProxies(filter, portnum, "CatalystApproved");
std::string availproxies = wf->GetSupportedWriterProxies(filter, portnum);
std::stringstream ss(availproxies);
std::string item;
while (std::getline(ss, item, ';'))
......
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