Documentation / scene / IGraphNode
Interface: IGraphNode
Defined in: libs/scene/src/utility/blueprint/node.ts:228
Interface for a graph node in the material blueprint system
Remarks
Defines the contract that all graph nodes must implement, including:
- Input and output slot management
- Type information retrieval
- Error state tracking
- Validation logic
- Change notification through events
Example
class AddNode implements IGraphNode {
readonly inputs = [
{ id: 0, name: 'a', type: ['float'] },
{ id: 1, name: 'b', type: ['float'] }
];
readonly outputs = [
{ id: 0, name: 'result' }
];
// ... implement other methods
}Extends
IEventTarget<{changed: []; }>
Properties
[EventMapType]?
readonlyoptional[EventMapType]?:object
Defined in: libs/base/dist/index.d.ts:549
Type-only event map marker.
changed
changed: []
Inherited from
IEventTarget.[EventMapType]
inputs
readonlyinputs:GraphNodeInput[]
Defined in: libs/scene/src/utility/blueprint/node.ts:230
Array of input slot definitions
outputs
readonlyoutputs:GraphNodeOutput[]
Defined in: libs/scene/src/utility/blueprint/node.ts:232
Array of output slot definitions
isUniform
isUniform:
boolean
Defined in: libs/scene/src/utility/blueprint/node.ts:234
Whether this node has uniform value
paramName
paramName:
string
Defined in: libs/scene/src/utility/blueprint/node.ts:236
Uniform parameter name
error
error:
string
Defined in: libs/scene/src/utility/blueprint/node.ts:238
Current error message, empty string if no error
Methods
on()
on<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:556
Sets up a function that will be called whenever the specified event is delivered to the target
Type Parameters
K
K extends "changed"
Parameters
type
K
The event type to listen for
listener
EventListener<{ changed: []; }, K>
The callback function
context?
unknown
Context object of the listener function
Returns
void
Inherited from
IEventTarget.on
once()
once<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:563
Sets up a function that will be called only once when the specified event is delivered to the target
Type Parameters
K
K extends "changed"
Parameters
type
K
The event type to listen for
listener
EventListener<{ changed: []; }, K>
The callback function
context?
unknown
Context object of the listener function
Returns
void
Inherited from
IEventTarget.once
off()
off<
K>(type,listener?,context?):void
Defined in: libs/base/dist/index.d.ts:569
Removes an event listener function previously registered.
Type Parameters
K
K extends "changed"
Parameters
type
K
The event type for which to remove an event listener
listener?
EventListener<{ changed: []; }>
The callback function to be removed
context?
unknown
Returns
void
Inherited from
IEventTarget.off
dispatchEvent()
dispatchEvent<
K>(type, ...args):void
Defined in: libs/base/dist/index.d.ts:575
Synchronously invoke the affected event listeners with an event object
Type Parameters
K
K extends "changed"
Parameters
type
K
args
...object[K]
Returns
void
false if the event was canceled, otherwise true
Inherited from
IEventTarget.dispatchEvent
getOutputType()
getOutputType(
id):string
Defined in: libs/scene/src/utility/blueprint/node.ts:250
Gets the output type for a specific output slot
Parameters
id
number
The output slot ID
Returns
string
The type name of the output (e.g., 'float', 'vec3', 'mat4')
Example
const outputType = node.getOutputType(0); // 'vec3'toString()
toString():
string
Defined in: libs/scene/src/utility/blueprint/node.ts:265
Generates a string representation of the node
Returns
string
String representation of the node's operation
Remarks
Typically used for code generation or debugging purposes. Should return valid shader code or a meaningful description.
Example
node.toString(); // Returns: "float result = a + b;"check()
check():
void
Defined in: libs/scene/src/utility/blueprint/node.ts:282
Validates the node's current state
Returns
void
Remarks
Checks if all required inputs are connected and if type constraints are satisfied. Sets the error property if validation fails. Should be called after any connection changes.
Example
node.check();
if (node.error) {
console.error('Validation failed:', node.error);
}reset()
reset():
void
Defined in: libs/scene/src/utility/blueprint/node.ts:289
Resets the node's error state
Returns
void
Remarks
Clears any error messages. Typically called before revalidation.