From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

NDOF Devices

Two new event types will be added for handlers to listen for. These can be used in key maps, UI handlers, modal operators, etc.

NDOFMOTION

  • Sent every event cycle that an NDOF device is in use (away from its 'at rest' position)
  • Includes customdata:
    • Axis data:
      • move_x, move_y, move_z
Each of these contains the amount to move for each axis. These normally range from -1.0 to +1.0, meaning 100% left/right, forward/back, up/down. 0.0 means at rest. These values are allowed to exceed 100% if the user has set a high sensitivity.
      • rotate_x, rotate_y, rotate_z
These 3 values form a single vector representing a rotation in 3D. These are not Euler angles! Use the 'xyz_to_angleaxis' function to get this rotation data in a more familiar format.

It's the role of the operator to keep track of whether an ndof device has been moved since the last NDOFMOTION event was sent. This is similar to mouse handling, operators currently store last_x, last_y events or similar, used to determine whether to update or not.

NDOFBUTTON1, NDOFBUTTON2, ... NDOFBUTTON16

  • Sent when a button on an NDOF device is used. Note that the more common SpaceNavigator devices have only 2 buttons.
  • Uses similar event values to mouse buttons:
    • KM_PRESS, KM_RELEASE, KM_CLICK, etc.

Example

Retrieving ndof motion for using in a modal operator:

insert sample code here