API ReferenceGE Extensionseditorflowgraph
Flowgraph Node Library
The node library window and context menu for browsing, searching, and creating flowgraph nodes, variables, macros, and states.
The node library window and context menu for browsing, searching, and creating flowgraph nodes, variables, macros, and states.
Overview
fg_nodelibrary is the primary interface for finding and placing nodes into flowgraph graphs. It serves double duty: as a standalone dockable window and as the background context menu in the graph canvas. Features include frecency-weighted search, pin-compatible filtering, tree view browsing, variable get/set creation, macro insertion, state creation, drag-and-drop, and keyboard arrow navigation.
Class Fields
| Field | Type | Description |
|---|---|---|
C.windowName | string | 'fg_nodelib' |
C.windowDescription | string | 'Node library' |
C.arrowControllable | bool | true |
Class Methods
| Method | Description |
|---|---|
C:init() | Registers window, initializes search utility and frecency data |
C:clear() | Reset search text, filters, and scroll position |
C:setNewNodeLinkPin(pin) | Set the pin being dragged for compatible filtering |
C:draw() | Draws the standalone node library window |
C:drawContent(menuPos, usedForContextMenu) | Main content: search bar + results or tree |
C:drawTextFilter(usedForContextMenu) | Search input with clear and paste buttons |
C:drawContentAsTreeNodes(menuPos) | Tree view: nodes, variables, macros, states |
C:displayResults(menuPos) | Renders frecency-scored search results |
C:displayNode(dir, menuPos, name, node) | Renders a single node entry |
C:displayVariable(var, menuPos, read, fromMgr) | Renders a get/set variable entry |
C:displayMacro(name, macro, menuPos) | Renders a macro entry |
C:displayStateTemplate(dir, menuPos, name, state) | Renders a state template entry |
C:createNodeFromButon(menuPos, node) | Creates a node and auto-links to dragged pin |
C:createVariableButton(var, menuPos, read, fromMgr) | Creates get/set variable node |
C:createStateButton(menuPos, state) | Creates a state from template |
C:linkState(node) | Links newly created state to dragged pin |
C:pinsFilter(node) | Check if node has compatible pins for filtering |
C:filterTemplates(filterPins, mode) | Filter node templates by pin compatibility |
C:filterMacroTemplates(filterPins) | Filter macro templates |
C:findFlowNodes() | Search query for regular flow nodes |
C:findStateNodes() | Search query for state nodes |
C:navigateList(up) | Keyboard arrow navigation |
C:createNode() | Confirm selection of current highlighted item |
C:highlightText(label, highlight) | Render text with highlighted search matches |
C:ratePinSimilarity(a, b) | Score pin compatibility for auto-linking |
Search Features
- Frecency: Combines frequency + recency of node usage
- Tag matching: Searches node tags at 75% weight
- Pin filtering: When dragging a link, only compatible nodes shown
- Type prefix:
node:,graph:,pin:to filter by type - Keyboard: Arrow keys navigate, Enter creates selected node
Usage Example
-- The node library is used both as a window and context menu
-- Creating a node programmatically:
local node = mgr.graph:createNode("types/getVariable")
ui_flowgraph_editor.SetNodePosition(node.id, position)
node:alignToGrid()
node:setGlobal(true)
node:setVar("myVariable")Additional Class Methods
| Method | Description |
|---|---|
C:hasFoldersOnly(dir) | Recursively checks if a directory contains only folders (no nodes) |
C:setStatic() | Marks the library as static mode |
C:variablePinFilter(var, dir) | Check if a variable is compatible with the dragged pin |
C:getFilterType() | Parse search prefix (node:/graph:/pin:) from search text |
C:findVar(source, sourceName, sourceNameTag) | Add variables from a source to the search index |
C:filterNodes(dir, filterPins, mode) | Recursively filter node templates by pin compatibility |
C:checkEmpty(dir, mode) | Mark directory branches as empty if no matching nodes |
C:filterMacros(dir, filterPins) | Filter macro templates by name |
C:refreshMacro() | Refresh macro list when new macros are added |
C:refreshStateTemplates() | Refresh and sort state templates |
C:displayDir(dir, menuPos, elementFieldName, elementFunction) | Recursively render a directory tree with elements |
C:displaySimpleElement(menuPos, text, clickFn, ...) | Render a generic clickable bullet item |
C:displayStateExitButton(menuPos, label) | Render a state exit button entry |
C:arrowHelper(cursor, itemSize, doHover, hoverFun) | Keyboard arrow navigation with selection/hover highlighting |
C:printNodesWithTags() | Export all nodes to nodeLib.csv and pins to pinLib.csv (debug) |
C:printDir(dir, name, tagIndex, libtxt) | Helper for CSV export of node directory |
C:recursiveGetTags(dir, list, pins) | Recursively collect all tags and pin schemas |
See Also
- Flowgraph Base Window - Related reference
- Flowgraph Events - Related reference
- Flowgraph Examples - Related reference
- World Editor Guide - Guide