diff --git a/tomviz/DataPropertiesPanel.cxx b/tomviz/DataPropertiesPanel.cxx index b4468f967..6552b796e 100644 --- a/tomviz/DataPropertiesPanel.cxx +++ b/tomviz/DataPropertiesPanel.cxx @@ -181,11 +181,15 @@ QList DataPropertiesPanel::getArraysInfo(DataSource* dataSource) { QList arraysInfo; + // If the number of scalar arrays has changed, reset the indexes. + auto scalars = dataSource->listScalars(); + if (scalars.size() != m_scalarIndexes.size()) + m_scalarIndexes.clear(); + // If we don't have the scalar indexes, we sort the names and then save the // indexes, these will be used to preserve the displayed order even after // a rename. if (m_scalarIndexes.isEmpty()) { - auto scalars = dataSource->listScalars(); auto sortedScalars = scalars; // sort the scalars names