Class FlowGraphExperimental
Constructors
constructor
-
ExperimentalConstruct a Flow Graph
Parameters
- params: IFlowGraphParams
construction parameters. currently only the scene
Returns FlowGraph
- params: IFlowGraphParams
Properties
Optional Experimentalmetadata
Optional host-format metadata associated with this graph.
Experimentalname
A human-readable name for this graph.
Experimentalon State Changed Observable
An observable that is triggered when the state of the graph changes.
Experimentalunique Id
A unique identifier for this graph. Auto-generated if not provided.
Static ExperimentalEditor URL
Define the URL to load the flow graph editor script from.
Accessors
context Count
-
get contextCount(): number
ExperimentalReturns the number of execution contexts currently attached to this graph.
Returns number
coordinator
scene
scene Event Coordinator
-
get sceneEventCoordinator(): FlowGraphSceneEventCoordinator
ExperimentalThe scene event coordinator for this graph. Provides access to runtime event state such as currently pressed keys.
Returns FlowGraphSceneEventCoordinator
state
Methods
add Block
-
ExperimentalRegister a block with the graph. This does not wire any connections; it simply ensures the block is tracked so that serialization, editor display, and validation see it even when it is not reachable from an event block.
Parameters
- block: FlowGraphBlock
the block to register
Returns void
- block: FlowGraphBlock
add Event Block
-
ExperimentalAdd an event block. When the graph is started, it will start listening to events from the block and execute the graph when they are triggered.
Parameters
- block: FlowGraphEventBlock
the event block to be added
Returns void
- block: FlowGraphEventBlock
create Context
-
ExperimentalCreate a context. A context represents one self contained execution for the graph, with its own variables.
Returns FlowGraphContext
the context, where you can get and set variables
dispose
-
ExperimentalDisposes of the flow graph. Cancels any pending tasks and removes all event listeners.
Returns void
edit
-
ExperimentalLaunches the flow graph editor for this graph. The editor is lazy-loaded from FlowGraph.EditorURL the first time it is used.
Parameters
Optionalconfig: IFlowGraphEditorLaunchOptionsdefines the configuration of the editor
Returns Promise<void>
a promise fulfilled when the editor is visible
get All Blocks
-
ExperimentalReturns all blocks registered in this graph, including disconnected ones.
Returns readonly FlowGraphBlock[]
a read-only array of all blocks
get Context
-
ExperimentalReturns the execution context at a given index
Parameters
- index: number
the index of the context
Returns FlowGraphContext
the execution context at that index
- index: number
pause
-
ExperimentalPauses the flow graph. Cancels pending tasks but keeps execution contexts and event blocks. Call start() to resume.
Returns void
remove Block
-
ExperimentalRemove a block from the graph. Disconnects all of its ports and, if it is an event block, unregisters it from the event-block lists.
Parameters
- block: FlowGraphBlock
the block to remove
Returns void
- block: FlowGraphBlock
remove Context
-
ExperimentalRemove an execution context by index. Any pending async blocks on the context are cleared before removal.
Parameters
- index: number
the index of the context to remove
Returns FlowGraphContext | undefined
the removed context, or undefined if the index was out of range
- index: number
serialize
-
serialize(
serializationObject?: any,
valueSerializeFunction?: (
key: string,
value: any,
serializationObject: any,
) => void,
): voidExperimentalSerializes a graph
Parameters
- serializationObject: any = {}
the object to write the values in
OptionalvalueSerializeFunction: (key: string, value: any, serializationObject: any) => voida function to serialize complex values
Returns void
- serializationObject: any = {}
set Scene
-
ExperimentalSets a new scene for this flow graph, re-wiring all event listeners. This is useful when the scene the flow graph should listen to changes (e.g. when a new scene is loaded in an editor preview). If the graph is currently running, it will be stopped first and must be restarted manually after calling this method.
Parameters
- scene: Scene
the new scene to attach to
Returns void
- scene: Scene
start
-
ExperimentalStarts the flow graph. Initializes the event blocks and starts listening to events. Can also be called to resume from a paused state.
Returns void
stop
-
ExperimentalStops the flow graph. Cancels all pending tasks and clears execution contexts, but keeps event blocks so the graph can be restarted.
Returns void
validate
-
ExperimentalValidates the flow graph and returns all issues found. Uses the tracked block list for complete validation including unreachable block detection.
Returns IFlowGraphValidationResult
The validation result containing errors and warnings.
visit All Blocks
-
ExperimentalExecutes a function in all blocks of a flow graph, starting with the event blocks.
Parameters
- visitor: (block: FlowGraphBlock) => void
the function to execute.
Returns void
- visitor: (block: FlowGraphBlock) => void
Class used to represent a flow graph. A flow graph is a graph of blocks that can be used to create complex logic. Blocks can be added to the graph and connected to each other. The graph can then be started, which will init and start all of its event blocks.
FlowGraph is still in development and is subject to change.