diff --git a/Scenes/Node Types/Float.tscn b/Scenes/Node Types/Float.tscn new file mode 100644 index 0000000..60d2546 --- /dev/null +++ b/Scenes/Node Types/Float.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=3 uid="uid://b2bkg67ii1e4p"] + +[ext_resource type="PackedScene" uid="uid://b0arjg8r75f8y" path="res://Scenes/Nodes/Node.tscn" id="1_cnobp"] +[ext_resource type="Script" uid="uid://b325grg0122jn" path="res://Scripts/GL_Float.gd" id="2_cnobp"] + +[node name="Sine" type="Control"] +layout_mode = 3 +anchors_preset = 0 +mouse_filter = 1 + +[node name="Node" parent="." instance=ExtResource("1_cnobp")] +layout_mode = 0 +offset_right = 200.0 +script = ExtResource("2_cnobp") + +[connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"] +[connection signal="mouse_exited" from="Node" to="Node" method="mouse_exit"] diff --git a/Scenes/Node Types/Random.tscn b/Scenes/Node Types/Random.tscn new file mode 100644 index 0000000..9aea24f --- /dev/null +++ b/Scenes/Node Types/Random.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=3 uid="uid://dhn8qtyeny0sm"] + +[ext_resource type="PackedScene" uid="uid://b0arjg8r75f8y" path="res://Scenes/Nodes/Node.tscn" id="1_wswgt"] +[ext_resource type="Script" uid="uid://3vek1806nwqj" path="res://Scripts/GL_Random.gd" id="2_wswgt"] + +[node name="Sine" type="Control"] +layout_mode = 3 +anchors_preset = 0 +mouse_filter = 1 + +[node name="Node" parent="." instance=ExtResource("1_wswgt")] +layout_mode = 0 +offset_right = 200.0 +script = ExtResource("2_wswgt") + +[connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"] +[connection signal="mouse_exited" from="Node" to="Node" method="mouse_exit"] diff --git a/Scenes/Node Types/Sine.tscn b/Scenes/Node Types/Sine.tscn index f87868b..dff98c4 100644 --- a/Scenes/Node Types/Sine.tscn +++ b/Scenes/Node Types/Sine.tscn @@ -10,6 +10,7 @@ mouse_filter = 1 [node name="Node" parent="." instance=ExtResource("1_m6pki")] layout_mode = 0 +offset_right = 200.0 script = ExtResource("2_claki") [connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"] diff --git a/Scenes/Nodes/Node Row.tscn b/Scenes/Nodes/Node Row.tscn index c45db0e..77163a7 100644 --- a/Scenes/Nodes/Node Row.tscn +++ b/Scenes/Nodes/Node Row.tscn @@ -1,6 +1,9 @@ -[gd_scene load_steps=2 format=3 uid="uid://bdcxusbd86oox"] +[gd_scene load_steps=5 format=3 uid="uid://bdcxusbd86oox"] [ext_resource type="Script" uid="uid://dwl36vn5chqmq" path="res://Scripts/GL_Node_Point.gd" id="1_fygh4"] +[ext_resource type="Script" uid="uid://q5qlhwvjb16w" path="res://Scripts/GL_Node_Picker_Float.gd" id="2_vlx6y"] +[ext_resource type="Script" uid="uid://dflftb37a7ind" path="res://Scripts/GL_Node_Picker_Color.gd" id="3_tf34m"] +[ext_resource type="Script" uid="uid://b7ysqwtxh8pf" path="res://Scripts/GL_Node_Picker_Bool.gd" id="4_yal7b"] [node name="Node Row" type="HBoxContainer"] @@ -17,6 +20,29 @@ mouse_filter = 1 text = "Testtesttesttesttest" clip_text = true +[node name="Pick Float" type="HSlider" parent="."] +visible = false +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +max_value = 1.0 +step = 0.0 +script = ExtResource("2_vlx6y") + +[node name="Pick Color" type="ColorPickerButton" parent="."] +visible = false +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +color = Color(0.894432, 0.326066, 0.580441, 1) +script = ExtResource("3_tf34m") + +[node name="Pick Bool" type="CheckButton" parent="."] +visible = false +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +script = ExtResource("4_yal7b") + [node name="Output" type="Button" parent="." groups=["Outputs"]] layout_mode = 2 mouse_default_cursor_shape = 2 @@ -25,4 +51,7 @@ script = ExtResource("1_fygh4") [connection signal="mouse_entered" from="Input" to="Input" method="mouse_enter"] [connection signal="mouse_exited" from="Input" to="Input" method="mouse_exit"] +[connection signal="value_changed" from="Pick Float" to="Pick Float" method="value_changed"] +[connection signal="color_changed" from="Pick Color" to="Pick Color" method="color_changed"] +[connection signal="toggled" from="Pick Bool" to="Pick Bool" method="toggled"] [connection signal="button_down" from="Output" to="Output" method="_start_drag"] diff --git a/Scenes/Nodes/Node.tscn b/Scenes/Nodes/Node.tscn index d820fee..e0a91e6 100644 --- a/Scenes/Nodes/Node.tscn +++ b/Scenes/Nodes/Node.tscn @@ -1,13 +1,15 @@ -[gd_scene format=3 uid="uid://b0arjg8r75f8y"] +[gd_scene load_steps=2 format=3 uid="uid://b0arjg8r75f8y"] + +[ext_resource type="Theme" uid="uid://b3wjoiiv6sq22" path="res://UI/Themes/Default.tres" id="1_arhwt"] [node name="Node" type="Panel"] -custom_minimum_size = Vector2(100, 100) -offset_right = 100.0 -offset_bottom = 100.0 +custom_minimum_size = Vector2(200, 100) +offset_right = 200.0 +offset_bottom = 50.0 mouse_default_cursor_shape = 6 +theme = ExtResource("1_arhwt") -[node name="Holder" type="VBoxContainer" parent="."] -custom_minimum_size = Vector2(100, 100) +[node name="Margins" type="MarginContainer" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -15,7 +17,10 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="Title" type="Label" parent="Holder"] +[node name="Holder" type="VBoxContainer" parent="Margins"] +layout_mode = 2 + +[node name="Title" type="Label" parent="Margins/Holder"] layout_mode = 2 text = "Test" horizontal_alignment = 1 diff --git a/Scripts/GL_Float.gd b/Scripts/GL_Float.gd new file mode 100644 index 0000000..9b59f8d --- /dev/null +++ b/Scripts/GL_Float.gd @@ -0,0 +1,11 @@ +extends GL_Node + +func _ready(): + _set_title("Float") + _create_row("Output",null,0.0,true,0.0,1) + pass + +func _process(delta): + super._process(delta) + rows["Output"]["output"] = rows["Output"]["pickValue"] + _send_input("Output") diff --git a/Scripts/GL_Float.gd.uid b/Scripts/GL_Float.gd.uid new file mode 100644 index 0000000..fd42519 --- /dev/null +++ b/Scripts/GL_Float.gd.uid @@ -0,0 +1 @@ +uid://b325grg0122jn diff --git a/Scripts/GL_Node.gd b/Scripts/GL_Node.gd index 969e598..36b3e18 100644 --- a/Scripts/GL_Node.gd +++ b/Scripts/GL_Node.gd @@ -24,7 +24,7 @@ func _create_uuid(): uuid = rand.randi() func _update_visuals(): - var holder = get_node("Holder") + var holder = get_node("Margins").get_node("Holder") for child in holder.get_children(): if child.name != "Title": child.queue_free() @@ -39,11 +39,31 @@ func _update_visuals(): input.mainNode = self output.valueName = str(key) output.mainNode = self + if rows[key]["picker"] == true: + match typeof(rows[key]["pickValue"]): + TYPE_FLOAT: + assignPick(nodeRow.get_node("Pick Float"),str(key)) + var slider = nodeRow.get_node("Pick Float") as HSlider + slider.max_value = rows[key]["pickFloatMax"] + slider.value = rows[key]["pickValue"] + TYPE_BOOL: + assignPick(nodeRow.get_node("Pick Bool"),str(key)) + (nodeRow.get_node("Pick Float") as ColorPickerButton).color = rows[key]["pickValue"] + TYPE_COLOR: + assignPick(nodeRow.get_node("Pick Color"),str(key)) + (nodeRow.get_node("Pick Float") as CheckButton).button_pressed = rows[key]["pickValue"] + + _set_inout_type(nodeRow.get_node("Input") as Button,rows[key]["input"]) _set_inout_type(nodeRow.get_node("Output") as Button,rows[key]["output"]) +func assignPick(pick:GL_Node_Picker,key:String): + if pick != null: + pick.mainNode = self + pick.valueName = key + func give_input_point_pos(name:String) -> Vector2: - var holder = get_node("Holder").get_node(name) + var holder = get_node("Margins").get_node("Holder").get_node(name) if holder == null: return global_position else: @@ -65,10 +85,10 @@ func _set_inout_type(label:Button, value): label.visible = false func _set_title(name:String): - (get_node("Holder").get_node("Title") as Label).text = name + (get_node("Margins").get_node("Holder").get_node("Title") as Label).text = name -func _create_row(name:String,input,output): - rows[name] = {"input": input, "output": output, "connections": []} +func _create_row(name:String,input,output,picker:bool,pickDefault,pickFloatMaximum:float): + rows[name] = {"input": input, "output": output, "connections": [], "picker":picker,"pickValue":pickDefault,"backConnected":false,"pickFloatMax":pickFloatMaximum} _update_visuals() func _recieve_input(inputName:String,value): @@ -86,6 +106,11 @@ func _send_input(output_name: String): if target and input_name: target._recieve_input(input_name, rows[output_name]["output"]) +func _confirm_backConnection(input_name:String): + if !rows.has(input_name): + return + rows[input_name]["backConnected"] = true + func _create_connection(target:GL_Node,input_name:String,output_name:String): if not rows.has(output_name): return @@ -113,6 +138,7 @@ func _create_connection(target:GL_Node,input_name:String,output_name:String): connections.append(thenew) rows[output_name]["connections"] = connections + target._confirm_backConnection(input_name) func mouse_enter(): canDrag = true diff --git a/Scripts/GL_Node_Picker.gd b/Scripts/GL_Node_Picker.gd new file mode 100644 index 0000000..ba6792c --- /dev/null +++ b/Scripts/GL_Node_Picker.gd @@ -0,0 +1,9 @@ +extends Control +class_name GL_Node_Picker +var mainNode : GL_Node +var valueName:String + +func _process(delta): + if mainNode == null: + return + visible = !mainNode.rows[valueName]["backConnected"] diff --git a/Scripts/GL_Node_Picker.gd.uid b/Scripts/GL_Node_Picker.gd.uid new file mode 100644 index 0000000..7a8238a --- /dev/null +++ b/Scripts/GL_Node_Picker.gd.uid @@ -0,0 +1 @@ +uid://csv3oi505a3yw diff --git a/Scripts/GL_Node_Picker_Bool.gd b/Scripts/GL_Node_Picker_Bool.gd new file mode 100644 index 0000000..3488074 --- /dev/null +++ b/Scripts/GL_Node_Picker_Bool.gd @@ -0,0 +1,4 @@ +extends GL_Node_Picker + +func toggled(value:bool): + mainNode.rows[valueName]["pickValue"] = value diff --git a/Scripts/GL_Node_Picker_Bool.gd.uid b/Scripts/GL_Node_Picker_Bool.gd.uid new file mode 100644 index 0000000..ccf7147 --- /dev/null +++ b/Scripts/GL_Node_Picker_Bool.gd.uid @@ -0,0 +1 @@ +uid://b7ysqwtxh8pf diff --git a/Scripts/GL_Node_Picker_Color.gd b/Scripts/GL_Node_Picker_Color.gd new file mode 100644 index 0000000..db8dbd2 --- /dev/null +++ b/Scripts/GL_Node_Picker_Color.gd @@ -0,0 +1,4 @@ +extends GL_Node_Picker + +func color_changed(value:Color): + mainNode.rows[valueName]["pickValue"] = value diff --git a/Scripts/GL_Node_Picker_Color.gd.uid b/Scripts/GL_Node_Picker_Color.gd.uid new file mode 100644 index 0000000..357aaea --- /dev/null +++ b/Scripts/GL_Node_Picker_Color.gd.uid @@ -0,0 +1 @@ +uid://dflftb37a7ind diff --git a/Scripts/GL_Node_Picker_Float.gd b/Scripts/GL_Node_Picker_Float.gd new file mode 100644 index 0000000..530ed11 --- /dev/null +++ b/Scripts/GL_Node_Picker_Float.gd @@ -0,0 +1,4 @@ +extends GL_Node_Picker + +func value_changed(value:float): + mainNode.rows[valueName]["pickValue"] = value diff --git a/Scripts/GL_Node_Picker_Float.gd.uid b/Scripts/GL_Node_Picker_Float.gd.uid new file mode 100644 index 0000000..569c7a0 --- /dev/null +++ b/Scripts/GL_Node_Picker_Float.gd.uid @@ -0,0 +1 @@ +uid://q5qlhwvjb16w diff --git a/Scripts/GL_Random.gd b/Scripts/GL_Random.gd new file mode 100644 index 0000000..af006df --- /dev/null +++ b/Scripts/GL_Random.gd @@ -0,0 +1,14 @@ +extends GL_Node +var rng : RandomNumberGenerator + +func _ready(): + _set_title("Random") + _create_row("Output",null,0.0,false,null,0) + rng = RandomNumberGenerator.new() + rng.seed = Time.get_ticks_msec() + pass + +func _process(delta): + super._process(delta) + rows["Output"]["output"] = rng.randf() + _send_input("Output") diff --git a/Scripts/GL_Random.gd.uid b/Scripts/GL_Random.gd.uid new file mode 100644 index 0000000..38999eb --- /dev/null +++ b/Scripts/GL_Random.gd.uid @@ -0,0 +1 @@ +uid://3vek1806nwqj diff --git a/Scripts/GL_Search.gd b/Scripts/GL_Search.gd index 972dd16..88557e0 100644 --- a/Scripts/GL_Search.gd +++ b/Scripts/GL_Search.gd @@ -1,6 +1,6 @@ extends Control -var rows : Dictionary = {"Sine":99} +var rows : Dictionary = {"Sine":99,"Random":99,"Float":99} var searching : bool var lastMousePos : Vector2 diff --git a/Scripts/GL_Sine.gd b/Scripts/GL_Sine.gd index ba20afd..4898744 100644 --- a/Scripts/GL_Sine.gd +++ b/Scripts/GL_Sine.gd @@ -2,11 +2,13 @@ extends GL_Node func _ready(): _set_title("Sine") - _create_row("Output",null,0.0) - _create_row("Length",0.01,null) + _create_row("Output",null,0.0,false,null,0) + _create_row("Length",0.01,null,true,0.01,0.05) pass func _process(delta): super._process(delta) - rows["Output"]["output"] = sin(Time.get_ticks_msec() * rows["Length"].get("input",1)) + if rows["Length"]["picker"] == true && rows["Length"]["backConnected"] == false: + rows["Length"]["input"] = rows["Length"]["pickValue"] + rows["Output"]["output"] = (sin(Time.get_ticks_msec() * rows["Length"].get("input",1)) / 2) + 0.5 _send_input("Output") diff --git a/UI/Fonts/lectus.otf b/UI/Fonts/lectus.otf new file mode 100644 index 0000000..48bbc47 Binary files /dev/null and b/UI/Fonts/lectus.otf differ diff --git a/UI/Fonts/lectus.otf.import b/UI/Fonts/lectus.otf.import new file mode 100644 index 0000000..e3ae67c --- /dev/null +++ b/UI/Fonts/lectus.otf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://d1fox3cy2qhx" +path="res://.godot/imported/lectus.otf-7c6965b88aea060243f3c50fbfb098b9.fontdata" + +[deps] + +source_file="res://UI/Fonts/lectus.otf" +dest_files=["res://.godot/imported/lectus.otf-7c6965b88aea060243f3c50fbfb098b9.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/Fonts/lectus.ttf b/UI/Fonts/lectus.ttf new file mode 100644 index 0000000..58aafa3 Binary files /dev/null and b/UI/Fonts/lectus.ttf differ diff --git a/UI/Fonts/lectus.ttf.import b/UI/Fonts/lectus.ttf.import new file mode 100644 index 0000000..09c3b14 --- /dev/null +++ b/UI/Fonts/lectus.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://kjbv8xwyxfmp" +path="res://.godot/imported/lectus.ttf-06bbf50f1312c892a54d0a5c8d6eacee.fontdata" + +[deps] + +source_file="res://UI/Fonts/lectus.ttf" +dest_files=["res://.godot/imported/lectus.ttf-06bbf50f1312c892a54d0a5c8d6eacee.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/Themes/Default.tres b/UI/Themes/Default.tres new file mode 100644 index 0000000..58cbc50 --- /dev/null +++ b/UI/Themes/Default.tres @@ -0,0 +1,13 @@ +[gd_resource type="Theme" load_steps=3 format=3 uid="uid://b3wjoiiv6sq22"] + +[ext_resource type="FontFile" uid="uid://d1fox3cy2qhx" path="res://UI/Fonts/lectus.otf" id="1_crk4k"] +[ext_resource type="StyleBox" uid="uid://crsm0yvhb6rv1" path="res://UI/Themes/NodeTheme.tres" id="1_ne1i0"] + +[resource] +Label/font_sizes/font_size = 12 +Label/fonts/font = ExtResource("1_crk4k") +MarginContainer/constants/margin_bottom = 10 +MarginContainer/constants/margin_left = 10 +MarginContainer/constants/margin_right = 10 +MarginContainer/constants/margin_top = 10 +Panel/styles/panel = ExtResource("1_ne1i0") diff --git a/UI/Themes/NodeTheme.tres b/UI/Themes/NodeTheme.tres new file mode 100644 index 0000000..eaf2651 --- /dev/null +++ b/UI/Themes/NodeTheme.tres @@ -0,0 +1,11 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://crsm0yvhb6rv1"] + +[resource] +bg_color = Color(0.178668, 0.310803, 0.118615, 1) +border_width_left = 5 +border_width_top = 5 +border_width_right = 5 +border_width_bottom = 5 +border_blend = true +corner_radius_top_left = 2 +corner_radius_top_right = 2