Commit f727736c authored by Cory Quammen's avatar Cory Quammen

Fix typo in transfer function presets setting name

Added JSON transform function to potentially transform old JSON to the
expected format.

First transform:

  TransferFuctionPresets -> TransferFunctionPresets
parent 3bc5e021
......@@ -65,6 +65,19 @@ bool SortByPriority(const SettingsCollection& r1, const SettingsCollection& r2)
return (r1.Priority > r2.Priority);
}
// Potentially transform JSON to handle backwards compatibility issues
void TransformJSON(std::string& settingsJSON)
{
std::string findString("TransferFuctionPresets");
std::string replaceString("TransferFunctionPresets");
size_t location = settingsJSON.find(findString);
while (location != std::string::npos)
{
settingsJSON.replace(location, findString.length(), replaceString);
location = settingsJSON.find(findString);
}
}
} // end anonymous namespace
class vtkSMSettings::vtkSMSettingsInternal
......@@ -964,6 +977,9 @@ bool vtkSMSettings::AddCollectionFromString(const std::string& settings, double
processedSettings.append("{}");
}
// Take care of any backwards compatibility issues
TransformJSON(processedSettings);
Json::CharReaderBuilder builder;
builder["collectComments"] = true;
......
......@@ -61,7 +61,7 @@ public:
stream << iter->toStyledString().c_str();
}
stream << "]";
settings->SetSetting("TransferFuctionPresets.CustomPresets", stream.str());
settings->SetSetting("TransferFunctionPresets.CustomPresets", stream.str());
}
}
}
......@@ -202,7 +202,7 @@ private:
}
this->CustomPresetsLoaded = true;
const char* const settingsKey = "TransferFuctionPresets.CustomPresets";
const char* const settingsKey = "TransferFunctionPresets.CustomPresets";
vtkSMSettings* settings = vtkSMSettings::GetInstance();
if (settings == NULL || !settings->HasSetting(settingsKey))
{
......
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