[vtkusers] BUG: polydata deepcopy loses lookup table

Steve Kirstukas sjk60 at iastate.edu
Mon Jun 30 23:31:24 EDT 2003


Hi all,
We have noticed that when we deepcopy polydata from the reader output, we lose a
predefined lookup table.  Code and output follow.  I had experienced this
problem with an April version of the 4.3 code and duplicated it with the June 30
nightly release.

CODE...

   vtkPolyDataReader *pdReader = vtkPolyDataReader::New();
   pdReader->SetFileName( vtkFilename );
   pdReader->Update();

   if ( pdReader->GetOutput()->GetPointData()->GetScalars() )
   {
      cout << "pdReader->GetOutput()->GetPointData()->GetScalars()->GetName() =
" 
           << pdReader->GetOutput()->GetPointData()->GetScalars()->GetName() <<
endl;          
      cout <<
"pdReader->GetOutput()->GetPointData()->GetScalars()->GetLookupTable() = " 
           <<
pdReader->GetOutput()->GetPointData()->GetScalars()->GetLookupTable() <<
endl;          
   }

   vtkPolyData *polyData = vtkPolyData::New();
   polyData->DeepCopy( pdReader->GetOutput() );

   pdReader->Delete();

   if ( polyData->GetPointData()->GetScalars() )
   {
      cout << "polyData->GetPointData()->GetScalars()->GetName() = " 
           << polyData->GetPointData()->GetScalars()->GetName() <<
endl;          
      cout << "polyData->GetPointData()->GetScalars()->GetLookupTable() = " 
           << polyData->GetPointData()->GetScalars()->GetLookupTable() <<
endl;          
   }

THE OUTPUT FOLLOWS.  Note that the pointer to lookup table has gone to null
after the deepcopy.  Note that the scalar name is the same in both cases.  All
other data seems intact, except for the lookup table.

pdReader->GetOutput()->GetPointData()->GetScalars()->GetName() = liquid-fraction
pdReader->GetOutput()->GetPointData()->GetScalars()->GetLookupTable() =
0x10814978

polyData->GetPointData()->GetScalars()->GetName() = liquid-fraction
polyData->GetPointData()->GetScalars()->GetLookupTable() = 0x0


Has anyone else seen this?  Is there a workaround?
Thanks, Steve






More information about the vtkusers mailing list