Skip to content

Documentation / scene / FunctionInputNode

Class: FunctionInputNode

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

Function input parameter node

Remarks

Represents an input parameter in a material function blueprint. These nodes define the function's interface - what data must be provided when the function is called from another material graph.

Each FunctionInputNode:

  • Has a name (parameter name)
  • Has a type (float, vec2, vec3, vec4, mat2, mat3, or mat4)
  • Produces one output that provides the parameter value within the function
  • Has no inputs (it receives its value from the calling context)

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

Example

typescript
// In a function blueprint:
const uvInput = new FunctionInputNode();
uvInput.name = 'uv';
uvInput.type = 'vec2';

const scaleInput = new FunctionInputNode();
scaleInput.name = 'scale';
scaleInput.type = 'float';

// These will become inputs on any FunctionCallNode that uses this blueprint

Extends

Constructors

Constructor

new FunctionInputNode(): FunctionInputNode

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

Creates a new function input node

Returns

FunctionInputNode

Remarks

Initializes with:

  • Default type: vec4
  • Auto-generated name: arg_N (where N is an incrementing counter)
  • One output slot to provide the parameter value within the function

Overrides

BaseGraphNode.constructor

Properties

argId

static argId: number = 1

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

Static counter for auto-generating unique argument 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

type

Get Signature

get type(): string

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

Gets the parameter type

Returns

string

The data type (float, vec2, vec3, vec4, mat2, mat3, or mat4)


name

Get Signature

get name(): string

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

Gets the parameter name

Returns

string

The parameter name used in function calls

Set Signature

set name(val): void

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

Parameters
val

string

Returns

void


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:594

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:598

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:602

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:606

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:307

Gets the serialization descriptor for this node type

Returns

object

Serialization class descriptor

ctor

ctor: typeof FunctionInputNode = FunctionInputNode

name

name: string = 'FunctionInputNode'

getProps()

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

Returns

PropertyAccessor<object, "">[]

Remarks

Serializes the parameter type and name. The type has an enumeration constraint limited to valid shader types.


toString()

toString(): string

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

Generates a string representation of this node

Returns

string

'FunctionInput'

Overrides

BaseGraphNode.toString


validate()

protected validate(): string

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

Validates the node state

Returns

string

Empty string (always valid)

Remarks

Function input nodes have no validation requirements as they have no inputs and their type is explicitly set.

Overrides

BaseGraphNode.validate


getType()

protected getType(): string

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

Gets the output type

Returns

string

The parameter type

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.