mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
32 lines
917 B
GDScript
32 lines
917 B
GDScript
extends GraphEdit
|
|
|
|
const NODE_SCENE := preload("res://graph_node_renderer/deck_node_renderer_graph_node.tscn")
|
|
|
|
var deck: Deck = Deck.new()
|
|
var button_node = preload("res://classes/deck/nodes/button.gd")
|
|
var print_node = preload("res://classes/deck/nodes/print.gd")
|
|
|
|
|
|
func _ready() -> void:
|
|
var add_button := Button.new()
|
|
add_button.text = "Button"
|
|
var add_print := Button.new()
|
|
add_print.text = "Print"
|
|
get_zoom_hbox().add_child(add_button)
|
|
get_zoom_hbox().add_child(add_print)
|
|
|
|
add_button.pressed.connect(
|
|
func():
|
|
var node := deck.add_node(button_node)
|
|
var node_renderer: DeckNodeRendererGraphNode = NODE_SCENE.instantiate()
|
|
node_renderer.node = node
|
|
add_child(node_renderer)
|
|
)
|
|
|
|
add_print.pressed.connect(
|
|
func():
|
|
var node := deck.add_node(print_node)
|
|
var node_renderer: DeckNodeRendererGraphNode = NODE_SCENE.instantiate()
|
|
node_renderer.node = node
|
|
add_child(node_renderer)
|
|
)
|