Taos API Reference
    Preparing search index...

    Class ExprGraphBuilder

    Mutable builder for an ExprNodeGraph. Each method returns the node (or port handle) so call sites can chain add() / connect() calls without juggling raw ids.

    Typical usage:

    const g = new ExprGraphBuilder();
    const t = g.add('time');
    const w = g.add('mul', { params: { } });
    g.connect(t, 'value', w, 'a');
    g.constant('b', 2.0, w, 'b');
    const s = g.add('setAttribute', { params: { attr: 'size', mode: 'overwrite' }, statement: true });
    g.connect(w, 'value', s, 'value');
    
    Index

    Constructors

    Properties

    nodes: Record<NodeId, ExprNode> = {}
    edges: ExprEdge[] = []
    statements: string[] = []
    variables: VariableDecl[] = []

    Methods

    • Add a node to the graph.

      Side-effecting nodes (setAttribute, setVariable — anything with kind.category === 'effect') are automatically appended to the graph's execution-order list (statements); they have no value output, so this is the only thing that makes them actually run. Pass statement: false to opt out (rare — usually means "construct it now, wire it later"). Pass statement: true to force-add a non-effect node to the execution order, which only makes sense for custom kinds you've added.

      inputValues sets inline literals on input ports — used when a port has no incoming edge. Same precedence as everywhere else: incoming edge > inputValues > port.default.

      Parameters

      • kind: string
      • opts: {
            id?: string;
            params?: Record<string, unknown>;
            inputValues?: Record<string, number | boolean | number[]>;
            position?: NodePosition;
            statement?: boolean;
        } = {}
        • Optionalid?: string
        • Optionalparams?: Record<string, unknown>
        • OptionalinputValues?: Record<string, number | boolean | number[]>
        • Optionalposition?: NodePosition
        • Optionalstatement?: boolean

          Override the automatic "effect-kinds run as statements" classification.

      Returns ExprNode

    • Set or update one inline input value on an existing node. Equivalent to authoring inputValues: { port: value } at add() time, but composable.

      Parameters

      • node: ExprNode
      • port: string
      • value: number | boolean | number[]

      Returns void

    • Shortcut: wire a literal constant into a port. Picks constF32/constVec3/ constVec4 automatically based on the value's shape.

      Parameters

      • srcPort: string
      • value: number | [number, number, number] | [number, number, number, number]
      • dst: ExprNode
      • dstPort: string

      Returns ExprNode