Node initialization
This commit is contained in:
parent
ae1d4d3885
commit
efbbc43e2b
6 changed files with 81 additions and 54 deletions
|
@ -1,11 +0,0 @@
|
||||||
extends Node
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
43
Node.tscn
43
Node.tscn
|
@ -1,43 +0,0 @@
|
||||||
[gd_scene format=3 uid="uid://b0arjg8r75f8y"]
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer"]
|
|
||||||
custom_minimum_size = Vector2(100, 100)
|
|
||||||
offset_right = 100.0
|
|
||||||
offset_bottom = 100.0
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Test"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "◉"
|
|
||||||
|
|
||||||
[node name="Label2" type="Label" parent="HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Testtesttesttesttest"
|
|
||||||
|
|
||||||
[node name="Label3" type="Label" parent="HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "◉"
|
|
||||||
|
|
||||||
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="HBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "◉"
|
|
||||||
|
|
||||||
[node name="Label2" type="Label" parent="HBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Test"
|
|
||||||
|
|
||||||
[node name="Label3" type="Label" parent="HBoxContainer2"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "◉"
|
|
17
Scenes/Nodes/Node Row.tscn
Normal file
17
Scenes/Nodes/Node Row.tscn
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[gd_scene format=3 uid="uid://bdcxusbd86oox"]
|
||||||
|
|
||||||
|
[node name="Node Row" type="HBoxContainer"]
|
||||||
|
|
||||||
|
[node name="Input" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "◉"
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Testtesttesttesttest"
|
||||||
|
clip_text = true
|
||||||
|
|
||||||
|
[node name="Output" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "◉"
|
21
Scenes/Nodes/Node.tscn
Normal file
21
Scenes/Nodes/Node.tscn
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[gd_scene format=3 uid="uid://b0arjg8r75f8y"]
|
||||||
|
|
||||||
|
[node name="Node" type="Panel"]
|
||||||
|
custom_minimum_size = Vector2(100, 100)
|
||||||
|
offset_right = 100.0
|
||||||
|
offset_bottom = 100.0
|
||||||
|
|
||||||
|
[node name="Holder" type="VBoxContainer" parent="."]
|
||||||
|
custom_minimum_size = Vector2(100, 100)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Title" type="Label" parent="Holder"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Test"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
clip_text = true
|
43
Scripts/GL_Node.gd
Normal file
43
Scripts/GL_Node.gd
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
extends Node2D
|
||||||
|
var rows : Dictionary
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
_init_visuals()
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _init_visuals():
|
||||||
|
var nodeVisuals = load("res://Scenes/Nodes/Node.tscn")
|
||||||
|
call_deferred("add_child",nodeVisuals)
|
||||||
|
|
||||||
|
func _update_visuals():
|
||||||
|
var holder = get_node("Node").get_node("Holder")
|
||||||
|
for child in holder.get_children():
|
||||||
|
if child.name != "Title":
|
||||||
|
child.queue_free()
|
||||||
|
for row in rows:
|
||||||
|
if row.get("type","default") == "default":
|
||||||
|
var nodeRow = load("res://Scenes/Nodes/Node Row.tscn")
|
||||||
|
holder.call_deferred("add_child",nodeRow)
|
||||||
|
(nodeRow.get_node("Label") as Label).text = row.get("name","???")
|
||||||
|
_set_inout_type(nodeRow.get_node("Input") as Label,row.get("input","null"))
|
||||||
|
_set_inout_type(nodeRow.get_node("Output") as Label,row.get("output","null"))
|
||||||
|
|
||||||
|
func _set_inout_type(label : Label , type : String):
|
||||||
|
match type:
|
||||||
|
"null":
|
||||||
|
label.visible = false
|
||||||
|
"float":
|
||||||
|
label.text = "◉"
|
||||||
|
label.add_theme_color_override("font_color", Color.ROYAL_BLUE)
|
||||||
|
"bool":
|
||||||
|
label.text = "◆"
|
||||||
|
label.add_theme_color_override("font_color", Color.ORANGE)
|
||||||
|
"color":
|
||||||
|
label.text = "▲"
|
||||||
|
label.add_theme_color_override("font_color", Color.WHITE_SMOKE)
|
Loading…
Add table
Reference in a new issue