More work
This commit is contained in:
parent
445d02ad0f
commit
e10b6ec7d4
9 changed files with 144 additions and 5 deletions
16
Scenes/Node Types/Sine.tscn
Normal file
16
Scenes/Node Types/Sine.tscn
Normal file
|
@ -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")
|
14
Scenes/UI/Node Map.tscn
Normal file
14
Scenes/UI/Node Map.tscn
Normal file
|
@ -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
|
16
Scenes/UI/Search Row.tscn
Normal file
16
Scenes/UI/Search Row.tscn
Normal file
|
@ -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
|
36
Scenes/UI/Search.tscn
Normal file
36
Scenes/UI/Search.tscn
Normal file
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
@ -20,7 +33,6 @@ func _start_drag():
|
|||
|
||||
dragging = true
|
||||
|
||||
|
||||
func _finish_drag():
|
||||
if not dragging:
|
||||
return
|
||||
|
|
43
Scripts/GL_Search.gd
Normal file
43
Scripts/GL_Search.gd
Normal file
|
@ -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()
|
||||
|
1
Scripts/GL_Search.gd.uid
Normal file
1
Scripts/GL_Search.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://c46u2u0lup1mm
|
|
@ -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]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue