From f87999eae8997266e90946f8fee6ac097ba918ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Fri, 15 Dec 2023 01:57:56 +0300 Subject: [PATCH] remove old classes --- port_drawer.gd | 54 ----------------------------------------- port_drawer.tscn | 16 ------------ test_node_renderer.gd | 53 ---------------------------------------- test_node_renderer.tscn | 39 ----------------------------- 4 files changed, 162 deletions(-) delete mode 100644 port_drawer.gd delete mode 100644 port_drawer.tscn delete mode 100644 test_node_renderer.gd delete mode 100644 test_node_renderer.tscn diff --git a/port_drawer.gd b/port_drawer.gd deleted file mode 100644 index 7c500d3..0000000 --- a/port_drawer.gd +++ /dev/null @@ -1,54 +0,0 @@ -extends HBoxContainer - -@onready var left_slot: ColorRect = $LeftSlot -@onready var right_slot: ColorRect = $RightSlot - -var text: String - -signal button_pressed - - -func set_input_enabled(enabled: bool) -> void: - left_slot.visible = enabled - - -func set_output_enabled(enabled: bool) -> void: - right_slot.visible = enabled - - -func add_label(text: String) -> void: - var l := Label.new() - add_child(l) - l.text = text - move_child(l, 1) - l.size_flags_horizontal = Control.SIZE_EXPAND_FILL - - -func add_field(placeholder: String = "") -> void: - var le := LineEdit.new() - add_child(le) - move_child(le, 1) - le.size_flags_horizontal = Control.SIZE_EXPAND_FILL - le.placeholder_text = placeholder - - le.text_changed.connect( - func(new_text: String): - text = new_text - ) - - -func get_text() -> String: - return text - - -func add_button(text: String) -> void: - var b := Button.new() - b.text = text - add_child(b) - move_child(b, 1) - b.size_flags_horizontal = Control.SIZE_EXPAND_FILL - - b.pressed.connect( - func(): - button_pressed.emit() - ) diff --git a/port_drawer.tscn b/port_drawer.tscn deleted file mode 100644 index a7bb465..0000000 --- a/port_drawer.tscn +++ /dev/null @@ -1,16 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://ddqtmahfxel26"] - -[ext_resource type="Script" path="res://port_drawer.gd" id="1_wot5w"] - -[node name="PortDrawer" type="HBoxContainer"] -script = ExtResource("1_wot5w") - -[node name="LeftSlot" type="ColorRect" parent="."] -visible = false -custom_minimum_size = Vector2(12, 12) -layout_mode = 2 - -[node name="RightSlot" type="ColorRect" parent="."] -visible = false -custom_minimum_size = Vector2(12, 12) -layout_mode = 2 diff --git a/test_node_renderer.gd b/test_node_renderer.gd deleted file mode 100644 index f8938e3..0000000 --- a/test_node_renderer.gd +++ /dev/null @@ -1,53 +0,0 @@ -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 i in node.input_ports.size(): - var input_port := node.input_ports[i] - 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(input_port.label) - input_port.value_callback = port_drawer.get_text - "button": - port_drawer.add_button(input_port.label) - port_drawer.button_pressed.connect(func(): - node._receive(i, DeckType.DeckTypeString.new("memes")) - ) - _: - 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] - match output_port.descriptor: - "field": - port_drawer.add_field(output_port.label) - output_port.value_callback = port_drawer.get_text - "button": - port_drawer.add_button(output_port.label) - port_drawer.button_pressed.connect(func(): - node.send(i, DeckType.DeckTypeBool.new(true)) - ) - _: - port_drawer.add_label(output_port.label) - - - diff --git a/test_node_renderer.tscn b/test_node_renderer.tscn deleted file mode 100644 index d50f9da..0000000 --- a/test_node_renderer.tscn +++ /dev/null @@ -1,39 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://ch8s1d7vobhi4"] - -[ext_resource type="Script" path="res://test_node_renderer.gd" id="1_85wy1"] - -[node name="TestNodeRenderer" type="PanelContainer"] -custom_minimum_size = Vector2(300, 0) -anchors_preset = -1 -anchor_right = 0.26 -anchor_bottom = 0.34 -offset_right = 0.47998 -offset_bottom = -0.320007 -script = ExtResource("1_85wy1") - -[node name="VBoxContainer" type="VBoxContainer" parent="."] -layout_mode = 2 - -[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -layout_mode = 2 - -[node name="ColorRect" type="ColorRect" parent="VBoxContainer/HBoxContainer"] -custom_minimum_size = Vector2(4, 0) -layout_mode = 2 -color = Color(1, 1, 0.34902, 1) - -[node name="NameLabel" type="Label" parent="VBoxContainer/HBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 -text = "Name" - -[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"] -layout_mode = 2 - -[node name="ElementsContainer" type="VBoxContainer" parent="VBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 -size_flags_vertical = 3