Constructor
new Node(nameopt, titleopt)
Construct a new Node
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
The name of the node |
title |
string |
<optional> |
The title of the node |
- Source:
Classes
Members
(private) canAddInput
Can the user add an input?
- Source:
(private) canAddNext
Can the user add a next?
- Source:
(private) canAddOutput
Can the user add an output?
- Source:
(private) creatable
Can the node be created by the user?
- Source:
(private) functional
Is this node a functional node?
- Source:
(private) id
The internal unique identifier
- Source:
(private) inputs
List of node's inputs
- Source:
lastNodeIdIndex
An incremental index to generate unique node IDs
- Source:
(private) meta
Additional info (UIs can write anything to store graphical behaviors)
- Source:
(private) name
The internal name of the node
- Source:
(private) nexts
List of node's nexts in execution
- Source:
(private) outputs
List of node's outputs
- Source:
(private) prev
The execution entry point
- Source:
(private) program
Reference to the enclosing program
- Source:
(private) removable
Can the node be removed by the user?
- Source:
(private) title
The external name of the node
- Source:
Methods
addInput()
If this.#canAddInput is true, the user can add an input
Subclass with variable number of input should override this method
- Source:
addOutput()
If this.#canAddOutput is true, the user can add an output
Subclass with variable number of output should override this method
- Source:
canBeConnected(thisSocket, otherSocket)
This method defines if a particular socket of this node can
be connected to another one, based on sockets type.
Default implementation checks for types of sockets, following the rule:
- if sockets are FlowSockets, return true
- Otherwise if the type of one socket is Types.ANY, return true
- Otherwise if the two types are the same, return true
- Otherwise return false
Parameters:
Name | Type | Description |
---|---|---|
thisSocket |
Socket | The instance of socket of this node |
otherSocket |
Socket | The other socket |
- Source:
canRemoveInput(input)
Can this node remove a specific input?
Subclass with variable number of input should override this method
Parameters:
Name | Type | Description |
---|---|---|
input |
InputSocket | The input to remove |
- Source:
canRemoveOutput(output)
Can this node remove a specific output?
Subclass with variable number of output should override this method
Parameters:
Name | Type | Description |
---|---|---|
output |
OutputSocket | The output to remove |
- Source:
clone(factory)
This method clones the node. Cloning will create a new node
of the same type of the particular node, so each node must
override this method to return the exact class type to the
caller. The param "factory" is a function to create the specific
class instance, to this base version of the method can create
the instance and clone all sockets, and other propertiesthat
is a same process for all different instances
Parameters:
Name | Type | Description |
---|---|---|
factory |
function | A function that return a new instance of the class |
- Source:
disconnectAllSockets()
This method disconnect all sockets from the node
- Source:
(async) evaluateInputs()
Evaluate all imputs of this node. Inputs are sockets.
If the socket is connected the evaluation will search
for the socket's peer and evaluate the output counterpart
eventually reprocess the output's nod, if the node is
functional
- Source:
getFlowResult(socket)
This is an helper method to construct a Result instance
by name
Parameters:
Name | Type | Description |
---|---|---|
socket |
Socket | The Socket on which construct the Result instance |
- Source:
input(name)
Returns the input by name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the input |
- Source:
next(name)
Returns the next by name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the next |
- Source:
output(name)
Returns the output by name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the output |
- Source:
(async) process()
The base version of the node does nothing
- Source:
removeInput(input)
This method removes a specific input from the node, if
this is possible whit this instance
Subclass with variable number of input should override this method
Parameters:
Name | Type | Description |
---|---|---|
input |
InputSocket | The input to remove |
- Source:
removeOutput(output)
This method removes a specific output from the node, if
this is possible whit this instance
Subclass with variable number of output should override this method
Parameters:
Name | Type | Description |
---|---|---|
output |
OutputSocket | The output to remove |
- Source: