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.
Base class factory for state-graph nodes. Extends basenode with directional transition pins (N/E/S/W) for state-machine-style flowgraphs.
Public Functions
| Function | Signature | Returns | Description |
|---|---|---|---|
createBase | createBase(...) | state node instance | Creates a base node via basenode.createBase(...), then applies state-node methods from C and calls C:init(mgr) to set up transition pins. |
use | use(mgr, graph, forceId, derivedClass) | state node instance | Creates a base state node, overlays derived class fields, runs _preInit(), calls derived init() if overridden, then runs _postInit(). Standard factory for concrete state nodes. |
Transition Pin System
State nodes have 4 directional input and 4 directional output transition pins arranged around the node borders:
| Direction | Input Pin | Output Pin |
|---|---|---|
| North (N) | tInN | tOutN |
| East (E) | tInE | tOutE |
| South (S) | tInS | tOutS |
| West (W) | tInW | tOutW |
Transition pins are stored in self.transitionPins._in and self.transitionPins._out keyed by direction letter.
Key Methods
| Method | Description |
|---|---|
C:init(mgr) | Creates 8 transition pins (4 in, 4 out) using the flowgraph/pin module. Pins are of type "transition". |
C:customDrawEnd(builder) | Draws transition pin pivots around the node rectangle borders. Input pins use arrow indicators; output pins have no arrows. Uses ufe.PushStyleVar for pivot sizing. |
Usage Example
-- State nodes are typically created by the manager during deserialization
-- or via the flowgraph editor. Direct usage:
local baseStateNode = require('extensions/flowgraph/baseStateNode')
-- Create a derived state node
local MyState = {}
function MyState:init()
-- custom state initialization
end
function MyState:work()
-- state logic per frame
end
local node = baseStateNode.use(mgr, graph, nil, MyState)
-- node now has N/E/S/W transition pins on all 4 sidesPin Layout Drawing
-- Transition pins are drawn at node borders during customDrawEnd:
-- Input pins (with arrows): N=top-left, W=left-bottom, S=bottom-right, E=right-top
-- Output pins (no arrows): N=top-right, W=left-top, S=bottom-left, E=right-bottom
-- Link direction between state nodes is determined by relative position:
-- horizontal distance > vertical → E/W pins used
-- vertical distance > horizontal → N/S pins usedInheritance Chain
basenode.createBase(...) -- core node with pins, work/trigger, serialization
└─ baseStateNode.createBase(...) -- adds transition pins + custom drawing
└─ baseStateNode.use(...) -- mixes in derived state behaviorAdditional Exports
M.createBase- (undocumented)M.use- (undocumented)
See Also
- Flowgraph Base Module - Related reference
- Flowgraph Base Node - Related reference
- Flowgraph Node Builder - Related reference
- FlowGraph Guide - Guide
Flowgraph Base Node
Core base class for all flowgraph nodes. Defines the complete node lifecycle: initialization, pin management, work execution, drawing, serialization, and context menus. Every flowgraph node inherits f
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