API

Class FlowGraphContext

The context represents the current state and execution of the flow graph. It contains both user-defined variables, which are derived from a more general variable definition, and execution variables that are set by the blocks.

Index
assetsContext: IAssetContainer

The assets context used by the flow graph context. Note that it can be shared between flow graph contexts.

breakpointPredicate: Nullable<(block: FlowGraphExecutionBlock) => boolean> = null

A predicate called before each execution block runs. If it returns true, execution is paused before the block and a pending activation is stored, which can be resumed via continueExecution or stepExecution.

Set to null to disable breakpoint checking.

logger: Nullable<FlowGraphLogger>

The logger used by the context to log actions.

name: string = ""

An optional user-facing name for the context. Defaults to an empty string; the editor may assign a label like "Context 0".

onBreakpointHitObservable: Observable<IFlowGraphPendingActivation> = ...

Observable triggered when a breakpoint is hit. Observers receive the pending activation (block, context, signal) that was paused.

onNodeExecutedObservable: Observable<FlowGraphBlock> = ...

Observable that is triggered when a node is executed.

treatDataAsRightHanded: boolean = false

Whether to treat data as right-handed. This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing. Default is false.

uniqueId: string = ...

A randomly generated GUID for each context.

  • Decodes the array index denoted by a reference. Returns undefined when no host resolver is configured or the host does not recognise the value as an indexed reference.

    Parameters

    • reference: string

      the reference to decode

    • Optionalcollection: string

      optional host collection the reference must address

    Returns number | undefined

    the index the reference denotes, or undefined when it does not denote one

  • Encodes an event source key as the opaque reference exposed by event blocks on their event output. Delegates to the IFlowGraphHostResolver configured on the coordinator, so the reference format is owned by the environment hosting the graph.

    Parameters

    • key: string

      the event source key (e.g. "sceneReady", "sceneTick", or a custom event id)

    Returns string

    the event reference

  • Maps a runtime object to the reference the host addresses it by. Returns undefined when no host resolver is configured or the host cannot address the object.

    Parameters

    • object: object

      the runtime object to address

    • Optionalhint: string

      optional disambiguation hint telling the host which kind of reference is wanted

    Returns string | undefined

    the reference for the object, or undefined when it cannot be addressed

  • Get the declared type annotation for a user variable.

    Parameters

    • name: string

      the variable name

    Returns string | undefined

    the type name string, or undefined if no type was declared

  • Serializes a context

    Parameters

    • serializationObject: any = {}

      the object to write the values in

    • valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction

      a function to serialize complex values

    Returns void

  • Set the declared type annotation for a user variable.

    Parameters

    • name: string

      the variable name

    • typeName: string

      the type name string (e.g. "number", "Vector3", "Mesh")

    Returns void