Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix integration with updated Slicer event delegation and VTK OpenVR API #131

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Dec 16, 2023

Addressing issues highlighted in Slicer/Slicer@1cc3b2c62, this commit introduces the vtkVirtualRealityViewInteractorObserver class. This addition streamlines event delegation to MRML displayable managers and their associated widgets by leveraging observation of the interactor style.

The modification enables the vtkVirtualRealityViewInteractorStyle to inherit from vtkOpenVRInteractorStyle, eliminating the need for redundant code implementation and duplication.

It also updates the use of MapInputToAction() to map "eventId to state" following the VTK refactoring introduced in Kitware/VTK@b7f02e622 (update openvr to action based input model).


This is also required the following VTK commit1:

[SlicerVirtualReality] ENH: Update OpenVR json binding to map right and left trigger with triggeraction

This is required to support using the trigger button for complex gesture.
See vtkVirtualRealityViewInteractor::SetGestureButtonToTrigger()

Co-authored-by: Lucas Gandel <[email protected]>

Update: The corresponding changes along with the latest V/OpenVR/OpenXR VTK updates have been integrated into Slicer/VTK through Slicer/VTK#46 and in Slicer through Slicer/Slicer#7487

Footnotes

  1. https://github.com/Slicer/VTK/compare/slicer-v9.2.20230607-1ff325c54-2...Slicer:VTK:slicer-v9.2.20230607-1ff325c54-2_slicervr-pr-131

@jcfr jcfr force-pushed the fix-slicer-event-delegation-and-vtk-openvr-api-integration branch from bbd4786 to eeaac5a Compare December 16, 2023 00:42
@sankhesh
Copy link
Contributor

@jcfr I can confirm that this PR allows me to compile SlicerVirtualReality now 🎉.

I'll test it when I get in the office tomorrow and report here if I run into any runtime issues.

@jcfr jcfr force-pushed the fix-slicer-event-delegation-and-vtk-openvr-api-integration branch 8 times, most recently from 79cb8cd to 6a7f5ba Compare December 21, 2023 09:59
jcfr and others added 4 commits December 21, 2023 16:35
…nVR API

Addressing issues highlighted in Slicer/Slicer@1cc3b2c62, this commit introduces
the `vtkVirtualRealityViewInteractorObserver` class. This addition streamlines
event delegation to MRML displayable managers and their associated widgets
by leveraging observation of the interactor style.

The modification enables the `vtkVirtualRealityViewInteractorStyle` to inherit
from `vtkOpenVRInteractorStyle`, eliminating the need for redundant code
implementation and duplication.

It also updates the use of `MapInputToAction()` to map "eventId to state"
following the VTK refactoring introduced in Kitware/VTK@b7f02e622 (update
openvr to action based input model).

Co-authored-by: Lucas Gandel <[email protected]>
Co-authored-by: Sankhesh Jhaveri <[email protected]>
This commit revisits the invocation of `vtkMRMLViewInteractorStyle::ProcessEvents`
to prioritize event processing specific to `VirtualReality`. The additional
processing is now performed only if the events have not been processed already.

Furthermore, this commit restores the support for calling `OnStartGesture`
and `OnEndGesture`, which was inadvertently omitted in the previous commit
titled "BUG: Fix integration with updated Slicer event delegation and VTK
OpenVR API."

Co-authored-by: Sankhesh Jhaveri <[email protected]>
This commit follows up to "BUG: Fix integration with updated Slicer event
delegation and VTK OpenVR API". It ensures that existing event data objects
are consistently passed down to the `Delegate` functions and associated
displayable managers.
…ts Callback

Following the previous commit titled "BUG: Ensure passing of vtkEventData to
displayable managers," this update guarantees the effective invocation of the
newly introduced custom delegation function, designed to handle a calldata
argument. This ensures that all processing is funneled through the
`vtkVirtualRealityViewInteractorObserver::CustomProcessEvents` callback. The
callback is responsible for handling 3D event data and passing it down appropriately.
@jcfr jcfr force-pushed the fix-slicer-event-delegation-and-vtk-openvr-api-integration branch from 5ee8972 to 969f93b Compare December 21, 2023 21:39
@jcfr jcfr merged commit 22eba9f into KitwareMedical:master Dec 21, 2023
@jcfr jcfr deleted the fix-slicer-event-delegation-and-vtk-openvr-api-integration branch December 21, 2023 21:43
@jcfr
Copy link
Contributor Author

jcfr commented Dec 21, 2023

Related work enabling to build against the latest VTK

This work is in the continuation of an improvements and fixes implemented in the CTK, VTK, Slicer and SlicerVirtualReality projects.

Slicer:

SlicerVirtualReality:

CTK:

VTK:

  • MR-10778 BUG: Recognize OpenVR gesture where buttons are pressed consecutively

  • MR-10771 BUG: Add missing Elevation3DEvent to vtkCommand::EventHasData()

  • 10400 ENH: Re-introduce OpenVR API for retrieving last OpenVR pose

  • MR-9892 ENH: Re-introduce support for custom logic handling VR complex gesture

  • MR-8977 vtkInstallCMakePackageHelpers: add find_package hints for OpenVR

    Added to that are many other updates adding new capabilities along with the refactoring
    of vtkRenderingOpenVR introducing the vtkRenderingVR base module to be used by vtkRenderingOpenXR and vtkRenderingOpenXRRemoting.

cc: @cpinter @adamrankin @lassoan @LucasGandel @sankhesh

@jcfr jcfr linked an issue Dec 22, 2023 that may be closed by this pull request
@jcfr jcfr mentioned this pull request Dec 24, 2023
3 tasks
jcfr added a commit to jcfr/SlicerVirtualReality that referenced this pull request Dec 27, 2023
Removes "GestureEnabledButtons" ivar that became obsolete following
these commits:
* c5c6d6f ("BUG: Restore complex gesture support", 2023-01-29),
* 22eba9f ("BUG: Fix integration with updated Slicer event delegation and VTK OpenVR API (KitwareMedical#131)", 2023-12-21)
* 0fa6102 ("BUG: Ensure handling of gesture triggers the "End" event", 2023-12-20)
* 512efe6 ("BUG: Do not report "Unrecognized device" if handling complex gesture", 2023-12-20)

For reference, it was originally introduced in 43bef4b ("ENH: Make trigger
button configurable", 2019-01-11).
jcfr added a commit to jcfr/SlicerVirtualReality that referenced this pull request Dec 27, 2023
Removes "GestureEnabledButtons" ivar that became obsolete following
these commits:
* c5c6d6f ("BUG: Restore complex gesture support", 2023-01-29),
* 22eba9f ("BUG: Fix integration with updated Slicer event delegation and VTK OpenVR API (KitwareMedical#131)", 2023-12-21)
* 0fa6102 ("BUG: Ensure handling of gesture triggers the "End" event", 2023-12-20)
* 512efe6 ("BUG: Do not report "Unrecognized device" if handling complex gesture", 2023-12-20)

For reference, it was originally introduced in 43bef4b ("ENH: Make trigger
button configurable", 2019-01-11).
jcfr added a commit that referenced this pull request Dec 30, 2023
Removes "GestureEnabledButtons" ivar that became obsolete following
these commits:
* c5c6d6f ("BUG: Restore complex gesture support", 2023-01-29),
* 22eba9f ("BUG: Fix integration with updated Slicer event delegation and VTK OpenVR API (#131)", 2023-12-21)
* 0fa6102 ("BUG: Ensure handling of gesture triggers the "End" event", 2023-12-20)
* 512efe6 ("BUG: Do not report "Unrecognized device" if handling complex gesture", 2023-12-20)

For reference, it was originally introduced in 43bef4b ("ENH: Make trigger
button configurable", 2019-01-11).
@jcfr jcfr linked an issue Jan 12, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants