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: Do not report "Unrecognized device" if handling complex gesture #135

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions VirtualReality/MRML/vtkVirtualRealityViewInteractor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ vtkVirtualRealityViewInteractor::~vtkVirtualRealityViewInteractor()
{
}

//------------------------------------------------------------------------------
vtkCommand::EventIds vtkVirtualRealityViewInteractor::GetCurrentGesture() const
{
return this->CurrentGesture;
}

//------------------------------------------------------------------------------
void vtkVirtualRealityViewInteractor::HandleComplexGestureEvents(vtkEventData* ed)
{
Expand Down
6 changes: 6 additions & 0 deletions VirtualReality/MRML/vtkVirtualRealityViewInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class VTK_SLICER_VIRTUALREALITY_MODULE_MRML_EXPORT vtkVirtualRealityViewInteract

virtual void SetInteractorStyle(vtkInteractorObserver*) override;

/// Return the identifier of the complex gesture being handled.
/// \sa HandleComplexGestureEvents(), RecognizeComplexGesture()
/// \sa vtkVirtualRealityViewInteractorStyle::OnStartGesture()
/// \sa vtkVirtualRealityViewInteractorStyle::OnEndGesture()
vtkCommand::EventIds GetCurrentGesture() const;

///@{
/// Define Slicer specific heuristic for handling complex gestures.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "vtkVirtualRealityViewInteractorObserver.h"

// SlicerVirtualReality includes
#include "vtkVirtualRealityViewInteractor.h"
#include "vtkVirtualRealityViewInteractorStyle.h"

// MRML includes
Expand Down Expand Up @@ -222,6 +223,9 @@ bool vtkVirtualRealityViewInteractorObserver::DelegateInteractionEventDataToDisp
vtkRenderer* currentRenderer = this->GetInteractorStyle()->GetCurrentRenderer();
ed->SetRenderer(currentRenderer);

vtkVirtualRealityViewInteractor* vrViewInteractor =
vtkVirtualRealityViewInteractor::SafeDownCast(this->GetInteractor());

std::string interactionContextName;
if (ed->GetDevice() == vtkEventDataDevice::LeftController)
{
Expand All @@ -235,8 +239,9 @@ bool vtkVirtualRealityViewInteractorObserver::DelegateInteractionEventDataToDisp
{
interactionContextName = "HeadMountedDisplay";
}
else
else if (vrViewInteractor && vrViewInteractor->GetCurrentGesture() == vtkCommand::NoEvent)
{
// Report an error message only if the interactor is not processing a complex gesture.
vtkErrorMacro("DelegateInteractionEventDataToDisplayableManagers: Unrecognized device");
}
ed->SetInteractionContextName(interactionContextName);
Expand Down