Commit aff5b1fe authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fix issues with Catalyst editions.

Fixed missing dependency on SMApplication module. We needed to add
vtksys explicitly.

Also added mechanism to disable loading/saving of settings files.
vtkCPCxxHelper uses this mechanism to turn off settings loading/saving
when coprocessing.

Change-Id: I02c8612bc045ede82b7ae3c72b0410570dbf739f
parent ba6d98e7
......@@ -83,6 +83,9 @@ vtkCPCxxHelper* vtkCPCxxHelper::New()
vtkCPCxxHelper::Instance->Options = vtkPVOptions::New();
vtkCPCxxHelper::Instance->Options->SetSymmetricMPIMode(1);
// Disable vtkSMSettings processing for Catalyst applications.
vtkInitializationHelper::SetLoadSettingsFilesDuringInitialization(false);
vtkInitializationHelper::Initialize(
argc, argv, vtkProcessModule::PROCESS_BATCH,
vtkCPCxxHelper::Instance->Options);
......
......@@ -7,6 +7,8 @@ vtk_module(vtkPVServerManagerApplication
# When creating a "custom" application, simply change this to
# depend on the appropriate module.
vtkPVServerManagerCore
PRIVATE_DEPENDS
vtksys
COMPILE_DEPENDS
vtkUtilitiesProcessXML
# this enables the necesary modules.
......
......@@ -82,6 +82,28 @@ std::string ListAttachedMonitors()
} // end anon namespace
bool vtkInitializationHelper::LoadSettingsFilesDuringInitialization = true;
//----------------------------------------------------------------------------
void vtkInitializationHelper::SetLoadSettingsFilesDuringInitialization(bool val)
{
if (vtkProcessModule::GetProcessModule() &&
val != vtkInitializationHelper::LoadSettingsFilesDuringInitialization)
{
vtkGenericWarningMacro("SetLoadSettingsFilesDuringInitialization should be called "
"before calling Initialize().");
}
else
{
vtkInitializationHelper::LoadSettingsFilesDuringInitialization = val;
}
}
//----------------------------------------------------------------------------
bool vtkInitializationHelper::GetLoadSettingsFilesDuringInitialization()
{
return vtkInitializationHelper::LoadSettingsFilesDuringInitialization;
}
//----------------------------------------------------------------------------
void vtkInitializationHelper::Initialize(const char* executable, int type)
{
......@@ -205,15 +227,18 @@ void vtkInitializationHelper::StandaloneInitialize()
//----------------------------------------------------------------------------
void vtkInitializationHelper::Finalize()
{
// Write out settings file(s)
std::string userSettingsFile =
vtkInitializationHelper::GetUserSettingsDirectory();
userSettingsFile.append("UserSettings.json");
vtkSMSettings* settings = vtkSMSettings::GetInstance();
bool savingSucceeded = settings->SaveSettings(userSettingsFile.c_str());
if (!savingSucceeded)
if (vtkInitializationHelper::LoadSettingsFilesDuringInitialization)
{
cerr << "Saving settings file failed\n";
// Write out settings file(s)
std::string userSettingsFile =
vtkInitializationHelper::GetUserSettingsDirectory();
userSettingsFile.append("UserSettings.json");
vtkSMSettings* settings = vtkSMSettings::GetInstance();
bool savingSucceeded = settings->SaveSettings(userSettingsFile.c_str());
if (!savingSucceeded)
{
cerr << "Saving settings file failed\n";
}
}
vtkSMProxyManager::Finalize();
......@@ -233,6 +258,11 @@ void vtkInitializationHelper::StandaloneFinalize()
//----------------------------------------------------------------------------
bool vtkInitializationHelper::LoadSettings()
{
if (vtkInitializationHelper::LoadSettingsFilesDuringInitialization == false)
{
return false;
}
vtkSMSettings* settings = vtkSMSettings::GetInstance();
bool success = true;
......@@ -254,7 +284,7 @@ bool vtkInitializationHelper::LoadSettings()
// paths for app
pathsToSearch.push_back(app_dir + "/../../..");
pathsToSearch.push_back(app_dir + "/../../../../lib");
// paths when doing an unix style install.
pathsToSearch.push_back(app_dir +"/../lib/paraview-" PARAVIEW_VERSION);
#endif
......
......@@ -58,6 +58,13 @@ public:
static void StandaloneInitialize();
static void StandaloneFinalize();
// Description:
// During initialization, vtkInitializationHelper reads "settings" files for
// configuring vtkSMSettings. To disable this processing of the settings file
// for an application (e.g. in Catalyst), turn this off. On by default.
static void SetLoadSettingsFilesDuringInitialization(bool);
static bool GetLoadSettingsFilesDuringInitialization();
protected:
vtkInitializationHelper() {};
virtual ~vtkInitializationHelper() {};
......@@ -74,6 +81,7 @@ protected:
private:
vtkInitializationHelper(const vtkInitializationHelper&); // Not implemented
void operator=(const vtkInitializationHelper&); // Not implemented
static bool LoadSettingsFilesDuringInitialization;
};
#endif
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