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

    Class GraphVariable

    The GraphVariable class implements a (local) variable within a Graph. It can be visible and editable only within the graph, or if set to public, also editable from outside.

    Hierarchy (View Summary)

    Index
    defaultValue: any

    The default value of the variable.

    The Graph that owns the variable.

    id: UUID

    The UUID of the variable.

    isPublic: boolean

    Determines if the variable will be modifiable when inspecting the resource.

    name: string

    The name of the variable.

    To change the name of a registered variable, use Graph#renameVariable.

    type: GraphType

    The GraphType of the variable.

    The GraphType itself is not serializable as it's identity must be globally unique. To solve this issue, the system serializes the system type via the _systemType field. Once the variable is deserialized or cloned, the GraphType is reconstructed at runtime.

    • Deletes the metadata associated with the given key from the user data.

      Type Parameters

      • T

        An interface containing a declaration of the meta data fields of the variable such as CarbonShaderGraphVariableMetaData.

      Parameters

      • key: keyof T

        The key of the metadata to delete.

      Returns any

      If the user data becomes empty after deletion, it sets the user data to undefined.

    • Virtual

      Invoked when the variable was added to graph or after deserialized.

      Parameters

      Returns void

    • Retrieves metadata associated with the specified key.

      Type Parameters

      • T

        An interface containing a declaration of the meta data fields of the variable such as CarbonShaderGraphVariableMetaData.

      • K = any

      Parameters

      • key: keyof T

        The key for which to retrieve the metadata.

      • OptionaldefaultValue: K

      Returns K

      The metadata associated with the key, or undefined if no metadata is found.

    • Virtual

      Invoked before the variable is removed from a Graph.

      Returns void

    • Sets metadata for the graph variable.

      Type Parameters

      • T

        An interface containing a declaration of the meta data fields of the variable such as CarbonShaderGraphVariableMetaData.

      Parameters

      • key: keyof T

        The key for the metadata entry.

      • value: any

        The value to be associated with the key.

      Returns any

    • Sets the type of the variable and assigns a new default value. If the defaultValue is not specified or undefined, a default value will be constructed.

      Parameters

      • graphType: GraphType

        The new type.

      • OptionaldefaultValue: any

      Returns void

    • Virtual

      Ensures that the state of the node is valid.

      Parameters

      Returns GraphValidationStatus

      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.