API ReferenceGE ExtensionseditortoolUtilities
Editor Tool Utilities – Ribbon Input
Handles mouse and keyboard interaction for ribbon splines (paired L-R node structures). Supports adding node pairs, dragging nodes, deleting pairs, gizmo control, and cursor-segment tracking.
Handles mouse and keyboard interaction for ribbon splines (paired L-R node structures). Supports adding node pairs, dragging nodes, deleting pairs, gizmo control, and cursor-segment tracking.
Public API
| Function | Signature | Description |
|---|---|---|
M.handleRibbonEvents | (ribbons, out, useGizmo, isRigidTranslation, masterDepth, updateRibbonDataFn, deepCopyFn, undoFn, redoFn) → bestCursorSeg, isNodeDrag | Main per-frame event handler for ribbon editing: node pair placement, drag, delete, gizmo toggle |
Code Examples
local ribbonInput = require('editor/toolUtilities/ribbonInput')
-- Per-frame ribbon event handling
-- out = { ribbonIdx = 1, nodeIdx = 1, isGizmoActive = false }
local bestSeg, isDragging = ribbonInput.handleRibbonEvents(
ribbons, -- array of ribbon tables
out, -- shared state table (updated in-place)
true, -- use gizmo (ALT toggles)
false, -- not rigid translation
1.0, -- default depth for new pairs
updateRibbonData, -- callback to recompute ribbon geometry
deepCopyAllRibbons, -- deep copy all ribbon state
undoCallback, -- undo callback
redoCallback -- redo callback
)
-- Interaction model:
-- Left click on free space → places left node of a new pair
-- Left click again → places right node, completes pair insertion
-- Right click → cancels left node placement
-- Left click + drag on node → drags the node
-- Delete key → removes the node pair (left + right together)
-- ALT key → toggles translation gizmo
-- The function automatically handles:
-- - Smart pair insertion (beginning, end, or middle of ribbon)
-- - Intersection detection to determine correct L-R ordering
-- - Cursor segment tracking with neighbor + random search
-- - Undo/redo commit on add/drag/delete
-- - Markup display with delayed text appearanceSee Also
- Tool Utilities - Fit Polyline - Related reference
- Editor Tool Utilities – Geometry - Related reference
- Editor Tool Utilities – Gizmo - Related reference
- World Editor Guide - Guide