Add a value
node
A value
node lets you set a data type and value. It is useful for many things, including:
- Supplying a constant value to a calculation.
- Forcing a value to have a specific data type. Anything connected to the input of a
value
node will be promoted to its type if possible, otherwise there will be an error.- You can also set the data type of a port by right-clicking and selecting a type from the Value Types or Port Types menu. See Set the type of a port.
- Accessing the components of vectors and matrices.
By default, value
nodes show their values instead of their names, except for types like matrices and objects. You can switch between displaying names and values by selecting the node and choosing Display > Show Node Names.
Create a value node
You can add a value node to a graph in the same way as any other node, by pressing Tab and starting to type "value". Value nodes added in this way are of type float
by default.
Alternatively, you can right-click on any unconnected input port or New port icon, and choose Create Value Node. When you create a value
node in this way:
Any existing value on the port becomes the
value
node's value.The default type is the type of the port, with a couple of exceptions:
- If the port is an unresolved
auto
port, the default type of thevalue
node isfloat
. - If a node is auto-looped because an array has been connected, the type is a single value rather than an array. For example, this lets you connect an array to an
add
node, and then easily add a single value to all items in the array. If the default were an empty array instead, the output of theadd
node would also be an empty array because auto-looping is based on the size of the smallest array.
- If the port is an unresolved
Once you have added a value
node, you can set the node's value in the Parameter Editor, or change its data type first.
Change the data type of a value
node
The current type of a value
node is displayed in the Parameter Editor. To change it:
- Click the More button (...).
- Select a new type.
If the type is an array, you can set its size and the default value for all elements in the Parameter Editor.
If the type is a vector or matrix, you can access ports for its components using the + and – icons.