Skip to content

VR: Update vtkVRRenderWindowInteractor marking ComplexGesture recognition functions as public

Public HandleComplexGestureEvents() and RecognizeComplexGesture()

This helps client applications that are externally re-mapping the buttons associated with complex gesture:

  • Mark ComplexGesture recognition functions vtkVRRenderWindowInteractor::HandleComplexGestureEvents() and vtkVRRenderWindowInteractor::RecognizeComplexGesture() as public.

It allows to implement function like the following:

void vtkSlicerVirtualRealityLogic::SetGestureButtonToTrigger(vtkVRRenderWindowInteractor* rwi)
{
  vtkVRInteractorStyle* vrInteractorStyle = vtkVRInteractorStyle::SafeDownCast(rwi->GetInteractorStyle());
  if (!vrInteractorStyle)
  {
    return;
  }
  rwi->AddAction("/actions/vtk/in/TriggerAction", /*isAnalog=*/false,
                 [rwi](vtkEventData* ed) { rwi->HandleComplexGestureEvents(ed); });
  rwi->AddAction("/actions/vtk/in/ComplexGestureAction", vtkCommand::Select3DEvent, /*isAnalog=*/false);
}

Note that when the application aims to support both OpenVR and OpenXR runtimes, the ability to externally add actions reduce code duplication and streamline overall maintenance.

New vtkVRRenderWindowInteractor API functions

These help client applications redefining the heuristic used to recognized complex gestures:

  • Add vtkVRRenderWindowInteractor::GetCurrentGesture()/SetCurrentGesture() APIs for retrieving/setting the gesture being recognized.

  • Add vtkVRRenderWindowInteractor::GetDeviceInputDownCount()/SetDeviceInputDownCount() APIs.

Edited by Jean-Christophe Fillion-Robin

Merge request reports