Can I create a scalarbar if I`ve used vtkUnsignedCharArray to color the polydata object?

Hello,

I was wondering if I still could use vtkscalarbaractor if I chose to color the dataset with vtkUnsignedCharArray.

Thank you,

Rafael S.

          vtkNew<vtkPolyLine> polyLine;
          polyLine->GetPointIds()->SetNumberOfIds(nodes.size());
          for (unsigned int i = 0; i < nodes.size()+1; i++)
          {polyLine->GetPointIds()->SetId(i, i);}

  
          // Create a cell array to store the lines in and add the lines to it.
          vtkNew<vtkCellArray> cells;
          cells->InsertNextCell(polyLine);
         
          // Create a polydata to store everything in.
          vtkNew<vtkPolyData> polyData_morton;

          // Add the points to the dataset.
          polyData_morton->SetPoints(morton_line_points);

          // Add the lines to the dataset.
          polyData_morton->SetLines(cells);
          
          vtkNew<vtkUnsignedCharArray> cellData;
          cellData->SetNumberOfComponents(3);
          cellData->SetNumberOfTuples(polyData_morton->GetNumberOfLines());

          vtkNew<vtkMinimalStandardRandomSequence> randomSequence;
          randomSequence->SetSeed(8775070);
          auto min_r = 64.0;              auto max_r = 255.0;
          for (int i = 0; i < polyData_morton->GetNumberOfLines(); i++)
          {double rgb[3];
            for (auto j = 0; j < 3; ++j)
            {rgb[j] = randomSequence->GetRangeValue(min_r, max_r);randomSequence->Next();}
            cellData->InsertTuple(i, rgb);}              

          polyData_morton->GetCellData()->SetScalars(cellData);


          // Setup actor and mapper.
          vtkNew<vtkPolyDataMapper> mapper_morton;
          mapper_morton->SetInputData(polyData_morton);

          vtkNew<vtkActor> actor_morton;
          actor_morton->SetMapper(mapper_morton);
          actor_morton->GetProperty()->SetColor(colors->GetColor3d("Tomato").GetData());

            int scalarValue=1;

            vtkNew<vtkScalarBarActor> scalarBar;
            scalarBar->SetTitle("Bodies");
            scalarBar->SetNumberOfLabels(polyData_morton->GetNumberOfLines());
     	    scalarBar->SetLookupTable(lut);