SoInteractionMappingYAML¶
-
MacroModule
¶ author Florian Link
package FMEwork/ReleaseMeVis
definition SoInteractionMappingYAML.def see also SoInteractionMapping
keywords managed
,interaction
,override
Purpose¶
The SoInteractionMappingYAML
allows to configure/override managed interactions via a YAML configuration.
Internally, it makes use of the SoInteractionMapping
standard module, but it avoids the cryptic syntax
of that module.
The following actions can be configured:
- PointingActions
- actions that can be bound to mouse buttons
- OffsetActions
- actions that can be bound to mouse/wheel and key presses
- CommandActions
- commands that can be triggered by key presses
PointingActions¶
Pointing actions can be mapped to the mouse buttons.
The full syntax for configuring a PointingAction is:
moduleName.actionName:
type: PointingAction
enabled: [true|false] # default: true
trigger: [shift+][ctrl+][alt+][button1][button2][button3]
ignore: [shift][ctrl][alt][button1][button2][button3][all][buttons][modifiers] # default: empty
triggers:
- trigger: [shift+][ctrl+][alt+][button1][button2][button3]
ignore: [shift][ctrl][alt][button1][button2][button3][all][buttons][modifiers]
...
keepDefaults: [true|false] # default: false
Separators for trigger are “+”,”-” and space. Separators for ignore are “,” and space. There can either be a single trigger and ignore, or there can be a list of triggers, where each trigger as a trigger and ignore config. Mouse buttons are:
- button1: left button
- button2: middle button
- button3: right button
The buttons also have the aliases:
- button1: left_button
- button2: middle_button
- button3: right_button
Use the aliases if you prefer them.
The following shows a simple example:
slicer.SoView2DSliceAction:
type: PointingAction
trigger: button3
ignore: all
# same but more verbose:
# ignore: shift,ctrl,alt,button1,button2
It maps the slicer.SoView2DSliceAction to button3 and ignores all modifier keys and all buttons. Note that “all” in ignore is a shortcut which automatically ignores all modifiers/buttons that are not used in the trigger. You can also specify them manually in the ignore. You can also use modifiers to ignore all unused modifier keys or buttons to ignore all other buttons.
If it should NOT ignore the modifier keys and other button states, it would look like this:
slicer.SoView2DSliceAction:
type: PointingAction
trigger: button3
Note that the default triggers are removed by default, so the action will only be available on button3. If you want to keep the default trigger bindings, you can write:
slicer.SoView2DSliceAction:
type: PointingAction
trigger: button3
keepDefaults: true
The following shows an example where multiple triggers are configured:
slicer.SoView2DSliceAction:
type: PointingAction
triggers:
- trigger: button1
ignore: shift,ctrl,alt
- trigger: button2
ignore: shift,ctrl,alt
- trigger: button3
ignore: shift,ctrl,alt
OffsetActions¶
Offset actions can be mapped to the mouse buttons, mouse wheel and keys.
The full syntax for configuring a OffsetAction is:
moduleName.actionName:
type: OffsetActions
enabled: [true|false] # default: true
trigger: [shift+][ctrl+][alt+][button1][button2][button3][wheel][KEYNAME1/KEYNAME2]
ignore: [shift][ctrl][alt][button1][button2][button3][all][buttons][modifiers] # default: empty
swap: [true|false] # default: false
sensitivity: FLOAT # default: 1.0
sensitivityY: FLOAT # default: 1.0
triggers:
- trigger: [shift+][ctrl+][alt+][button1][button2][button3][wheel][KEYNAME1/KEYNAME2]
ignore: [shift][ctrl][alt][button1][button2][button3][all][buttons][modifiers]
swap: [true|false] # default: false
sensitivity: FLOAT # default: 1.0
sensitivityY: FLOAT # default: 1.0
...
keepDefaults: [true|false] # default: false
Separators for trigger are “+”,”-” and space. Separators for ignore are “,” and space. There can either be a single trigger and ignore, or there can be a list of triggers, where each trigger as a trigger and ignore config.
The trigger can be:
- the mouse buttons
- button1,button2,button3
- the mouse wheel
- wheel
- two keys
- KEYNAME1/KEYNAME2, e.g. LEFT/RIGHT or A/B, see keynames in CommandAction section.
The following shows a simple example, it maps the slicer.SoView2DSliceOffsetAction to the mouse wheel and requires all modifier keys to be released:
slicer.SoView2DSliceOffsetAction:
type: OffsetAction
trigger: wheel
This maps the offset action to the LEFT and RIGHT cursor keys:
slicer.SoView2DSliceOffsetAction:
type: OffsetAction
trigger: LEFT/RIGHT
And the following shows a more advanced config with sensitivity and axes swap:
slicer.SoView2DSliceOffsetAction:
type: OffsetAction
trigger: button1
swap: true
sensitivity: 4.5
sensitivityY: 6.5
As with PointingActions, you can also have multiple triggers:
slicer.SoView2DSliceOffsetAction:
type: OffsetAction
triggers:
- trigger: button1
swap: true
sensitivity: 4.5
sensitivityY: 6.5
- trigger: wheel
- trigger: LEFT/RIGHT
CommandActions¶
Command actions can be mapped to keys.
The full syntax for configuring a CommandActions is:
moduleName.actionName:
type: CommandActions
enabled: [true|false] # default: true
key: [shift+][ctrl+][alt+][KEYNAME]
keys:
- [shift+][ctrl+][alt+][KEYNAME]
- ...
keepDefaults: [true|false] # default: false
There can be either a single key or a list of keys that trigger the command. By default, the default key bindings are removed, but you can keep them by setting keepDefaults to true.
Key names (KEYNAME)¶
Key names can be used in Command and Offset actions. They can be prefixed by any of the “Ctrl+”,”Alt+”,”Shift+” modifiers.
The following names are available:
- A-Z (normal A-Z letter keys)
- NUMBER_0
- NUMBER_1
- NUMBER_2
- NUMBER_3
- NUMBER_4
- NUMBER_5
- NUMBER_6
- NUMBER_7
- NUMBER_8
- NUMBER_9
- HOME
- LEFT_ARROW
- UP_ARROW
- RIGHT_ARROW
- DOWN_ARROW
- PAGE_UP
- PAGE_DOWN
- PRIOR
- NEXT
- END
- PAD_ENTER
- PAD_F1
- PAD_F2
- PAD_F3
- PAD_F4
- PAD_0
- PAD_1
- PAD_2
- PAD_3
- PAD_4
- PAD_5
- PAD_6
- PAD_7
- PAD_8
- PAD_9
- PAD_ADD
- PAD_SUBTRACT
- PAD_MULTIPLY
- PAD_DIVIDE
- PAD_SPACE
- PAD_TAB
- PAD_INSERT
- PAD_DELETE
- PAD_PERIOD
- F1
- F2
- F3
- F4
- F5
- F6
- F7
- F8
- F9
- F10
- F11
- F12
- BACKSPACE
- TAB
- RETURN
- ENTER
- PAUSE
- SCROLL_LOCK
- ESCAPE
- KEY_DELETE
- INSERT
- RIGHT_SUPER
- NUM_LOCK
- CAPS_LOCK
- SHIFT_LOCK
- LEFT_SUPER
- SPACE
- EXCLAM
- QUOTEDBL
- NUMBERSIGN
- DOLLAR
- PERCENT
- AMPERSAND
- APOSTROPHE
- PARENLEFT
- PARENRIGHT
- ASTERISK
- PLUS
- COMMA
- MINUS
- PERIOD
- SLASH
- COLON
- SEMICOLON
- LESS
- EQUAL
- GREATER
- QUESTION
- AT
- BRACKETLEFT
- BACKSLASH
- BRACKETRIGHT
- ASCIICIRCUM
- UNDERSCORE
- GRAVE
- BRACELEFT
- BAR
- BRACERIGHT
- ASCIITILDE