Class CarbonLogicGraph

The CarbonLogicGraph implements a CarbonGraph that can be used to create logic behaviors that are executed when assigned to a CarbonLogic

Hierarchy (view full)

Constructors

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.

controlFlowInputPinName = "CF[In]"
controlFlowOutputPinName = "CF[Out]"

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 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 CarbonLogicEventNode of the specified type.

    Type Parameters

    Parameters

    • type: ClassOf<T>

      The type to execute.

    • component: CarbonLogic

      A reference to the component that triggered the event.

    • Optionaldata: CarbonLogicData

      The optional execution data.

    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.

  • Executes the CarbonLogicOnCarbonEvent event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    • animation: Component
    • eventName: string
    • object: any

    Returns void

  • Executes the CarbonLogicOnDisable event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    Returns void

  • Executes the CarbonLogicOnEnable event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    Returns void

  • Executes the CarbonLogicOnFixedUpdate event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    Returns void

  • Executes the CarbonLogicOnInput event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    • event: ButtonEvent
    • isDown: boolean

    Returns void

  • Executes the CarbonLogicOnLateUpdate event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    Returns void

  • Executes the CarbonLogicOnTransformChanged event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    Returns void

  • Executes the CarbonLogicOnUpdate event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    Returns void

  • Executes the CarbonLogicOnVirtualInput event node.

    Parameters

    • component: CarbonLogic

      A reference to the component that triggered the event.

    • button: VirtualButton
    • deviceIndex: number
    • isDown: boolean
    • isHeld: boolean

    Returns void

  • 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<bigint, 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.

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