KeyToggle

MacroModule
author Volker Dicken
package FMEwork/ReleaseMeVis
definition KeyToggle.def
see also SoToggle, SoKeyGrabber
keywords inventor, trigger, switch, show, hide, grab, event, handle, remote

Purpose

The KeyToggle macro is a one-module solution for interactive key bindings to toggle things like overlays. It is just a tiny convenience macro that combines a SoToggle with a SoKeyGrabber.

Usage

The default use case is to: * Instantiate a new KeyToggle module * Drop it on top of an inventor connection, letting the connection split up and go through the first input (child) * Configure the key in the panel (for instance, “O”) * Rename the model (e.g., to “Toggle_O_verlay”) to document the key and its mnemonic

Nowadays, the network panel’s description reveals the shortcut, but the above suggestion also gives the mnemonic that helps remembering the shortcut without looking at the network, and it also gives more meaningful names to modules instead of KeyToggle2, KeyToggle4 and so on.

Interaction

Possibly the most important use case is when assessing segmentation results (contours or masks), where it is extremely important to be able to disable overlays in order to see the underlying image data. Here, toggling works much better than a side-by-side view of the image and the segmentation, because they’re in the same place. (And toggling by key is again much better than toggling using the mouse, because one does not have to move the eyes in order to follow the pointer, and multiple fingers / keys can toggle different things very efficiently.)

Tips

Sometimes, the above method of toggling a subgraph of the inventor scene does not work. However, the KeyToggle macro can still be very convenient for toggling options like the rendering of WEM edges: Instead of using toggling child scenes, just connect On or off to boolean fields of other modules.

Windows

Default Panel

../../../Modules/Macros/KeyToggle/mhelp/Images/Screenshots/KeyToggle._default.png

Input Fields

child

name: child, type: SoNode

Only used when On is true

direct

name: direct, type: SoNode

Always used when Enable is true

Output Fields

self

name: self, type: SoNode

Parameter Fields

Field Index

<alt>: Bool On: Bool
<ctrl>: Bool Shift Pressed: Bool
<shift>: Bool Switch on: Enum
Alt Pressed: Bool  
Ctrl Pressed: Bool  
Enable: Bool  
Key Pressed: Trigger  
off: Bool  

Visible Fields

Enable

name: enable, type: Bool, default: TRUE

Completely enables / disables the module, disconnecting both inputs and the keygrabber from the output scene

On

name: on, type: Bool, default: FALSE

Toggled via the selected key (Switch on)

Switch on

name: listenKey, type: Enum, default: KEY_DELETE

Values:

Title Name
Any ANY
Left Shift LEFT_SHIFT
Right Shift RIGHT_SHIFT
Left Control LEFT_CONTROL
Right Control RIGHT_CONTROL
Left Alt LEFT_ALT
Right Alt RIGHT_ALT
Number 0 NUMBER_0
Number 1 NUMBER_1
Number 2 NUMBER_2
Number 3 NUMBER_3
Number 4 NUMBER_4
Number 5 NUMBER_5
Number 6 NUMBER_6
Number 7 NUMBER_7
Number 8 NUMBER_8
Number 9 NUMBER_9
A A
B B
C C
D D
E E
F F
G G
H H
I I
J J
K K
L L
M M
N N
O O
P P
Q Q
R R
S S
T T
U U
V V
W W
X X
Y Y
Z Z
Home HOME
Left Arrow LEFT_ARROW
Up Arrow UP_ARROW
Right Arrow RIGHT_ARROW
Down Arrow DOWN_ARROW
Page Up PAGE_UP
Page Down PAGE_DOWN
Prior PRIOR
Next NEXT
End END
Pad Enter PAD_ENTER
Pad F1 PAD_F1
Pad F2 PAD_F2
Pad F3 PAD_F3
Pad F4 PAD_F4
Pad 0 PAD_0
Pad 1 PAD_1
Pad 2 PAD_2
Pad 3 PAD_3
Pad 4 PAD_4
Pad 5 PAD_5
Pad 6 PAD_6
Pad 7 PAD_7
Pad 8 PAD_8
Pad 9 PAD_9
Pad Add PAD_ADD
Pad Subtract PAD_SUBTRACT
Pad Multiply PAD_MULTIPLY
Pad Divide PAD_DIVIDE
Pad Space PAD_SPACE
Pad Tab PAD_TAB
Pad Insert PAD_INSERT
Pad Delete PAD_DELETE
Pad Period PAD_PERIOD
F1 F1
F2 F2
F3 F3
F4 F4
F5 F5
F6 F6
F7 F7
F8 F8
F9 F9
F10 F10
F11 F11
F12 F12
Backspace BACKSPACE
Tab TAB
Return RETURN
Enter ENTER
Pause PAUSE
Scroll Lock SCROLL_LOCK
Escape ESCAPE
Key Delete KEY_DELETE
Print PRINT
Insert INSERT
Right Super RIGHT_SUPER
Num Lock NUM_LOCK
Caps Lock CAPS_LOCK
Shift Lock SHIFT_LOCK
Left Super LEFT_SUPER
Space SPACE
Exclam EXCLAM
Quotedbl QUOTEDBL
Numbersign NUMBERSIGN
Dollar DOLLAR
Percent PERCENT
Ampersand AMPERSAND
Apostrophe APOSTROPHE
Parenleft PARENLEFT
Parenright PARENRIGHT
Asterisk ASTERISK
Plus PLUS
Comma COMMA
Minus MINUS
Period PERIOD
Slash SLASH
Colon COLON
Semicolon SEMICOLON
Less LESS
Equal EQUAL
Greater GREATER
Question QUESTION
At AT
Bracketleft BRACKETLEFT
Backslash BACKSLASH
Bracketright BRACKETRIGHT
Asciicircum ASCIICIRCUM
Underscore UNDERSCORE
Grave GRAVE
Braceleft BRACELEFT
Bar BAR
Braceright BRACERIGHT
Asciitilde ASCIITILDE

<shift>

name: needShift, type: Bool, default: FALSE

<ctrl>

name: needCtrl, type: Bool, default: FALSE

<alt>

name: needAlt, type: Bool, default: FALSE

Key Pressed

name: keyPressed, type: Trigger, persistent: no

Shift Pressed

name: shiftPressed, type: Bool, persistent: no

Ctrl Pressed

name: ctrlPressed, type: Bool, persistent: no

Alt Pressed

name: altPressed, type: Bool, persistent: no

Hidden Fields

off

name: off, type: Bool, persistent: no

Opposite of On, in case several things should be toggled to opposite boolean values