Class FlowGraphContext
Constructors
constructor
-
Parameters
- params: IFlowGraphContextConfiguration
Returns FlowGraphContext
Properties
assets Context
The assets context used by the flow graph context. Note that it can be shared between flow graph contexts.
breakpoint Predicate
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
The logger used by the context to log actions.
name
An optional user-facing name for the context. Defaults to an empty string; the editor may assign a label like "Context 0".
on Breakpoint Hit Observable
Observable triggered when a breakpoint is hit. Observers receive the pending activation (block, context, signal) that was paused.
on Node Executed Observable
Observable that is triggered when a node is executed.
treat Data As Right Handed
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.
unique Id
A randomly generated GUID for each context.
Accessors
enable Logging
-
get enableLogging(): boolean
Enable logging on this context
Returns boolean
-
set enableLogging(value: boolean): void
Parameters
- value: boolean
Returns void
execution Id
-
get executionId(): number
A monotonically increasing ID for each execution. Incremented for every block executed.
Returns number
has Pending Blocks
-
get hasPendingBlocks(): boolean
Check if there are any pending blocks in this context
Returns boolean
true if there are pending blocks
pending Activation
-
Returns the currently paused activation, or null if not paused.
Returns Nullable<IFlowGraphPendingActivation>
user Variables
-
get userVariables(): { [key: string]: any }
Gets all user variables map
Returns { [key: string]: any }
variable Types
-
get variableTypes(): { [key: string]: string }
Gets all variable type annotations.
Returns { [key: string]: string }
Methods
_ notify On Tick
-
Parameters
- framePayload: IFlowGraphOnTickEventPayload
Returns void
continue Execution
-
Resume execution from a breakpoint hit. The paused block and all downstream blocks will execute normally until the next breakpoint (if any) is hit.
Returns void
decode Index Reference
-
Decodes the array index denoted by a reference. Returns
undefinedwhen 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: stringoptional host collection the reference must address
Returns number | undefined
the index the reference denotes, or
undefinedwhen it does not denote one - reference: string
get Asset
-
Get an assets from the assets context based on its type and index in the array
Type Parameters
- T extends FlowGraphAssetType
Parameters
- type: T
The type of the asset
- index: number
The index of the asset
Returns Nullable<AssetType<T>>
The asset or null if not found
get Class Name
-
Returns string
the class name of the object.
get Event Reference
-
Encodes an event source key as the opaque reference exposed by event blocks on their
eventoutput. 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
- key: string
get Object Reference
-
Maps a runtime object to the reference the host addresses it by. Returns
undefinedwhen no host resolver is configured or the host cannot address the object.Parameters
- object: object
the runtime object to address
Optionalhint: stringoptional disambiguation hint telling the host which kind of reference is wanted
Returns string | undefined
the reference for the object, or
undefinedwhen it cannot be addressed - object: object
get Scene
get Variable
-
Get a user-defined variable.
Parameters
- name: string
the name of the variable
Returns any
the value of the variable
- name: string
get Variable Type
-
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
- name: string
has Variable
-
Check if a user-defined variable is defined.
Parameters
- name: string
the name of the variable
Returns boolean
true if the variable is defined
- name: string
serialize
-
serialize(
serializationObject?: any,
valueSerializationFunction?: (
key: string,
value: any,
serializationObject: any,
) => void,
): voidSerializes 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
- serializationObject: any = {}
set Variable
-
Set a user-defined variable.
Parameters
- name: string
the name of the variable
- value: any
the value of the variable
Returns void
- name: string
set Variable Type
-
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
- name: string
step Execution
-
Execute exactly the paused block and then pause again before the next execution block fires. If no activation is pending, this is a no-op.
Returns void
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.