5. How compositions process data

5.1. Where data comes from

Over time, data in your composition can remain the same (be constant), or change as data flows through data-and-event cables. In some cases, data can come from outside your composition using interface nodes.

5.1.1. Constant input port values

Instead of passing data through a cable, you can give a data-and-event input port a constant value. A constant value is constant because, unlike data coming in from a cable, which can change from time to time, a constant value remains the same unless you edit it.

For many types of data (such as integers and text), you can edit a constant value by double-clicking on the constant value attached to an input port. This will pop up an input editor that lets you change the constant value. (If nothing happens when you double-click on the constant value, then the Vuo Editor doesn’t have an input editor for that data type. To change the data for that input port, you have to connect a cable.)

When using an input editor to edit text, you can enter multiple lines by using ⌥↵ (instead of ) to insert a line break.

If you edit a constant value for a node’s input port, the node will use the new port value the next time it executes. Setting a constant value won’t cause the node to execute.

5.1.2. Default input port values

When you add a node to a composition, each input port has a preset constant value called its default value. The default value for an input port is the same for all nodes of a given type. For example, the Increment port of all Count nodes defaults to 1. The port stays at its default value until it receives an event.

If you disconnect a data-and-event cable to a port that previously had a constant value, then the port retains the last value it received from the cable. If you did not set a constant value, it goes back to its default value.

5.1.3. Drawers

Some input ports accept a list of values rather than a single value. If no cable is connected, a list input port has a special attachment called a drawer that lets you input each item of the list separately. For each input port within the drawer, you can either connect a cable to it or set its constant value.

In most cases, you can change the number of items in the drawer. (The one exception is the drawer on the Calculate node’s Values input port, which changes automatically when you edit the Expression input port’s constant value.) To change the number of items in a drawer, you can either drag on its handle (the bar along the bottom of the drawer) or right-click on the drawer and select Add Input Port or Remove Input Port.

In the following composition, which calculates the volume of a box, the dr Multiply node and the Append Texts node have drawers.

Below is an example of a composition that uses drawers. It calculates the volume of a 10 x 11 x 5 box. The height, length, and width of the box are listed in the drawer on the Multiply node. The pieces of text that are combined to form the console output go into the drawer of the Append Texts node.

When you edit a drawer’s constant values or change the number of drawer items, this affects the attached list input port in the same way as if you had edited a constant value on the list input port itself. For example, in the composition above, the Multiply node’s Values input port contains the list 10, 11, 5. When the Multiply node receives an event from Fire on Start, it calculates the product of those numbers, 550, and sends that through its output cable.

5.1.4. Interface nodes

Some nodes interact with the world outside the composition — such as windows, files, networks, and devices.

Nodes that bring information into the composition from the outside world and/or affect the outside world are called interface nodes. An example of an interface node is the Fetch Image node, which can download an image from the Internet. Another example is the Display Console Window node, which reads text typed in a console window and writes text to that window.

Instead of Vuo's interface and non-interface nodes, Quartz Composer has an execution mode for each patch: provider, consumer, or processor. A patch's execution mode not only indicates how it interacts with the outside world, but also controls when it executes and whether it can be embedded in macro patches.

Interface nodes have three radio arcs in the top-right corner, symbolizing that they send or receive data with the world outside your composition.

5.1.5. Dragging files onto the canvas to create an interface node

In Vuo, dragging an audio, video, image, scene, or projection mesh file onto the canvas will create the appropriate interface node with that file as input. For example, when you drag an image onto the canvas, the Editor will create a Fetch Image node with the file path entered in the URL input port. The default will be the file’s relative path. To enter an absolute path, hold down the option key when dragging the file on the canvas.