Commit 2b9e0d0f authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic 'fix_vtklegacy_loading_crash'

7d211045 Fix crash on loading VTK legacy file with no timesteps.
parents e1e2f8be 7d211045
......@@ -74,21 +74,25 @@ void pqDataTimeStepBehavior::onReaderCreated(pqPipelineSource* reader)
{
vtkSMPropertyHelper helper(readerProxy, "TimestepValues");
unsigned int num_timesteps = helper.GetNumberOfElements();
std::vector<double> timesteps = helper.GetDoubleArray();
unsigned int newTimeStep =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ? 0 :
(num_timesteps - 1);
scene->setAnimationTime(timesteps[newTimeStep]);
if (num_timesteps > 0)
{
std::vector<double> timesteps = helper.GetDoubleArray();
unsigned int newTimeStep =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ? 0 :
(num_timesteps - 1);
scene->setAnimationTime(timesteps[newTimeStep]);
}
}
else if (readerProxy->GetProperty("TimeRange"))
{
vtkSMPropertyHelper helper(readerProxy, "TimeRange");
std::vector<double> timeRange = helper.GetDoubleArray();
double newTime =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ?
timeRange[0] : timeRange[1];
scene->setAnimationTime(newTime);
if (timeRange.size() > 0)
{
double newTime =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ?
timeRange[0] : timeRange[1];
scene->setAnimationTime(newTime);
}
}
}
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