Class Graph

The Graph class implement a Resource that can be used to create a graph of GraphNode objects.

Hierarchy (view full)

Constructors

  • Internal function for construction.

    Parameters

    • Optionaluuid: UUID
    • OptionalisInternalConstructor: boolean

    Returns Graph

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

Properties

_isEnabling
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.

Accessors

  • 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

Methods

  • 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 GraphNode.

    Parameters

    Returns boolean

  • 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

  • Searches for a node on the Graph with that is an instanceof type.

    Type Parameters

    Parameters

    Returns T

  • Iterates through all nodes that are an instanceof type.

    Type Parameters

    Parameters

    Returns Generator<T, any, any>

  • 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 the specified GraphNode.

    Parameters

    Returns void

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

    Parameters

    • variableValues: Map<bigint, any>

      The persistent variable values that will be modified.

    Returns void

  • Renames the specified variable.

    Parameters

    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.

Events

onDirty: Event<[GraphObject | Graph, EnumValue<GraphNodeDirtyFlags, number>], void>

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

onDirty: Event<[GraphObject | Graph, EnumValue<GraphNodeDirtyFlags, number>], void>

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

onNodeAdded: Event<[GraphNode], void>

An event called whenever a new GraphNode is added.

onNodeRemoved: Event<[GraphNode], void>

An event called whenever a GraphNode is removed.

onConnectionAdded: Event<[GraphConnection], void>

An event called whenever a new connection was made.

onConnectionRemoved: Event<[GraphConnection], void>

An event called whenever a connection is removed.

onVariableAdded: Event<[GraphVariable], void>

An event called whenever a new GraphVariable is added.

onVariableRemoved: Event<[GraphVariable], void>

An event called whenever a new GraphVariable was removed.

onVariableChanged: Event<[GraphVariable], void>

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

onVariableDefaultValueChanged: Event<[GraphVariable], void>

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

onCommentAdded: Event<[GraphComment], void>

An event called whenever a new GraphComment is added.

onCommentRemoved: Event<[GraphComment], void>

An event called whenever a new GraphComment was removed.

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

An event called whenever validation resulted in errors.

onExecutionConnectionVisited: Event<[GraphConnection, GraphExecutionState], void>

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

onExecutionRootVisited: Event<[GraphNode, GraphExecutionState], void>

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