mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
39 lines
1.2 KiB
GDScript3
39 lines
1.2 KiB
GDScript3
|
extends PanelContainer
|
||
|
|
||
|
@onready var name_label: Label = %NameLabel
|
||
|
@onready var elements_container: VBoxContainer = %ElementsContainer
|
||
|
|
||
|
var node: DeckNode
|
||
|
const PortDrawer := preload("res://port_drawer.gd")
|
||
|
var port_drawer_scene := preload("res://port_drawer.tscn")
|
||
|
|
||
|
# THIS IS SUPER JANK AND A HACK FOR DEMONSTRATION PURPOSES
|
||
|
# PLEASE DO NOT ACTUALLY DO ANYTHING THIS CLASS DOES
|
||
|
# IN THE REAL PROJECT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||
|
|
||
|
func _ready() -> void:
|
||
|
name_label.text = node.name
|
||
|
for input_port in node.input_ports:
|
||
|
var port_drawer: PortDrawer = port_drawer_scene.instantiate()
|
||
|
elements_container.add_child(port_drawer)
|
||
|
port_drawer.set_input_enabled(true)
|
||
|
match input_port.descriptor:
|
||
|
"field":
|
||
|
port_drawer.add_field()
|
||
|
# "button":
|
||
|
# port_drawer.add_button(input_port.label)
|
||
|
_:
|
||
|
port_drawer.add_label(input_port.label)
|
||
|
|
||
|
for i in node.output_ports.size():
|
||
|
if elements_container.get_child_count() - 1 < i:
|
||
|
var pd: PortDrawer = port_drawer_scene.instantiate()
|
||
|
elements_container.add_child(pd)
|
||
|
var port_drawer: PortDrawer = elements_container.get_child(i)
|
||
|
port_drawer.set_output_enabled(true)
|
||
|
var output_port := node.output_ports[i]
|
||
|
if output_port.descriptor == "button":
|
||
|
port_drawer.add_button(output_port.label)
|
||
|
|
||
|
|