[vtk-developers] vtkDataArray SetLookupTable bug?

Dean Inglis dean.inglis at sympatico.ca
Wed Apr 30 19:50:03 EDT 2008


 
I think I have uncovered a bug, but since this is a core vtk class, I would
like someone to confirm if I should fix:

//--------------------------------------------------------------------------
--
void vtkDataArray::SetLookupTable(vtkLookupTable* lut) {
  if ( this->LookupTable != lut ) 
    {
    if ( this->LookupTable )
      {
      this->LookupTable->UnRegister(this);
      }
    this->LookupTable = lut;
    this->LookupTable->Register(this);
    this->Modified();
    }
}

if lut is NULL, then the call to Register will be in error.  If lut can
never be null, then the fix might be

    this->LookupTable = lut;
    if(lut == NULL)
      {
      this->CreateDefaultLookupTable();
      }
    else
      {
      this->LookupTable->Register(this);
      }
    this->Modified();

otherwise the fix might be

    this->LookupTable = lut;
    if( lut ) this->LookupTable->Register(this);
    this->Modified();

I am trying to set the lookuptable of a polydata's scalar field to NULL so
that I can have a mapper pass the scalars through its lookuptable instead.

Dean




More information about the vtk-developers mailing list