RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraph

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

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-routing during group/ungroup operations.

No public module exports - instantiated by the flowgraph manager.


Purpose

When users select multiple nodes and choose "Create Subgraph" or "Ungroup", this helper:

  1. Computes bounding rectangles for node selections
  2. Classifies links as internal, incoming, or outgoing
  3. Creates I/O boundary nodes for subgraph interfaces
  4. Re-routes links through subgraph entry/exit points
  5. Centers nodes within their new graph context

Class (C) - Key Methods

MethodSignatureDescription
init(mgr)Stores manager reference.
getRectCenter(nodes)Computes the bounding rectangle {minX, minY, maxX, maxY} and center point of a set of nodes.
centerNodes(nodes, pos)Repositions nodes so their collective center aligns with pos, snapping to grid.
centerMultiNodes(fixNodes, moveNodes)Centers moveNodes around the center of fixNodes.
ungroupSelection()Dissolves a subgraph node, moving its child nodes back into the parent graph and re-routing links.

Internal Functions

FunctionDescription
getEntryExitNode(graph)Finds the stateEntry and stateExit nodes in a state graph.
sortLinks(nodeIds, graph)Classifies all links in a graph into inLinks (entering the selection), middleLinks (internal), and outLinks (leaving the selection).

Grouping Flow

Selected Nodes in Parent Graph
         │
         ▼
    getRectCenter() → bounding rect + center
         │
         ▼
    sortLinks() → classify in/middle/out links
         │
         ▼
    Create child graph with:
    - Selected nodes (moved)
    - I/O boundary nodes for external connections
    - Internal links preserved
    - External links re-routed through I/O nodes
         │
         ▼
    Create "macro/integrated" node in parent graph
    representing the subgraph

Usage Context

-- The group helper is accessed through the manager:
local mgr = core_flowgraphManager.getManager(id)
mgr.groupHelper:getRectCenter(selectedNodes)

-- Grouping is typically triggered from node context menus:
-- Right-click → Create Subgraph...
-- Right-click on subgraph node → Ungroup

-- The helper handles all the complexity of:
-- 1. Moving nodes between graphs
-- 2. Creating I/O boundary pins
-- 3. Preserving link topology
-- 4. Grid-aligning repositioned nodes

Rect Calculation

-- Bounding rect for a set of nodes:
local rect, center = groupHelper:getRectCenter(nodes)
-- rect = {minX, minY, maxX, maxY}
-- center = {(minX+maxX)/2, (minY+maxY)/2}

-- Uses ui_flowgraph_editor.GetNodeSize/GetNodePosition
-- Defaults to 200×100 if node size is 0×0

Additional Exports

createGroupingFromSelection()

groupStateNodes()

  • Returns: any

groupFlowNodes()

ungroupStateNode()


See Also

  • Flowgraph Base Module - Related reference
  • Flowgraph Base State Node - Related reference
  • Flowgraph Base Node - Related reference
  • FlowGraph Guide - Guide

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

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.

On this page

PurposeClass (C) - Key MethodsInternal FunctionsGrouping FlowUsage ContextRect CalculationAdditional ExportscreateGroupingFromSelection()groupStateNodes()groupFlowNodes()ungroupStateNode()See Also