keymap_set
Replaces the viewport's key bindings whole. Each binding maps a chord ({ key, code?, mod?, shift?, alt? }; modifiers true, false or "any") to an action: tool:<id>, delete, nudge-left|right|up|down, resize-left|right|up|down (2D: the selection box's right or bottom edge by the nudge's step, left and top staying), rotate-cw|ccw (2D: 1°, Shift 15°, about the box's centre), frame-selection, frame-all, deselect-all, or the navigation tool's navigate.fit|fit-all|reset|projection, navigate.view.front|back|left|right|top|bottom|iso, navigate.orbit.<dir>, navigate.pan.<dir> (left, right, up, down), navigate.zoom.in|out, navigate.fly.slower|faster, navigate.fly.forward|back|left|right|up|down, and in 3D level:object|face|edge|point, toggle-through (Alt+Z), cycle-next and cycle-previous (Tab and Shift+Tab: the candidates under the pointer) and select-all (Ctrl/Cmd+A). Letters match key, or code while Alt is held; a code on any other key matches on code alone (numpad keys). An unbound key reaches the host. pointerModifiers, when present, replaces the pointer roles whole (absent: unchanged; a role left out takes its default): select.deep (2D: a press selects the hit shape itself), select.add, select.toggle, marquee.add, marquee.toggle, snap.bypass (2D: a drag, resize or pen point skips snapping), each 'shift', 'ctrl', 'alt', 'mod' (Cmd on macOS, else Ctrl) or 'none' (unbound). Defaults: 2D select.deep mod, select.toggle and marquee.add shift, snap.bypass alt; 3D select.add and marquee.add shift, select.toggle and marquee.toggle mod. invalid_params, changing nothing, for a role the viewport has no behaviour for set to anything but 'none' (2D select.add and marquee.toggle, 3D select.deep and snap.bypass), two select.* or two marquee.* roles on one key of the viewport's platform, and a 3D marquee.* role on the marquee's start key (tool_set's marqueeModifier, Alt by default).
Usage
surface.execute('keymap_set', { bindings, pointerModifiers?, viewport? })Parameters
bindingsobject[]pointerModifiersobjectviewportstringthe host's viewport id; default: the engine's first viewport
Returns
object, in the ok: true envelope.
{
"type": "object",
"properties": {}
}