More work
This commit is contained in:
parent
445d02ad0f
commit
e10b6ec7d4
9 changed files with 144 additions and 5 deletions
|
@ -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:
|
||||
|
@ -19,7 +32,6 @@ func _start_drag():
|
|||
return
|
||||
|
||||
dragging = true
|
||||
|
||||
|
||||
func _finish_drag():
|
||||
if not dragging:
|
||||
|
|
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
|
Loading…
Add table
Add a link
Reference in a new issue