RSX Code Reference
    Preparing search index...
    • rsx
    • ControlFlowGraph

    Class ControlFlowGraph

    The ControlFlowGraph extends the Graph class by implemeting a control flow graph. The class can host and execute nodes subclassing from ControlFlowNodeBase.

    The control flow graph controls the execution order of nodes, where the execution can loop, switch or take conditional branches. ControlFlowNodeBase nodes may contain any number of control-flow pins and decide which path to take upon execution.

    Hierarchy (View Summary)

    Index
    • Internal function for construction.

      Parameters

      • Optionaluuid: UUID
      • OptionalisInternalConstructor: boolean

      Returns ControlFlowGraph

      You should never override the constructor for resources. Always rely on onCreate or onInitialize to initialize your resource.

    _isEnabling: true
    comments: GraphComment[]

    All GraphComment objects to display in the editor for this Graph

    isValidationCritical: boolean

    The status of the validation, undefined until validate was called.

    nodes: GraphNode[]

    All GraphNode objects registerded with this graph.

    userData: Map<string, any>

    A Map suitable for storing custom user-defined data.

    validationStatus: Map<GraphObject, string>

    The status of the validation since the last call to validate.

    variables: GraphVariable[]

    All GraphVariable objects registered with this graph.

    viewportPosition: Vector2

    Determines the panning position of the user has last moved the graph canvas to.

    viewportZoomScale: number

    Determines the zoom scale of the user has the graph canvas at.

    controlFlowInputPinName: "CF[In]"
    controlFlowOutputPinName: "CF[Out]"
    • get defaultVariableType(): Type
      Virtual

      Gets the default type of a newly constructed empty variable.

      Returns Type

    • get isDestroyed(): boolean

      Determines if the resource is destroyed.

      Returns boolean

      This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

    • get name(): string

      Name of the resource. Use primarily for easier identification and not important to the engine itself.

      Returns string

    • get uuid(): UUID

      Returns a universally unique identifier of this resource.

      Returns UUID

    • Adds a new comment to the graph.

      Parameters

      • region: Immutable<Rect2>

        The region to create the new comment on, including the origin and it's size.

      • title: string

        A string that represents the title for the comment.

      • Optionaldescription: string

        A string that represents a description for the comment.

      Returns GraphComment

      The newly created commented object.

    • Adds the specified GraphConnection.

      Parameters

      Returns void

      The connection will be registered with both the input and output GraphPin. Before the connection is registered onFilterAddConnection will be invoked to allow the graph to dynamically replace the connection.

    • Adds the specified GraphVariable.

      Parameters

      Returns boolean

      true if the variable was added, false on error.

      If a variable with the same name already exists, a suffix will be appened.

    • Duplicates the resource and creates a unique UUID for the duplicated resource.

      Returns Resource

      The duplicated resource or null, if the duplication failed.

    • Invoken when the graph was deserialized and objects need to be enabled. This typically entails restoring object pointers that cannot be serialized.

      Returns void

    • Executes the specified root node in the graph with the controlFlowData.

      Parameters

      • rootOrConnection: GraphConnection | ControlFlowNodeBase

        The root node to execution or a connection to execute as root. When a ControlFlowNodeBase is specified, the node is immediately executed as the first node. When a GraphConnection is specified, the node that is connected to the connections input pin is executed as the first node.

      • controlFlowData: ControlFlowData

        The control flow data for the current execution.

      Returns void

      Each call to executeNode returns the next connection to be executed. The execution will run until null is returned.

    • Virtual

      Method called by RSX to perform actions required after the creation of the resource.

      Parameters

      Returns void

    • Virtual

      Method called by RSX to perform any operations needed after deserialization.

      Returns void

      Use this API to restore your serializable data into live objects.

    • Virtual

      Method called by RSX to disable the resource.

      Returns void

      Use this API to deactivate the resource before it is serialized.

    • Virtual

      Method called by RSX to enable the resource.

      Returns void

      Use this API to activate the resource after it has been disabled by serialization.

    • Virtual

      Method called by RSX to perform initialization of the resource.

      Parameters

      Returns void

      Use this API to initialize data and default construct all fields.

    • Virtual

      Method called by RSX to perform any operations before serialization.

      Returns void

      Use this API to bake your live data into serializable data.

    • Removes all persisted GraphVariable data from variableValues that have been removed or are no longer public.

      Parameters

      • variableValues: Map<UUIDBigInt, any>

        The persistent variable values that will be modified.

      Returns void

    • Reverts the resource to the on-disk representation.

      Returns boolean

      This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.

    • Changes the default value of a variable.

      Parameters

      Returns void

    • Forcefully unloads the resource.

      Returns void

    • Virtual

      Ensures that the state of the graph is valid.

      Returns void

      Implementing classes must call super. The method is typically called after deserialization or major edits to the graph. If validation fails, error information must be added to the validationStatus map.

    An event called when a change on the graph was made.

    An event called when a change on the graph was made.

    onNodeAdded: Event<[GraphNode]>

    An event called whenever a new GraphNode is added.

    onNodeRemoved: Event<[GraphNode]>

    An event called whenever a GraphNode is removed.

    onConnectionAdded: Event<[GraphConnection]>

    An event called whenever a new connection was made.

    onConnectionRemoved: Event<[GraphConnection]>

    An event called whenever a connection is removed.

    onVariableAdded: Event<[GraphVariable]>

    An event called whenever a new GraphVariable is added.

    onVariableRemoved: Event<[GraphVariable]>

    An event called whenever a new GraphVariable was removed.

    onVariableChanged: Event<[GraphVariable]>

    An event called whenever a new GraphVariable was changed, e.g. name, type or meta-data.

    onVariableDefaultValueChanged: Event<[GraphVariable]>

    An event called whenever a new GraphVariable was default value changed.

    onCommentAdded: Event<[GraphComment]>

    An event called whenever a new GraphComment is added.

    onCommentRemoved: Event<[GraphComment]>

    An event called whenever a new GraphComment was removed.

    onValidationError: Event<[Map<GraphObject, string>]>

    An event called whenever validation resulted in errors.

    onExecutionConnectionVisited: Event<[GraphConnection, GraphExecutionState]>

    An event called whenever a connection was visited by the execution.

    onExecutionRootVisited: Event<[GraphNode, GraphExecutionState]>

    An event called whenever a root node was visited by the execution.