Skip to content
Snippets Groups Projects
Commit d93ce32a authored by Mathieu Westphal (Kitware)'s avatar Mathieu Westphal (Kitware) :zap: Committed by Kitware Robot
Browse files

Merge topic 'vtkjs-export-named-array'


7de061cb JSONSceneExporter: only choose arrays for named actor map

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarbuildbot <buildbot@kitware.com>
Reviewed-by: default avatarMathieu Westphal (Kitware) <mathieu.westphal@kitware.com>
Reviewed-by: default avatarJean Fechter <jean.fechter@kitware.com>
Merge-request: !11835
parents f40e1802 7de061cb
No related branches found
No related tags found
No related merge requests found
......@@ -476,32 +476,38 @@ std::string vtkJSONSceneExporter::WriteDataSet(
dsWriter->SetInputData(dataset);
dsWriter->GetArchiver()->SetArchiveName(dsPath.c_str());
// Disable all arrays by default, and select only the ones that we need.
dsWriter->GetPointArraySelection()->SetUnknownArraySetting(0);
dsWriter->GetCellArraySelection()->SetUnknownArraySetting(0);
// Parse MapPointArrays's list of arrays, filter the ones that start with "propName:X", and
// forward information about X to the writer
for (int id = 0; id < this->PointArraySelection->GetNumberOfArrays(); id++)
// When the dataset is given a name, ie when we're working with a named actor map,
// disable all arrays by default, and select only the ones that are mapped.
if (name)
{
std::string currentName = this->PointArraySelection->GetArrayName(id);
if (currentName.find(name) != std::string::npos && currentName[std::string(name).size()] == ':')
dsWriter->GetPointArraySelection()->SetUnknownArraySetting(0);
dsWriter->GetCellArraySelection()->SetUnknownArraySetting(0);
// Parse MapPointArrays's list of arrays, filter the ones that start with "propName:X", and
// forward information about X to the writer
for (int id = 0; id < this->PointArraySelection->GetNumberOfArrays(); id++)
{
std::string arrayName = currentName.substr(std::string(name).size() + 1);
dsWriter->GetPointArraySelection()->SetArraySetting(
arrayName.c_str(), this->PointArraySelection->ArrayIsEnabled(currentName.c_str()));
std::string currentName = this->PointArraySelection->GetArrayName(id);
if (currentName.find(name) != std::string::npos &&
currentName[std::string(name).size()] == ':')
{
std::string arrayName = currentName.substr(std::string(name).size() + 1);
dsWriter->GetPointArraySelection()->SetArraySetting(
arrayName.c_str(), this->PointArraySelection->ArrayIsEnabled(currentName.c_str()));
}
}
}
// Same for cell arrays
for (int id = 0; id < this->CellArraySelection->GetNumberOfArrays(); id++)
{
std::string currentName = this->CellArraySelection->GetArrayName(id);
if (currentName.find(name) != std::string::npos && currentName[std::string(name).size()] == ':')
// Same for cell arrays
for (int id = 0; id < this->CellArraySelection->GetNumberOfArrays(); id++)
{
std::string arrayName = currentName.substr(std::string(name).size() + 1);
dsWriter->GetCellArraySelection()->SetArraySetting(
arrayName.c_str(), this->CellArraySelection->ArrayIsEnabled(currentName.c_str()));
std::string currentName = this->CellArraySelection->GetArrayName(id);
if (currentName.find(name) != std::string::npos &&
currentName[std::string(name).size()] == ':')
{
std::string arrayName = currentName.substr(std::string(name).size() + 1);
dsWriter->GetCellArraySelection()->SetArraySetting(
arrayName.c_str(), this->CellArraySelection->ArrayIsEnabled(currentName.c_str()));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment