Flowgraph Node Builder
ImGui node builder that handles the visual layout and rendering of flowgraph nodes. Manages node stages (begin → header → content → input → middle → output → end), pin layout, and header texture rende
ImGui node builder that handles the visual layout and rendering of flowgraph nodes. Manages node stages (begin → header → content → input → middle → output → end), pin layout, and header texture rendering.
No public module exports - used internally by node drawing code.
Purpose
The builder orchestrates the ImGui draw calls for each flowgraph node. It tracks the current drawing stage, measures pin widths, renders headers with gradient textures, and provides debug rect overlays.
Class (C) - Key Methods
| Method | Signature | Description |
|---|---|---|
init | () | Sets up default style: node rounding, padding, loads header texture from art/imgui_node_header_alt.png. |
Begin | (nodeID) | Starts drawing a node. Pushes node padding style, begins the node editor node, sets stage to 'begin'. |
End | (node) | Finishes drawing: calls customDrawEnd if present, renders header gradient texture, draws debug rects if enabled, pops styles. |
Header | (color) | Stores header color and transitions to 'header' stage. |
EndHeader | () | Transitions to 'content' stage. |
Middle | () | Sets drawing stage for the center content area between pins. |
Input | (pin) | Handles input pin layout. Transitions from 'begin' to 'content' if needed. |
Output | (pin) | Handles output pin layout and alignment. |
SetStage | (stage) | Manages stage transitions: invalid → begin → header → content → input → middle → output → end. |
makeAlignmentPin | (pin) | Draws a hidden alignment pin for nodes with no visible input pins. |
expectOutPinWidth | (width) | Pre-registers expected output pin width for alignment. |
setExpectedHeaderSize | (width) | Records expected header text width for behavior icon placement. |
Drawing Stages
begin → header → content → input → middle → output → end → invalidEach stage configures ImGui cursor positions, spring layouts, and pin editor directives.
Rect Tracking
| Property | Type | Description |
|---|---|---|
NodeRect | rect | Bounding rectangle of the entire node. |
HeaderRect | rect | Bounding rectangle of the header area. |
ContentRect | rect | Bounding rectangle of the content area (pins + middle). |
-- Rect structure created by createRect():
local rect = {
x = minR.x, y = minR.y,
w = maxR.x - minR.x, h = maxR.y - minR.y,
top_left = function() ... end,
bottom_right = function() ... end,
}Header Rendering
-- Header gradient is drawn as a rounded image on the node background draw list:
im.ImDrawList_AddImageRounded(drawList, self.headerTexture.texId,
headerTopLeft, headerBottomRight,
im.ImVec2(0, 0), uv,
im.GetColorU322(self.HeaderColor),
nodeRounding, 3) -- top corners onlyConstruction
-- Created via require, returns a constructor function:
local createBuilder = require('/lua/ge/extensions/flowgraph/builder')
local builder = createBuilder() -- calls C:init()Additional Exports
EndInput()
BeginPinDynamic(pin)
- pin -
any
EndPinDynamic(pin)
- pin -
any
EndOutput()
EndPin()
See Also
- Flowgraph Base Module - Related reference
- Flowgraph Base State Node - Related reference
- Flowgraph Base Node - Related reference
- FlowGraph Guide - Guide
Flowgraph Base State Node
Base class factory for state-graph nodes. Extends `basenode` with directional transition pins (N/E/S/W) for state-machine-style flowgraphs.
Flowgraph Graph
Core graph class that holds nodes, links, and pins for a single flowgraph. Manages node creation/deletion, execution planning, variable storage, and serialization. Each manager contains one or more gr