Skip to content

Documentation / scene / FunctionOutputNode

Class: FunctionOutputNode ​

Defined in: libs/scene/src/utility/blueprint/material/func.ts:488

Function output value node

Remarks ​

Represents an output value in a material function blueprint. These nodes define what data the function returns to its caller.

Each FunctionOutputNode:

  • Has a name (output value name)
  • Has an optional explicit interface order (-1 sorts automatically by name)
  • Has one input that must be connected to compute the output value
  • Automatically determines its type from the connected input
  • Has no outputs (it provides its value to the calling context)

When a FunctionCallNode is created, it scans for all FunctionOutputNodes and creates corresponding output slots on the call node.

A function can have multiple outputs to return different related values (e.g., a noise function might return both noise value and derivative).

Example ​

typescript
// In a function blueprint:
const resultOutput = new FunctionOutputNode();
resultOutput.name = 'result';
resultOutput.connectInput(1, computeNode, 1);

const normalOutput = new FunctionOutputNode();
normalOutput.name = 'normal';
normalOutput.connectInput(1, normalNode, 1);

// When called, the FunctionCallNode will have two outputs:
// - Output 1: result (type determined by computeNode)
// - Output 2: normal (type determined by normalNode)

Extends ​

Constructors ​

Constructor ​

new FunctionOutputNode(): FunctionOutputNode

Defined in: libs/scene/src/utility/blueprint/material/func.ts:502

Creates a new function output node

Returns ​

FunctionOutputNode

Remarks ​

Initializes with:

  • Auto-generated name: out_N (where N is an incrementing counter)
  • One input slot that accepts numeric/matrix values and tex2D
  • Type is inferred from the connected input node

Overrides ​

BaseGraphNode.constructor

Properties ​

outId ​

static outId: number = 1

Defined in: libs/scene/src/utility/blueprint/material/func.ts:490

Static counter for auto-generating unique output names


_inputs ​

protected _inputs: GraphNodeInput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:336

Internal storage for input slot definitions

Inherited from ​

BaseGraphNode._inputs


_outputs ​

protected _outputs: GraphNodeOutput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:338

Internal storage for output slot definitions

Inherited from ​

BaseGraphNode._outputs


_error ​

protected _error: string

Defined in: libs/scene/src/utility/blueprint/node.ts:340

Internal storage for error message

Inherited from ​

BaseGraphNode._error

Accessors ​

name ​

Get Signature ​

get name(): string

Defined in: libs/scene/src/utility/blueprint/material/func.ts:518

Gets the output value name

Returns ​

string

The output name used in function calls

Set Signature ​

set name(val): void

Defined in: libs/scene/src/utility/blueprint/material/func.ts:521

Parameters ​
val ​

string

Returns ​

void


order ​

Get Signature ​

get order(): number

Defined in: libs/scene/src/utility/blueprint/material/func.ts:527

Gets the explicit interface order, or -1 when automatic name sorting is used.

Returns ​

number

Set Signature ​

set order(val): void

Defined in: libs/scene/src/utility/blueprint/material/func.ts:530

Parameters ​
val ​

number

Returns ​

void


type ​

Get Signature ​

get type(): string

Defined in: libs/scene/src/utility/blueprint/material/func.ts:545

Gets the output value type

Remarks ​

This is a convenience accessor that calls getType().

Returns ​

string

The data type inferred from the connected input


isUniform ​

Get Signature ​

get isUniform(): boolean

Defined in: libs/scene/src/utility/blueprint/node.ts:357

Whether this node contains uniform value/texture

Returns ​

boolean

Whether this node has uniform value

Inherited from ​

BaseGraphNode.isUniform


paramName ​

Get Signature ​

get paramName(): string

Defined in: libs/scene/src/utility/blueprint/node.ts:363

Uniform parameter name

Returns ​

string

Uniform parameter name

Inherited from ​

BaseGraphNode.paramName


inputs ​

Get Signature ​

get inputs(): GraphNodeInput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:380

Gets the input slot definitions array

Returns ​

GraphNodeInput[]

Array of input slot definitions

Inherited from ​

BaseGraphNode.inputs


outputs ​

Get Signature ​

get outputs(): GraphNodeOutput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:384

Gets the output slot definitions array

Returns ​

GraphNodeOutput[]

Array of output slot definitions

Inherited from ​

BaseGraphNode.outputs


error ​

Get Signature ​

get error(): string

Defined in: libs/scene/src/utility/blueprint/node.ts:388

Gets the current error message

Returns ​

string

Set Signature ​

set error(str): void

Defined in: libs/scene/src/utility/blueprint/node.ts:391

Current error message, empty string if no error

Parameters ​
str ​

string

Returns ​

void

Current error message, empty string if no error

Inherited from ​

BaseGraphNode.error

Methods ​

on() ​

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener ​

EventListener<{ changed: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseGraphNode.on


once() ​

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener ​

EventListener<{ changed: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseGraphNode.once


off() ​

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener? ​

EventListener<{ changed: []; }>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseGraphNode.off


dispatchEvent() ​

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

args ​

...object[K]

Returns ​

void

Inherited from ​

BaseGraphNode.dispatchEvent


getSerializationCls() ​

static getSerializationCls(): object

Defined in: libs/scene/src/utility/blueprint/material/func.ts:557

Gets the serialization descriptor for this node type

Returns ​

object

Serialization class descriptor

ctor ​

ctor: typeof FunctionOutputNode = FunctionOutputNode

name ​

name: string = 'FunctionOutputNode'

getProps() ​

getProps(): PropertyAccessor<object, "">[]

Returns ​

PropertyAccessor<object, "">[]

Remarks ​

Serializes the output name and interface order. The type is inferred at runtime from the connected input node.


toString() ​

toString(): string

Defined in: libs/scene/src/utility/blueprint/material/func.ts:599

Generates a string representation of this node

Returns ​

string

'FunctionOutput'

Overrides ​

BaseGraphNode.toString


validate() ​

protected validate(): "" | "Missing result" | "Cannot determin result type"

Defined in: libs/scene/src/utility/blueprint/material/func.ts:612

Validates the node state

Returns ​

"" | "Missing result" | "Cannot determin result type"

Error message if invalid, empty string if valid

Remarks ​

Ensures:

  • The input is connected (function must return a value)
  • The input type can be determined

Overrides ​

BaseGraphNode.validate


getType() ​

protected getType(): string

Defined in: libs/scene/src/utility/blueprint/material/func.ts:632

Gets the output type based on the connected input

Returns ​

string

The type from the connected input node, or empty string if not connected

Remarks ​

The output type is dynamically determined by tracing back through the connected input to find its source type. This allows functions to work with multiple types without explicit type declarations.

Overrides ​

BaseGraphNode.getType


getOutputType() ​

getOutputType(id): string

Defined in: libs/scene/src/utility/blueprint/node.ts:376

Gets the output type for a specific output slot

Parameters ​

id ​

number

The output slot ID

Returns ​

string

The type name of the output

Remarks ​

Default implementation delegates to the abstract getType() method. Can be overridden for more complex type logic.

Inherited from ​

BaseGraphNode.getOutputType


check() ​

check(): void

Defined in: libs/scene/src/utility/blueprint/node.ts:413

Validates the node and updates error state

Returns ​

void

Remarks ​

Calls the validate() method and stores the result in _error. Emits a 'changed' event if the error state changes.

Inherited from ​

BaseGraphNode.check


reset() ​

reset(): void

Defined in: libs/scene/src/utility/blueprint/node.ts:422

Clears the error state

Returns ​

void

Remarks ​

Sets _error to an empty string.

Inherited from ​

BaseGraphNode.reset


setInput() ​

setInput(id, node, inputId): void

Defined in: libs/scene/src/utility/blueprint/node.ts:443

Connects an input slot to another node's output

Parameters ​

id ​

number

The input slot ID to connect

node ​

BaseGraphNode

The source node to connect from

inputId ​

number

The output slot ID of the source node

Returns ​

void

Throws ​

Error if the input slot with the given ID doesn't exist

Example ​

typescript
const addNode = new AddNode();
const constantNode = new ConstantNode(5.0);

// Connect constantNode's output 0 to addNode's input 0
addNode.setInput(0, constantNode, 0);

Inherited from ​

BaseGraphNode.setInput

Released under the MIT License.