vtkInteractorStyleSwitch not always updates the interactor styles it uses when needed
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
When the SetInteractor() is used on vtkInteractorStyleForward, this->SetCurrentStyle() is called in the end of the function in order to update the interactors of the used interactor styles. However, SetCurrentStyle() "will do nothing if the CurrentStyle matchs JoystickOrTrackball and CameraOrActor", which is the case since only the Interactor has changed. In order to fix this, the this->CurrentStyle->SetInteractor(this->Interactor) calls must be taken outside the if-selections that detect whether CurrentStyle should be changed.
Also (another bug, but related), if SetDefaultRenderer or SetCurrentRenderer functions are called, the used interactor styles are not updated with this information. This should also be fixed by overriding SetDefaultRenderer and SetCurrentRenderer and make sure these functions also update the default/current renderer of the used interactor styles.
The following changes to vtkInteractorStyleSwitch.cxx fixes both bugs:
166a164 > this->CurrentStyle->SetInteractor(this->Interactor); 178a177 > this->CurrentStyle->SetInteractor(this->Interactor); 190a190 > this->CurrentStyle->SetInteractor(this->Interactor); 202a203 > this->CurrentStyle->SetInteractor(this->Interactor); 205,208d205 < if (this->CurrentStyle) < { < this->CurrentStyle->SetInteractor(this->Interactor); < } 251,270d247 < void vtkInteractorStyleSwitch::SetDefaultRenderer(vtkRenderer* renderer) < { < this->vtkInteractorStyle::SetDefaultRenderer(renderer); < this->JoystickActor->SetDefaultRenderer(renderer); < this->JoystickCamera->SetDefaultRenderer(renderer); < this->TrackballActor->SetDefaultRenderer(renderer); < this->TrackballCamera->SetDefaultRenderer(renderer); < } < < void vtkInteractorStyleSwitch::SetCurrentRenderer(vtkRenderer* renderer) < { < this->vtkInteractorStyle::SetCurrentRenderer(renderer); < this->JoystickActor->SetCurrentRenderer(renderer); < this->JoystickCamera->SetCurrentRenderer(renderer); < this->TrackballActor->SetCurrentRenderer(renderer); < this->TrackballCamera->SetCurrentRenderer(renderer); < }