图形输出节点
概述
Graph Output节点用于定义图的输出。该节点的每个实例代表图的一个单独输出。传入此节点的值将成为图整体输出的一部分。
当图形被用作子图时,图形中的每个Graph Output Node都会变成子图节点上的一个输出端口。
- 输入
- 输出
- 编辑器设置
输入项
标题 | 数据类型 | 描述 | 默认值 | 备注 |
---|---|---|---|---|
Value | any | The value to be outputted from the graph. The data type of the value should match the data type configured in the node settings. | (required) |
输出
标题 | 数据类型 | 描述 | 备注 |
---|---|---|---|
Value Output | any | The value that was passed into the node. The data type of the output will match the data type configured in the node settings. |
编辑器设置
设置 | 描述 | 默认值 | 使用输入切换 | 输入数据类型 |
---|---|---|---|---|
ID | The ID of the output. This will be used as the name and ID of the output port of the graph. | output | No | string |
Data Type | The data type of the value to be outputted from the graph. This should match the data type of the value passed into the node. If the data type of the input data does not match, it will be coerced into this type. | string | No | N/A |
示例1:为图形定义输出
- 创建一个Text Node并将值设置为
Hello, world!
。 - 创建一个Graph Output节点,将ID设置为
greeting
,数据类型设置为String
。 - 将文本节点连接到图形输出节点的
Value
输入端口。 - 创建另一个图表,并向其中添加一个子图节点。将子图节点的Graph ID设置为步骤1中创建的图表的ID。
- 运行图表。您应该看到子图的
greeting
输出是"Hello, world!"
错误处理
如果传入Graph Output节点的值的数据类型与节点设置中配置的数据类型不匹配,该节点将会报错。
常见问题
问:我可以在一个图表中使用多个Graph Output节点吗?
A: 是的,您可以在一个图中拥有多个Graph Output节点。每个Graph Output节点代表图的一个独立输出。每个Graph Output节点的ID应该是唯一的。
问:如果图形输出节点的ID不唯一会发生什么?
A: 如果图形输出节点的ID不唯一,图形的输出将包含最后一个被处理的具有该ID的图形输出节点的值。
问:我能否使用Graph Output节点输出数组或对象?
A: 是的,您可以使用Graph Output节点输出任何数据类型。传入该节点的值的数据类型应与节点设置中配置的数据类型相匹配。