Connections
Transmitting Data Between Modules
This article explains the different types of connections in Proto and how to manage them.
Introduction
Connections provide a path between modules that transmit data from one connector to another. They are represented in the Builder as the connecting lines drawn between modules. Connections can be made between any modules’ connectors but must always occur between the output connector of one module and input connector of another module. There are also data type and execution path restrictions that prevent certain connections from being made. Specifically, a connection cannot be made between an output connector and an input connector with incompatible data types because it could never deliver valid data to the input connector of the receiving module. Similarly, connections cannot be made to create a circular execution path—a path in which the output of one module is sent to the input of a module already connected earlier in the connection path—without containing a passive connection. In both cases, the invalid connection is refused and an explanatory message is displayed.
Making Connections
The first step in making a connection between two modules is figuring out which input and output connectors the connection is going to join. You can browse the input and output menus of any module in the builder by clicking on the connector symbol on the left (for the input menu) or right (for the output menu) of the module. When the menu appears, either click on or hover the mouse over on a menu item with a right-pointing arrow on the right to expand the connections under that menu. As you mouse over a connector, data type information about that connector appears in the Guide. Once you have found an appropriate connector, click on that connector to close the menu and begin the connection. Note that a connection can begin from either an input connector or an output connector: the directionality of data flow is not affected by where it begins, as data always travels from the output connector of a module to the input connector of another module.
The connection is now following the mouse in the Builder, but you do not need to hold down the mouse button to continue making the connection. Next, find the other end of the connection by browsing for the recipient connector in a similar fashion. Once a compatible connector is found, click on it to complete the connection. The connection will then appear in the Builder and messages will flow between those modules when triggered. It is possible to make multiple connections between the same two modules. For example, you may want a single slider to set the value of multiple variables in a Formula module by making multiple connections between the Slider’s “Get Value” output connector and the Formula’s “Set Variable” input connectors. More information about the function, data type compatibility, and fire-on-connect status of a module’s connectors can be found in its module documentation.
Passive Connections
In order to allow data to return to its originating module any looped execution paths must contain a passive connection. A passive connection transmits messages to its receiving module’s input connector but does not allow that module to send any resulting messages to any of its output connectors, thus preventing infinite loops by restricting looped connection paths to a single cycle per execution. To make a connection passive, either choose when prompted by Proto when it detects a looped path in a connection being made, or right click on a connection, find it in the displayed context menu, and select Passive.
Representing Connections in the Builder
Different types of connections are displayed differently in the Builder. Regular connections are colored a light gray and are surrounded by a blue highlight when selected. Multiple regular connections between two modules are represented as a single connection line colored a slightly darker shade of gray. Passive connections are colored green, while plug-in connections are depicted with a wider, dark gray line.
Deleting Connections
To delete a connection, right-click on it in the Builder and select Delete from the context menu that appears. It is also possible to highlight a connection in the Builder and press the DELETE key on your keyboard. If multiple connections exist between the two modules that the Builder connection is joining, the delete operation will only remove a single connection, with the most recently made connection being deleted first.
Data Viewer
The Data Viewer is a window that you can open in the Builder to view the data that last traveled over any connection. It is often necessary to use the Data Viewer to understand how data is affected by a module’s processing or to find the reason that a custom module entered an error state. You can have multiple Data Viewer windows open at the same time. A preview Data Viewer is displayed when the mouse hovers over a connection in the Builder.
To open a Data Viewer window:- Left-click a connection in the Builder and hold the mouse button down for one second. Select the connection that you want to view and a temporary Data Viewer is shown next to the selected connection.
- Right-click a connection in the Builder and select View Data from the connection’s submenu for which you would like to open a Data Viewer. The Data Viewer will remain open until you close it by clicking the in its top right corner.