You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6.6 KiB

Add a Trigger or Data port to a Script Graph

A Script Graph used as a Subgraph can receive data and logic from its parent graph. Add and define ports on a graph to choose what data graphs can send and receive.

For more information about Subgraphs, see Subgraphs and State Units.

An image of the Graph Inspector, that displays the options for how to add ports to an open Script Graph.

Add ports from a graph

To add a Trigger Input, Trigger Output, Data Input, or Data Output port to a Script Graph:

  1. Open the Script Graph you want to edit in the Graph window.

  2. With no nodes or groups selected in the graph, open the Graph Inspector.

  3. Select Add (+) under the port type you want to add:

    • Trigger Inputs

    • Trigger Outputs

    • Data Inputs

    • Data Outputs

  4. In the Key field, enter a unique key name for the port. The Key value can't match the Key of any existing ports on the current Script Graph.

  5. NOTE

    If two Key values are the same on the same graph, Visual Scripting ignores the second port definition and displays a warning in the Graph Inspector. If you change the Key value for a port after you've made a connection to that port in a graph, the connections break and you must reconnect them.

  6. In the Label field, enter a label to display for the port. The label displays on the Subgraph node and its Input or Output node.

  7. NOTE

    If you don't set a Label, Visual Scripting uses the value from the Key field.

  8. In the Summary field, enter a brief summary of the port to display in the Graph Inspector when you select the Subgraph node, Input node, or Output node.

  9. Toggle Hide Label to do the following:

    • Enable Hide Label to hide the port label on any Subgraph node, Input node, or Output node.

    • Disable Hide Label to display the data from the Label field.

  10. (Data Inputs and Data Outputs Only) Set a data type for the port:

    1. Select the Type list to open the Type menu.

    2. Select a data type from the list to set the data type the port accepts.

  11. (Data Inputs Only) Enable Has Default Value to display the Default Value field. Disable Has Default Value to hide the Default Value field.

    1. In the Default Value field, enter the default value the port uses if it doesn't receive a data input while the Script Graph runs.

Add ports with Input and Output nodes

You can also use an Input node or an Output node to define ports on a Script Graph:

  1. Open the Script Graph you want to edit in the Graph window.

  2. [!include[open-fuzzy-finder](./snippets/vs-open-fuzzy-finder.md)]

  3. Go to Nesting.

  4. Do one of the following:

    • To add a Trigger Input or Data Input port to the graph, select Input.

    • To add a Trigger Output or Data Output port to the graph, select Output.

  5. Select the new Input or Output node in the graph.

  6. Open the Graph Inspector.

  7. In the Key field, enter a unique key name for the port. The Key value can't match the Key of any existing ports on the current Script Graph.

  8. NOTE

    If two Key values are the same on the same graph, Visual Scripting ignores the second port definition and displays a warning in the Graph Inspector. If you change the Key value for a port after you've made a connection to that port in a graph, the connections break and you must reconnect them.

  9. In the Label field, enter a label to display for the port. The label displays on the Subgraph node and its Input or Output node.

  10. NOTE

    If you don't set a Label, Visual Scripting uses the value from the Key field.

  11. In the Summary field, enter a brief summary of the port to display in the Graph Inspector when you select the Subgraph node, Input node, or Output node.

  12. Toggle Hide Label to do the following:

    • Enable Hide Label to hide the port label on any Subgraph node, Input node, or Output node.

    • Disable Hide Label to display the data from the Label field.

  13. (Data Inputs and Data Outputs Only) Set a data type for the port:

    1. Select the Type list to open the Type menu.

    2. Select a data type from the list to set the data type the port accepts.

  14. (Data Inputs Only) Enable Has Default Value to display the Default Value field. Disable Has Default Value to hide the Default Value field.

    1. In the Default Value field, enter the default value the port uses if it doesn't receive a data input while the Script Graph runs.

Next steps

Add the Script Graph as a Subgraph in another Script Graph. For more information on how to add a Script Graph as a Subgraph, see Add a Subgraph to a Script Graph.

For more information on the port types on a Script Graph, see Subgraph node.

The defined Trigger and Data ports affect the ports on the Input and Output nodes in a Script Graph. For more information, see Input node and Output node.