More epicness
This commit is contained in:
parent
d06e9b0355
commit
1608b8f6f5
26 changed files with 260 additions and 17 deletions
11
Scripts/GL_Float.gd
Normal file
11
Scripts/GL_Float.gd
Normal file
|
@ -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")
|
1
Scripts/GL_Float.gd.uid
Normal file
1
Scripts/GL_Float.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://b325grg0122jn
|
|
@ -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
|
||||
|
|
9
Scripts/GL_Node_Picker.gd
Normal file
9
Scripts/GL_Node_Picker.gd
Normal file
|
@ -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"]
|
1
Scripts/GL_Node_Picker.gd.uid
Normal file
1
Scripts/GL_Node_Picker.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://csv3oi505a3yw
|
4
Scripts/GL_Node_Picker_Bool.gd
Normal file
4
Scripts/GL_Node_Picker_Bool.gd
Normal file
|
@ -0,0 +1,4 @@
|
|||
extends GL_Node_Picker
|
||||
|
||||
func toggled(value:bool):
|
||||
mainNode.rows[valueName]["pickValue"] = value
|
1
Scripts/GL_Node_Picker_Bool.gd.uid
Normal file
1
Scripts/GL_Node_Picker_Bool.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://b7ysqwtxh8pf
|
4
Scripts/GL_Node_Picker_Color.gd
Normal file
4
Scripts/GL_Node_Picker_Color.gd
Normal file
|
@ -0,0 +1,4 @@
|
|||
extends GL_Node_Picker
|
||||
|
||||
func color_changed(value:Color):
|
||||
mainNode.rows[valueName]["pickValue"] = value
|
1
Scripts/GL_Node_Picker_Color.gd.uid
Normal file
1
Scripts/GL_Node_Picker_Color.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://dflftb37a7ind
|
4
Scripts/GL_Node_Picker_Float.gd
Normal file
4
Scripts/GL_Node_Picker_Float.gd
Normal file
|
@ -0,0 +1,4 @@
|
|||
extends GL_Node_Picker
|
||||
|
||||
func value_changed(value:float):
|
||||
mainNode.rows[valueName]["pickValue"] = value
|
1
Scripts/GL_Node_Picker_Float.gd.uid
Normal file
1
Scripts/GL_Node_Picker_Float.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://q5qlhwvjb16w
|
14
Scripts/GL_Random.gd
Normal file
14
Scripts/GL_Random.gd
Normal file
|
@ -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")
|
1
Scripts/GL_Random.gd.uid
Normal file
1
Scripts/GL_Random.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://3vek1806nwqj
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue