From e10b6ec7d472d618469b389f795774660ddfb3b7 Mon Sep 17 00:00:00 2001 From: The 64th Gamer <69170079+The64thGamer@users.noreply.github.com> Date: Mon, 7 Apr 2025 03:04:59 -0600 Subject: [PATCH] More work --- Scenes/Node Types/Sine.tscn | 16 ++++++++++++++ Scenes/UI/Node Map.tscn | 14 ++++++++++++ Scenes/UI/Search Row.tscn | 16 ++++++++++++++ Scenes/UI/Search.tscn | 36 +++++++++++++++++++++++++++++++ Scripts/GL_Node.gd | 6 +++--- Scripts/GL_Node_Point.gd | 14 +++++++++++- Scripts/GL_Search.gd | 43 +++++++++++++++++++++++++++++++++++++ Scripts/GL_Search.gd.uid | 1 + project.godot | 3 ++- 9 files changed, 144 insertions(+), 5 deletions(-) create mode 100644 Scenes/Node Types/Sine.tscn create mode 100644 Scenes/UI/Node Map.tscn create mode 100644 Scenes/UI/Search Row.tscn create mode 100644 Scenes/UI/Search.tscn create mode 100644 Scripts/GL_Search.gd create mode 100644 Scripts/GL_Search.gd.uid diff --git a/Scenes/Node Types/Sine.tscn b/Scenes/Node Types/Sine.tscn new file mode 100644 index 0000000..7d25d69 --- /dev/null +++ b/Scenes/Node Types/Sine.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=3 uid="uid://drsi02xhgrtsc"] + +[ext_resource type="PackedScene" uid="uid://b0arjg8r75f8y" path="res://Scenes/Nodes/Node.tscn" id="1_m6pki"] +[ext_resource type="Script" uid="uid://cetd8fp5y2ls0" path="res://Scripts/GL_Sine.gd" id="2_claki"] + +[node name="Sine" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Node" parent="." instance=ExtResource("1_m6pki")] +layout_mode = 0 +script = ExtResource("2_claki") diff --git a/Scenes/UI/Node Map.tscn b/Scenes/UI/Node Map.tscn new file mode 100644 index 0000000..4d30195 --- /dev/null +++ b/Scenes/UI/Node Map.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=2 format=3 uid="uid://c57u187iciexi"] + +[ext_resource type="PackedScene" uid="uid://mowdu1i1rldt" path="res://Scenes/UI/Search.tscn" id="1_xwfut"] + +[node name="NodeMap" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Search" parent="." instance=ExtResource("1_xwfut")] +layout_mode = 1 diff --git a/Scenes/UI/Search Row.tscn b/Scenes/UI/Search Row.tscn new file mode 100644 index 0000000..68595c9 --- /dev/null +++ b/Scenes/UI/Search Row.tscn @@ -0,0 +1,16 @@ +[gd_scene format=3 uid="uid://2gr7oambcxxl"] + +[node name="Search Row" type="HBoxContainer"] +size_flags_vertical = 0 + +[node name="Button" type="Button" parent="."] +layout_mode = 2 +size_flags_horizontal = 3 +text = "The Crazy Node of Crazy" +alignment = 0 +clip_text = true + +[node name="Label" type="Label" parent="."] +layout_mode = 2 +text = "x3" +horizontal_alignment = 2 diff --git a/Scenes/UI/Search.tscn b/Scenes/UI/Search.tscn new file mode 100644 index 0000000..4d6b59f --- /dev/null +++ b/Scenes/UI/Search.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=2 format=3 uid="uid://mowdu1i1rldt"] + +[ext_resource type="Script" uid="uid://c46u2u0lup1mm" path="res://Scripts/GL_Search.gd" id="1_g1g1x"] + +[node name="Search" type="Control"] +custom_minimum_size = Vector2(200, 200) +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = -952.0 +offset_bottom = -448.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_g1g1x") + +[node name="Panel" type="Panel" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ScrollContainer" type="ScrollContainer" parent="Panel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +horizontal_scroll_mode = 0 + +[node name="Container" type="VBoxContainer" parent="Panel/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 diff --git a/Scripts/GL_Node.gd b/Scripts/GL_Node.gd index 7d7050f..cc3adce 100644 --- a/Scripts/GL_Node.gd +++ b/Scripts/GL_Node.gd @@ -1,4 +1,4 @@ -extends Node2D +extends Panel class_name GL_Node var rows : Dictionary var uuid : int #REMEMBER TO SET THIS ON CREATION @@ -16,7 +16,7 @@ func _create_uuid(): uuid = rand.randi() func _init_visuals(): - var nodeVisuals = load("res://Scenes/Nodes/Node.tscn") + var nodeVisuals = load("res://Scenes/Nodes/Node.tscn").instantiate() call_deferred("add_child",nodeVisuals) func _update_visuals(): @@ -26,7 +26,7 @@ func _update_visuals(): child.queue_free() for key in rows: if rows[key].get("type","default") == "default": - var nodeRow = load("res://Scenes/Nodes/Node Row.tscn") + var nodeRow = load("res://Scenes/Nodes/Node Row.tscn").instantiate() holder.call_deferred("add_child",nodeRow) (nodeRow.get_node("Label") as Label).text = str(key) (nodeRow.get_node("Input").get_note("Point") as GL_Node_Point).valueName = str(key) diff --git a/Scripts/GL_Node_Point.gd b/Scripts/GL_Node_Point.gd index 103dfc3..030e809 100644 --- a/Scripts/GL_Node_Point.gd +++ b/Scripts/GL_Node_Point.gd @@ -7,6 +7,19 @@ var mainNode : GL_Node var valueName:String var dragging:bool +var previewLine:Line2D = null + +func process(delta): + if dragging: + if previewLine == null: + previewLine = Line2D.new() + previewLine.width = 10 + previewLine.default_color = Color.WHITE + previewLine.add_point(Vector2.ZERO) + previewLine.add_point(Vector2.ZERO) + previewLine.points[0] = position + previewLine.points[1] = get_viewport().get_mouse_position() + func _on_input_event(viewport, event, shape_idx): if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT: if event.pressed: @@ -19,7 +32,6 @@ func _start_drag(): return dragging = true - func _finish_drag(): if not dragging: diff --git a/Scripts/GL_Search.gd b/Scripts/GL_Search.gd new file mode 100644 index 0000000..ab90319 --- /dev/null +++ b/Scripts/GL_Search.gd @@ -0,0 +1,43 @@ +extends Control + +var rows : Dictionary = {"Sine":99} +var searching : bool +var lastMousePos : Vector2 + +func _ready(): + _set_State(false) + _set_rows() + +func _process(delta): + pass + +func _input(event): + if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_RIGHT: + if event.pressed: + _set_State(!searching) + +func _set_State(state:bool): + searching = state + visible = searching + lastMousePos = get_viewport().get_mouse_position() + +func _set_rows(): + var container = get_node("Panel").get_node("ScrollContainer").get_node("Container") + for child in container.get_children(): + child.queue_free() + for key in rows: + var row = load("res://Scenes/UI/Search Row.tscn").instantiate() + var button = (row.get_node("Button") as Button) + button.text = str(key) + button.pressed.connect(func(): + _create_node(button.text) + ) + container.call_deferred("add_child",row) + +func _create_node(name:String): + var node = load("res://Scenes/Node Types/" + name + ".tscn").instantiate() + get_tree().root.add_child(node) + print("res://Scenes/Node Types/" + name + ".tscn") + node = node as GL_Node + node._create_uuid() + diff --git a/Scripts/GL_Search.gd.uid b/Scripts/GL_Search.gd.uid new file mode 100644 index 0000000..db4db02 --- /dev/null +++ b/Scripts/GL_Search.gd.uid @@ -0,0 +1 @@ +uid://c46u2u0lup1mm diff --git a/project.godot b/project.godot index a6acbaf..a2369ac 100644 --- a/project.godot +++ b/project.godot @@ -13,8 +13,9 @@ config_version=5 config/name="Give LIFE" config/description="The sequel to Faz-Anim" config/version="0.1a" +run/main_scene="uid://c57u187iciexi" config/features=PackedStringArray("4.4", "Forward Plus") -config/icon="res://icon.svg" +config/icon="uid://c1usct57qv2oa" [filesystem]