Node: Value

From Waltz
Jump to navigation Jump to search

The Value node allows you to store a constant value, store a changing value, or establish a reference to another value for convenience. The node takes a single Script Expression that will be evaluated to produce the output value.

When the Treat as constant option is enabled, other nodes are prevented from changing the valueExpression, making the node's valueExpression non-mutable.

When changing the value you wish to be stored by this node you should always assign the new value to the valueExpression, not the value. The value is recalculated every frame from the valueExpression. Setting the value property of the node will result in your new value being clobbered by the valueExpression within one frame.

If you wish to assign a new Script Expression to the valueExpression from another Script Expression, you must explicitly create a Script Expression object using the appropriate constructor Expression("your new script here"), and not by setting the valueExpression to a String representing your script.


Expected Type Details Default
valueExpression Any The value you wish to be represented by this node's value output. This can reference other nodes, perform calculations, or simply hold a value like a String or Number Math.sin(3/4 * Math.PI)
Treat as constant Boolean Note: This value is not represented by an Expression. When enabled, the valueExpression can not be modified from any Script Expression, making the valueExpression constant and unchanging unless manually changed in the node's Parameter Panel. false


Type Details
value Any Note: The parameter is read-only. The value calculated from the valueExpression.


There are no functions exposed by this node.

Example Usage

Assigning a number from another Script Expression

As in the example given for UDP Input Node, the value of this node can be changed from any other node that contains a Script Expression. Given a Value node with name myValue, the following script can assign a new number (the answer to life, the universe, and everything) to myValue:

$.myValue.valueExpression = 42;

Assigning a new Script Expression from another Script Expression

There are some cases where you may want to change how the output value is calculated without directly setting a new value every frame. This can be achieved using the appropriate constructor for a new Script Expression and assigning the result to this node's valueExpression.

Given two LED Processor Input Nodes, you may want to switch between which processor's touches output is being used elsewhere in the application without modify every reference to the processors every time the desired processor changes. Instead, you would tell all interested nodes to look for the output value of this node and then change the valueExpression of this node to reference the appropriate data source. Assuming our first processor node is called ledProcessorPrimary, our second processor node is named ledProcessorBackup, and our value node is named ledProcessorActive, the following script will assign our ledProcessorActive value output to the touches output of ledProcessorBackup:

$.ledProcessorActive.valueExpression = Expression("$.ledProcessorBackup.touches");

If you then wanted to restore to your primary data source, you would use:

$.ledProcessorActive.valueExpression = Expression("$.ledProcessorPrimary.touches");
Devices ArtNet Input · ArtNet Output · Interactive LED Processor · NDI™ Input · NDI™ Output · OSC Input · OSC Output · Projector · SensorLink · TCP · TUIO Output · UDP Input · UDP Output · Watchout Media Server
Objects LED Tile Layout · List · Map · Random Number · Simulated Touch · Timer · Value · Wave
Operators Blend · Change · Clip · Cluster Tracker · DMX Multiverse Merge · Ease · Filter · Hold · JSON Mapper · JSON Stringify · Logic · Math · Proximity · Range · Rotate · Scale · Shear · Smooth · Touch Mapper · Translate
Scenes External Scene · Material Scene
Materials Graph · Touch Material
Scripting Script Function · Script
Comments Comment