mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
a518e46b0f
closes #97 when copying group nodes across decks (including in and out of groups), they become unique and completely independent copies of the original. this is done recursively, so in the case of copying: - group X - contained in Deck A - has another group Z into Deck B, group X will become group Y, group Z will become group W. there is a rare bug that will sometimes cause the deck to save with no groups at all, which i haven't been able to hunt down and don't know how to replicate at the moment. Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/143 Co-authored-by: Lera Elvoé <yagich@poto.cafe> Co-committed-by: Lera Elvoé <yagich@poto.cafe>
40 lines
887 B
GDScript
40 lines
887 B
GDScript
# (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 = "Print"
|
|
node_type = name.to_snake_case()
|
|
description = "Print a value to the console."
|
|
|
|
add_input_port(
|
|
DeckType.Types.ANY,
|
|
"Data to print",
|
|
"field"
|
|
)
|
|
|
|
add_input_port(
|
|
DeckType.Types.ANY,
|
|
"Trigger",
|
|
"button",
|
|
Port.UsageType.TRIGGER,
|
|
).button_pressed.connect(_receive.bind(1, null))
|
|
|
|
|
|
func _receive(to_input_port: int, data: Variant) -> void:
|
|
print(_belonging_to.get_reference_count())
|
|
var data_to_print := ""
|
|
if to_input_port == 1:
|
|
data = await resolve_input_port_value_async(0)
|
|
|
|
if data == null:
|
|
data_to_print = "<nothing>"
|
|
else:
|
|
data_to_print = str(data)
|
|
|
|
if data_to_print.is_empty():
|
|
data_to_print = "<nothing>"
|
|
|
|
DeckHolder.logger.log_node(data_to_print)
|