Flowgraph Link
Represents a connection between two pins in a flowgraph graph. Handles link initialization, drawing (including flow animation markers), tooltips, serialization, and quick-access conversion.
Represents a connection between two pins in a flowgraph graph. Handles link initialization, drawing (including flow animation markers), tooltips, serialization, and quick-access conversion.
No public module exports - instantiated via constructor function returned by require.
Purpose
Links connect a source output pin to a target input pin. They:
- Wire pin values so
targetNode.pinIn[name]reads fromsourcePin - Track flow state for animated flow markers in the editor
- Support hiding (shortcut display) and disabling
- Handle state-graph directional routing (N/E/S/W transition pins)
Class (C) - Key Methods
| Method | Signature | Description |
|---|---|---|
init | (graph, sourcePin, targetPin) | Allocates two IDs (main + hidden highlight), wires the target pin to read from source pin, registers in graph's links table, notifies both pins and nodes of the new link, sets color based on pin type. |
draw | () | Renders the link line with type-colored styling. For flow/state pins, shows animated flow markers when active. For state links, routes through directional transition pins. Draws tooltip on hover. |
drawLinkTooltip | () | Shows source pin type icon and current value on hover. |
drawLabel | (sPin, tPin) | Draws a text label at the midpoint between two state transition pins. |
getDirPins | () | Determines compass directions (N/E/S/W) between source and target nodes based on relative position. |
doFlow | () | Queues a flow animation for next draw. |
showContextMenu | (menuPos) | Context menu with Toggle Hide, Delete, and debug ID display. |
convertToQuickAccess | () | Converts the link into quick-access pins (hidden link with named aliases) and deletes the visual link. |
__onSerialize | () | Returns {sourceNodeId, sourcePinName, targetNodeId, targetPinName, hidden}. |
__onDeserialized | (data) | Restores hidden state from serialized data. |
Link Properties
| Property | Type | Description |
|---|---|---|
id | number | Primary link ID for drawing and selection. |
hiddenId | number | Secondary ID for highlight overlay rendering. |
sourcePin | pin | Output pin this link reads from. |
targetPin | pin | Input pin this link writes to. |
sourceNode | node | Node owning the source pin. |
targetNode | node | Node owning the target pin. |
color | ImVec4 | Link color derived from pin type (impulse/chainFlow override). |
hidden | bool | If true, drawn as a shortcut (abbreviated) link. |
disabled | bool | If true, link is inactive. |
label | string | Text label for state transition links. |
Flow Animation
-- Flow markers animate along the link when:
-- For flow/state pins: source pin has value AND target node was used this frame
-- For data pins: source pin was used this frame
-- Animation speed: 30 units/sec (0 when paused)
-- Marker distance: 40px (flow) or 10px (data)
-- Duration: 0.5 secondsConstruction
-- link.lua returns a constructor function:
local createLink = require('/lua/ge/extensions/flowgraph/link')
local link = createLink(graph, sourcePin, targetPin)
-- Automatically registers in graph.links and wires pinInPin Wiring
-- On link creation, the target node's pinIn is wired:
rawset(self.targetNode.pinIn, targetPin.name, sourcePin)
-- For flow pins, multiple sources are tracked:
self.targetNode._mInFlow[targetPin.name] = { sourcePin1, sourcePin2, ... }Serialization Format
-- Compact array format:
{ sourceNodeId, sourcePinName, targetNodeId, targetPinName, hidden_or_nil }See Also
- Flowgraph Base Module - Related reference
- Flowgraph Base State Node - Related reference
- Flowgraph Base Node - Related reference
- FlowGraph Guide - Guide
Flowgraph Group Helper
Helper class for grouping and ungrouping nodes in the flowgraph editor. Handles converting selected nodes into subgraphs, computing bounding rectangles, centering node layouts, and managing link re-ro
Flowgraph Manager
Top-level controller for a single flowgraph project. Manages multiple graphs (parent-child hierarchy), unique ID allocation, execution lifecycle (start/stop/pause), editor integration, node selection,