Managed Interaction

Introduction

Managed Interaction is a framework for handling interactions - mouse gestures, keyboard presses, etc. - that was introduced to the OpenInventor framework in the MeVisLab context. It builds on the conventional input event handling system and replaces it with more abstract interaction objects. This way it tries to solve some of the shortcomings of conventional event handling:

  • It protects against the involuntary use of the same input event by different entities through a shared controller object.
  • It provides proper phase handling for mouse dragging gestures.
  • It handles the display of the correct cursor shape for mouse actions in an easy way.
  • It allows to discover the provided interactions in an Inventor scene.
  • It allows to override the mouse/keyboard binding of these interactions at a central location.

To achieve this discrete interactions are encapsulated into interaction objects. There are currently three different types of interactions:

  • Pointing actions (class SoPointingAction) represent mouse dragging actions, i.e., the action of pressing a mouse button at one position, moving the mouse to another position, and releasing the mouse button again. This could conceivably also be achieved with a different input device, therefore the more generic name.
  • Command actions (class SoCommandAction) may be bound to a keyboard shortcut, but could, e.g., also be triggered from a context menu. They simply represent a trigger without any parameters.
  • Offset actions (class SoOffsetAction) take a numeric offset value in one or two directions. They are most naturally mapped to the rotation of the mouse wheel, but can also be mapped to keyboard shortcuts or even mouse button dragging. A mapping to a joystick is also conceivable but currently not supported. Since only a relative offset is passed to this type of actions each input mapping may have a different sensitivity value.

Each interaction type can be enabled or disabled. Disabled interactions can be discovered but do not react on input events.

Each interaction also has an identifying name. This name consists of the ID of the Inventor node providing this interaction (usually the name of the node, but this can be overridden), and the individual ID of the interaction, separated by a dot from its provider’s ID. This name is, e.g., used to centrally override the input mappings for interactions.

Using Managed Interaction

Not all Inventor modules in MeVisLab support Managed Interaction yet. Besides it being some work to switch to a Managed Interaction implementation, there are also some backwards compatibility considerations, since the rigidly defined approach of Managed Interaction does not allow to emulate every quirk of an old classic-event-handling based implementation. That is also the reason why some modules have a useManagedInteraction flag to switch to the new behavior.

Note

There is also the caveat that mixing Managed Interaction and classic style modules invalidates some of the guarantees that Managed Interaction normally gives: That only one interaction can ever react to an input, and that the methods of a SoPointingAction are called in a defined order.

Some of the main modules to support Managed Interaction are listed here:

Documentation for C++ developers

If you want to implement managed interactions for your own Inventor node, have a look at the documentation in the toolbox reference:

SoManagedInteraction Overview