merge in 0.2 changes

This commit is contained in:
KawaiiZenbo 2025-04-09 09:28:03 -07:00
parent d9a41c15c6
commit 5bb84956ff
20 changed files with 331 additions and 16 deletions

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://ul4mdxf3qx5b"]
[ext_resource type="PackedScene" uid="uid://b0arjg8r75f8y" path="res://Scenes/Nodes/Node.tscn" id="1_qf2se"]
[ext_resource type="Script" uid="uid://3rg2qunautt5" path="res://Scripts/GL_Bool.gd" id="2_qf2se"]
[node name="Node" type="Control"]
layout_mode = 3
anchors_preset = 0
mouse_filter = 1
[node name="Node" parent="." groups=["GL Node"] instance=ExtResource("1_qf2se")]
layout_mode = 0
tooltip_text = "A bool refers to something on or off. Can also connect to float inputs as a converted 0.0 or 1.0."
script = ExtResource("2_qf2se")
[connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"]
[connection signal="mouse_exited" from="Node" to="Node" method="mouse_exit"]

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://dd1nkkq5jvu6t"]
[ext_resource type="PackedScene" uid="uid://b0arjg8r75f8y" path="res://Scenes/Nodes/Node.tscn" id="1_ouhok"]
[ext_resource type="Script" uid="uid://bi27y3jflhagl" path="res://Scripts/GL_Color.gd" id="2_ouhok"]
[node name="Node" type="Control"]
layout_mode = 3
anchors_preset = 0
mouse_filter = 1
[node name="Node" parent="." groups=["GL Node"] instance=ExtResource("1_ouhok")]
layout_mode = 0
tooltip_text = "Outputs a color."
script = ExtResource("2_ouhok")
[connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"]
[connection signal="mouse_exited" from="Node" to="Node" method="mouse_exit"]

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://brgcm5aas061o"]
[ext_resource type="PackedScene" uid="uid://b0arjg8r75f8y" path="res://Scenes/Nodes/Node.tscn" id="1_x0ewx"]
[ext_resource type="Script" uid="uid://8acchs5jv70x" path="res://Scripts/GL_Invert.gd" id="2_x0ewx"]
[node name="Node" type="Control"]
layout_mode = 3
anchors_preset = 0
mouse_filter = 1
[node name="Node" parent="." groups=["GL Node"] instance=ExtResource("1_x0ewx")]
layout_mode = 0
tooltip_text = "Inverts the input, not the same as multiplying by -1. This is 1 - Input. The 'On' input toggles the inversion."
script = ExtResource("2_x0ewx")
[connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"]
[connection signal="mouse_exited" from="Node" to="Node" method="mouse_exit"]

View file

@ -10,7 +10,7 @@ mouse_filter = 1
[node name="Node" parent="." groups=["GL Node"] instance=ExtResource("1_ltih5")] [node name="Node" parent="." groups=["GL Node"] instance=ExtResource("1_ltih5")]
layout_mode = 0 layout_mode = 0
tooltip_text = "When 'Recording' is set to ON, it records inputs and saves them with the time from 'Current Time'. Going back in time will play back those inputs along with any you send in. Rows can be added and named based on how you want them identified." tooltip_text = "When 'Recording' is set to ON, it records inputs and saves them with the time from 'Current Time'. Going back in time will play back those inputs along with any you send in. Rows can be added and named based on how you want them identified. When recording past the first time, it will ignore your current input values until they change, then it will record alongside your previous inputs for that particular row."
script = ExtResource("2_ltih5") script = ExtResource("2_ltih5")
[connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"] [connection signal="mouse_entered" from="Node" to="Node" method="mouse_enter"]

View file

@ -47,6 +47,7 @@ mouse_default_cursor_shape = 2
text = "◉" text = "◉"
script = ExtResource("1_fygh4") script = ExtResource("1_fygh4")
[connection signal="button_down" from="Input" to="Input" method="_detatch"]
[connection signal="mouse_entered" from="Input" to="Input" method="mouse_enter"] [connection signal="mouse_entered" from="Input" to="Input" method="mouse_enter"]
[connection signal="mouse_exited" from="Input" to="Input" method="mouse_exit"] [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="value_changed" from="Pick Float" to="Pick Float" method="value_changed"]

View file

@ -18,8 +18,19 @@ layout_mode = 2
[node name="Holder" type="VBoxContainer" parent="Margins"] [node name="Holder" type="VBoxContainer" parent="Margins"]
layout_mode = 2 layout_mode = 2
[node name="Title" type="Label" parent="Margins/Holder"] [node name="Title" type="HBoxContainer" parent="Margins/Holder"]
layout_mode = 2 layout_mode = 2
[node name="Title Label" type="Label" parent="Margins/Holder/Title"]
layout_mode = 2
size_flags_horizontal = 3
text = "Test" text = "Test"
horizontal_alignment = 1 horizontal_alignment = 1
clip_text = true clip_text = true
[node name="Exit Button" type="Button" parent="Margins/Holder/Title"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 0
theme_override_font_sizes/font_size = 8
text = "X"

View file

@ -32,5 +32,8 @@ stretch_mode = 1
[node name="Search" parent="." instance=ExtResource("1_xwfut")] [node name="Search" parent="." instance=ExtResource("1_xwfut")]
visible = false visible = false
layout_mode = 1 layout_mode = 1
offset_right = -1400.0
offset_bottom = -700.0 [node name="Holder" type="Control" parent="."]
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0

14
Scripts/GL_Bool.gd Normal file
View file

@ -0,0 +1,14 @@
extends GL_Node
func _ready():
super._ready()
_set_title("Bool")
_create_row("Output",null,false,true,false,0)
_update_visuals()
func _process(delta):
super._process(delta)
apply_pick_values()
for key in rows:
rows[key]["output"] = rows[key]["input"]
_send_input("Output")

1
Scripts/GL_Bool.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://3rg2qunautt5

14
Scripts/GL_Color.gd Normal file
View file

@ -0,0 +1,14 @@
extends GL_Node
func _ready():
super._ready()
_set_title("Color")
_create_row("Output",null,Color.WHITE,true,Color.WHITE,0)
_update_visuals()
func _process(delta):
super._process(delta)
apply_pick_values()
for key in rows:
rows[key]["output"] = rows[key]["input"]
_send_input("Output")

1
Scripts/GL_Color.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bi27y3jflhagl

View file

@ -8,5 +8,7 @@ func _ready():
func _process(delta): func _process(delta):
super._process(delta) super._process(delta)
rows["Output"]["output"] = rows["Output"]["pickValue"] apply_pick_values()
for key in rows:
rows[key]["output"] = rows[key]["input"]
_send_input("Output") _send_input("Output")

21
Scripts/GL_Invert.gd Normal file
View file

@ -0,0 +1,21 @@
extends GL_Node
func _ready():
super._ready()
_set_title("Invert")
_create_row("Value",0.0,0.0,false,0,0)
_create_row("On",true,null,true,true,0)
_update_visuals()
func _process(delta):
super._process(delta)
for key in rows:
rows[key]["output"] = rows[key]["input"]
apply_pick_values()
if rows["On"]["output"] == true:
rows["Value"]["output"] = 1 - rows["Value"]["input"]
else:
rows["Value"]["output"] = rows["Value"]["input"]
_send_input("Value")

1
Scripts/GL_Invert.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://8acchs5jv70x

View file

@ -10,6 +10,7 @@ var special_condition : String
func _ready(): func _ready():
loadNodeRow = preload("res://Scenes/Nodes/Node Row.tscn") loadNodeRow = preload("res://Scenes/Nodes/Node Row.tscn")
(get_node("Margins").get_node("Holder").get_node("Title").get_node("Exit Button") as Button).connect("button_down",self.delete_whole_node)
func _process(delta): func _process(delta):
if dragging: if dragging:
@ -104,7 +105,7 @@ func _set_inout_type(label:Button, value):
label.visible = false label.visible = false
func _set_title(name:String): func _set_title(name:String):
(get_node("Margins").get_node("Holder").get_node("Title") as Label).text = name (get_node("Margins").get_node("Holder").get_node("Title").get_node("Title Label") as Label).text = name
func _create_row(name:String,input,output,picker:bool,pickDefault,pickFloatMaximum:float): func _create_row(name:String,input,output,picker:bool,pickDefault,pickFloatMaximum:float):
if rows.has(name): if rows.has(name):
@ -191,3 +192,10 @@ func apply_pick_values():
for key in rows: for key in rows:
if rows[key]["picker"] == true && rows[key]["backConnected"] == false: if rows[key]["picker"] == true && rows[key]["backConnected"] == false:
rows[key]["input"] = rows[key]["pickValue"] rows[key]["input"] = rows[key]["pickValue"]
func delete_whole_node():
for node in get_tree().get_nodes_in_group("Outputs"):
if node is GL_Node_Point:
for key in rows:
node.mainNode.destroy_connection(self,key)
queue_free()

View file

@ -1,15 +1,67 @@
extends Control extends Control
var holder: Control
var is_panning: bool = false
var last_mouse_pos: Vector2
var is_hovered: bool = false
func _ready(): func _ready():
visible = false visible = false
holder = get_node("Holder")
connect("mouse_entered", _on_mouse_entered)
connect("mouse_exited", _on_mouse_exited)
func _on_mouse_entered():
is_hovered = true
func _on_mouse_exited():
is_hovered = false
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed: if event is InputEventKey and event.pressed:
match(event.keycode): match event.keycode:
KEY_ESCAPE: KEY_ESCAPE:
visible = not visible visible = not visible
if visible: if not visible:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
return
else:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if not is_hovered:
return
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_MIDDLE:
is_panning = event.pressed
if is_panning:
last_mouse_pos = event.position
if event.pressed and (event.button_index == MOUSE_BUTTON_WHEEL_UP or event.button_index == MOUSE_BUTTON_WHEEL_DOWN):
var mouse_pos = event.position
var global_xform = holder.get_global_transform()
var local_mouse_pos = global_xform.affine_inverse().basis_xform(mouse_pos)
var zoom_factor := 1.0
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
zoom_factor = 1.1
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
zoom_factor = 0.9
# Apply scale
holder.scale *= zoom_factor
# Recalculate the new local position of the mouse after scaling
var new_global_xform = holder.get_global_transform()
var new_local_mouse_pos = new_global_xform.affine_inverse().basis_xform(mouse_pos)
# Calculate offset to shift so the mouse stays “anchored”
var delta = (new_local_mouse_pos - local_mouse_pos)
holder.position += delta * holder.scale
if event is InputEventMouseMotion and is_panning:
var delta = event.position - last_mouse_pos
holder.position += delta
last_mouse_pos = event.position

View file

@ -81,6 +81,11 @@ func _start_drag():
dragging = true dragging = true
lastToDrag = true lastToDrag = true
func _detatch():
for node in get_tree().get_nodes_in_group("Outputs"):
if node is GL_Node_Point:
node._node_disconnect(mainNode,valueName)
func mouse_enter(): func mouse_enter():
mouseInside = true mouseInside = true
@ -101,3 +106,6 @@ func _node_connect(node:GL_Node,inputValue:String):
return return
mainNode._create_connection(node,inputValue,valueName) mainNode._create_connection(node,inputValue,valueName)
update_lines() update_lines()
func _node_disconnect(node: GL_Node, outputValue: String):
mainNode.destroy_connection(node,outputValue)

View file

@ -1,6 +1,12 @@
extends GL_Node extends GL_Node
var timer:float
const sampleRate = 0.05
var recording:Dictionary var recording:Dictionary
var oldTime:float = 0.000030042452 #sorta random number
var time:float = 0
var rng:RandomNumberGenerator
var oldRecording:bool
var defaultValues:Dictionary
func _ready(): func _ready():
super._ready() super._ready()
@ -9,12 +15,130 @@ func _ready():
_create_row("Recording",false,null,true,false,0) _create_row("Recording",false,null,true,false,0)
_create_row("Current Time",0.0,0.0,false,0,0) _create_row("Current Time",0.0,0.0,false,0,0)
_update_visuals() _update_visuals()
rng = RandomNumberGenerator.new()
rng.seed = Time.get_ticks_msec()
pass pass
func _process(delta): func _process(delta):
super._process(delta) super._process(delta)
for key in rows:
rows[key]["output"] = rows[key]["input"]
apply_pick_values() apply_pick_values()
for key in rows:
rows[key]["output"] = rows[key]["input"]
time = float(rows["Current Time"]["output"])
_traverse()
var recordBool = rows["Recording"]["input"]
if recordBool == true:
if recordBool != oldRecording || time == 0:
for key in rows:
defaultValues[key] = rows[key]["output"]
if timer <= 0:
timer = sampleRate
_record()
timer -= delta
oldTime = time
oldRecording = recordBool
for key in rows: for key in rows:
_send_input(key) _send_input(key)
func _traverse():
if time == oldTime:
return
for key in recording:
if key == "Recording" || key == "Current Time":
continue
if recording[key]["start"] == null || recording[key]["end"] == null:
continue
if recording[key]["current"] == null:
recording[key]["current"] = recording[key]["start"]
if time < oldTime: #rewind
continue #fix pls
else: #forward
var current = recording[key]["current"]
var newCurrent = recursive_traverse_forward(key,current)
if current != newCurrent:
recording[key]["lastUsed"] = current
recording[key]["current"] = newCurrent
if recording[key]["lastUsed"] != null && recording[key]["current"] != recording[key]["end"]:
rows[key]["output"] = lerp(recording[key]["list"][recording[key]["lastUsed"]]["value"],recording[key]["list"][recording[key]["current"]]["value"],remap_time(time,recording[key]["list"][recording[key]["lastUsed"]]["time"],recording[key]["list"][recording[key]["current"]]["time"]))
func remap_time(value: float, start: float, end: float) -> float:
if start == end:
return 0.0
return (value - start) / (end - start)
func recursive_traverse_forward(key:String,current:String) -> String:
var dict = recording[key]["list"][current]
if dict["time"] > time:
if dict["back"] != null:
return recursive_traverse_forward(key,dict["back"])
if dict["time"] <= time:
if dict["forward"] != null && recording[key]["list"][dict["forward"]]["time"] <= time:
return recursive_traverse_forward(key,dict["forward"])
return current
func _record():
for key in recording:
if key == "Recording" || key == "Current Time":
continue
if defaultValues[key] == rows[key]["input"]:
continue
elif defaultValues[key] != null:
defaultValues[key] == null #is this gonna bite me back if I allow null values to pass
var currentSave = recording[key]["current"]
if currentSave == null:
var id = "ID_" + str(rng.randi())
recording[key]["list"][id] = {
"value":rows[key]["input"],
"time":time,
"back":null,
"forward":null
}
recording[key]["current"] = id
recording[key]["start"] = id
recording[key]["end"] = id
rows[key]["output"] = recording[key]["list"][id]["value"]
continue
else:
if time < oldTime: #rewind
continue #fix pls
else: #forward
if recording[key]["list"][currentSave]["time"] == time: #paused recording
recording[key]["list"][currentSave]["value"] = rows[key]["input"]
rows[key]["output"] = rows[key]["input"]
elif recording[key]["list"][currentSave]["time"] < time:
var id = "ID_" + str(rng.randi())
if recording[key]["list"][currentSave]["forward"] == null:
recording[key]["list"][id] = {
"value":rows[key]["input"],
"time":time,
"back":currentSave,
"forward":null
}
recording[key]["list"][currentSave]["forward"] = id
recording[key]["current"] = id
recording[key]["end"] = id
else:
var forward = recording[key]["list"][currentSave]["forward"]
recording[key]["list"][id] = {
"value":rows[key]["input"],
"time":time,
"back":currentSave,
"forward":forward
}
recording[key]["list"][forward]["back"] = id
recording[key]["list"][currentSave]["forward"] = id
recording[key]["current"] = id
rows[key]["output"] = recording[key]["list"][id]["value"]
#else: Somethings messed up and you need to re-traverse
continue
pass
func _create_row(name:String,input,output,picker:bool,pickDefault,pickFloatMaximum:float):
super._create_row(name,input,output,picker,pickDefault,pickFloatMaximum)
if name == "Recording" || name == "Current Time":
return
for key in rows:
if !recording.has(key):
recording[key] = {"start":null,"end":null,"current":null,"list":{},"lastUsed":null}

View file

@ -3,7 +3,10 @@ extends Control
var rows : Dictionary = { var rows : Dictionary = {
"CyberChuck":1, "CyberChuck":1,
"CyberHelen":1, "CyberHelen":1,
"Bool":1,
"Color":1,
"Float":1, "Float":1,
"Invert":1,
"Keystrokes":1, "Keystrokes":1,
"Keystroke Ramp":1, "Keystroke Ramp":1,
"Lerp":1, "Lerp":1,
@ -52,7 +55,7 @@ func _set_rows():
func _create_node(name:String): func _create_node(name:String):
var node = load("res://Scenes/Node Types/" + name + ".tscn").instantiate() var node = load("res://Scenes/Node Types/" + name + ".tscn").instantiate()
get_parent().add_child(node) get_parent().get_node("Holder").add_child(node)
node = (node as Control).get_child(0) as GL_Node node = (node as Control).get_child(0) as GL_Node
node.position = lastMousePos node.position = lastMousePos
node._create_uuid() node._create_uuid()

View file

@ -10,7 +10,7 @@ func _ready():
func _sent_signals(signal_ID:String,the_signal): func _sent_signals(signal_ID:String,the_signal):
match(signal_ID): match(signal_ID):
"intensity": "intensity":
light.light_energy = the_signal * energyMultiplier light.light_energy = max(the_signal,0) * energyMultiplier
"color": "color":
if canChangeColor: if canChangeColor:
light.light_color = the_signal light.light_color = the_signal