[vtkusers] Bug in vtkInteractorStyle

Goodwin Lawlor goodwin.lawlor at ucd.ie
Thu Nov 28 11:06:55 EST 2002


To reproduce the small bug in vtkInteractorStyle:

1. Run /Hybrid/Testing/Tcl/TestProcrustes.tcl
2. Pick an actor in one renderer
3. Pick another actor in a differerent renderer

The outline actor remains in the first renderer you picked!

This code seems to fix it:

void vtkInteractorStyle::HighlightProp3D(vtkProp3D *prop3D) 
{
  if ( ! this->OutlineActor ) 
    {
    // have to defer creation to get right type
    this->OutlineActor = vtkActor::New();
    this->OutlineActor->PickableOff();
    this->OutlineActor->DragableOff();
    this->OutlineActor->SetMapper(this->OutlineMapper);
    this->OutlineActor->GetProperty()->SetColor(this->PickColor);
    this->OutlineActor->GetProperty()->SetAmbient(1.0);
    this->OutlineActor->GetProperty()->SetDiffuse(0.0);
    }
    
  //no prop picked now 
  if ( ! prop3D) 
    {
 //was there previously?
    if (this->PickedRenderer != NULL) 
      {
   this->PickedRenderer->RemoveActor(this->OutlineActor);
      this->PickedRenderer = NULL;
      }
    }
    //prop picked now 
  else
    {
    //check if picked in different renderer to previous pick
 if (this->CurrentRenderer != this->PickedRenderer)
      {
   if (this->PickedRenderer != NULL)
        {
     this->PickedRenderer->RemoveActor(this->OutlineActor);
        }
      this->CurrentRenderer->AddActor(this->OutlineActor);
      this->PickedRenderer = this->CurrentRenderer;      
      }
    this->Outline->SetBounds(prop3D->GetBounds());
    }
  
}




More information about the vtkusers mailing list