From a29e80bb9bbb1d7699f79b3ee4991cd6b4d8fafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Sat, 16 Mar 2024 09:31:27 +0000 Subject: [PATCH] add passthrough node (#116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #85 Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/116 Co-authored-by: Lera ElvoƩ Co-committed-by: Lera ElvoƩ --- classes/deck/nodes/general/passthrough.gd | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 classes/deck/nodes/general/passthrough.gd diff --git a/classes/deck/nodes/general/passthrough.gd b/classes/deck/nodes/general/passthrough.gd new file mode 100644 index 0000000..fec0f65 --- /dev/null +++ b/classes/deck/nodes/general/passthrough.gd @@ -0,0 +1,36 @@ +# (c) 2023-present Eroax +# (c) 2023-present Yagich +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +extends DeckNode + + +func _init() -> void: + name = "Passthrough" + node_type = name.to_snake_case() + description = "Receives a trigger input and passes it along, overwriting the data with the value from the second input." + + add_input_port( + DeckType.Types.ANY, + "Trigger", + "", + Port.UsageType.TRIGGER, + ) + + add_input_port( + DeckType.Types.ANY, + "Data", + "field", + Port.UsageType.VALUE_REQUEST, + ) + + add_output_port( + DeckType.Types.ANY, + "Output", + "", + Port.UsageType.TRIGGER, + ) + + +func _receive(_to_input_port: int, _data: Variant) -> void: + var data = await resolve_input_port_value_async(1) + send(0, data)