Commit 563dfcc8 authored by Cory Quammen's avatar Cory Quammen Committed by Kitware Robot

Merge topic 'string_array_direct_scalars_crash'

13aa55ca BUG: Direct scalar coloring with string arrays caused crash
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !209
parents 9be36d87 13aa55ca
......@@ -239,7 +239,7 @@ vtkUnsignedCharArray *vtkScalarsToColors::MapScalars(vtkAbstractArray *scalars,
// map scalars through lookup table only if needed
if ((colorMode == VTK_COLOR_MODE_DEFAULT &&
vtkUnsignedCharArray::SafeDownCast(dataArray) != NULL) ||
colorMode == VTK_COLOR_MODE_DIRECT_SCALARS)
(colorMode == VTK_COLOR_MODE_DIRECT_SCALARS && dataArray))
{
newColors = this->
ConvertToRGBA(dataArray, scalars->GetNumberOfComponents(),
......
......@@ -66,6 +66,11 @@ int TestColorByStringArrayDefaultLookupTable(int argc, char* argv[])
mapper->SetScalarModeToUseCellFieldData();
mapper->SelectColorArray(arrayName);
// Direct coloring shouldn't be possible with string arrays, so we
// enable direct scalars to test that the string arrays get mapped
// despite the color mode setting being direct scalars.
mapper->SetColorModeToDirectScalars();
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.Get());
......
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