mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
fix a bunch of warnings
This commit is contained in:
parent
d707d65323
commit
b7f511709a
23 changed files with 58 additions and 63 deletions
|
@ -235,7 +235,7 @@ func copy_nodes_json(nodes_to_copy: Array[String]) -> String:
|
||||||
|
|
||||||
|
|
||||||
func allocate_ids(count: int) -> Array[String]:
|
func allocate_ids(count: int) -> Array[String]:
|
||||||
var res: Array[String]
|
var res: Array[String] = []
|
||||||
for i in count:
|
for i in count:
|
||||||
res.append(UUID.v4())
|
res.append(UUID.v4())
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -107,6 +107,7 @@ func send(from_output_port: int, data: Variant, extra_data: Array = []) -> void:
|
||||||
|
|
||||||
|
|
||||||
## Virtual function that's called when this node receives data from another node's [method send] call.
|
## Virtual function that's called when this node receives data from another node's [method send] call.
|
||||||
|
@warning_ignore("unused_parameter")
|
||||||
func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -115,9 +116,9 @@ func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void
|
||||||
## at [param to_port].
|
## at [param to_port].
|
||||||
func add_outgoing_connection(from_port: int, to_node: String, to_port: int) -> void:
|
func add_outgoing_connection(from_port: int, to_node: String, to_port: int) -> void:
|
||||||
var inner: Dictionary = outgoing_connections.get(from_port, {}) as Dictionary
|
var inner: Dictionary = outgoing_connections.get(from_port, {}) as Dictionary
|
||||||
var ports: Array = inner.get(to_node, []) as Array
|
var inner_ports: Array = inner.get(to_node, []) as Array
|
||||||
ports.append(to_port)
|
inner_ports.append(to_port)
|
||||||
inner[to_node] = ports
|
inner[to_node] = inner_ports
|
||||||
outgoing_connections[from_port] = inner
|
outgoing_connections[from_port] = inner
|
||||||
get_node(to_node).add_incoming_connection(to_port, _id, from_port)
|
get_node(to_node).add_incoming_connection(to_port, _id, from_port)
|
||||||
outgoing_connection_added.emit(from_port)
|
outgoing_connection_added.emit(from_port)
|
||||||
|
@ -155,6 +156,7 @@ func request_value_async(on_port: int) -> Variant:
|
||||||
|
|
||||||
## Virtual function that's called when this node has been requested a value from the output port
|
## Virtual function that's called when this node has been requested a value from the output port
|
||||||
## at [param from_port].
|
## at [param from_port].
|
||||||
|
@warning_ignore("unused_parameter")
|
||||||
func _value_request(from_port: int) -> Variant:
|
func _value_request(from_port: int) -> Variant:
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
@ -166,10 +168,10 @@ func remove_outgoing_connection(from_port: int, to_node: String, to_port: int) -
|
||||||
if connections.is_empty():
|
if connections.is_empty():
|
||||||
return
|
return
|
||||||
|
|
||||||
var ports: Array = connections.get(to_node, []) as Array
|
var inner_ports: Array = connections.get(to_node, []) as Array
|
||||||
ports.erase(to_port)
|
inner_ports.erase(to_port)
|
||||||
|
|
||||||
if ports.is_empty():
|
if inner_ports.is_empty():
|
||||||
(outgoing_connections[from_port] as Dictionary).erase(to_node)
|
(outgoing_connections[from_port] as Dictionary).erase(to_node)
|
||||||
if (outgoing_connections[from_port] as Dictionary).is_empty():
|
if (outgoing_connections[from_port] as Dictionary).is_empty():
|
||||||
outgoing_connections.erase(from_port)
|
outgoing_connections.erase(from_port)
|
||||||
|
@ -184,6 +186,7 @@ func remove_incoming_connection(to_port: int) -> void:
|
||||||
incoming_connection_removed.emit(to_port)
|
incoming_connection_removed.emit(to_port)
|
||||||
|
|
||||||
|
|
||||||
|
@warning_ignore("unused_parameter")
|
||||||
func _event_received(event_name: StringName, event_data: Dictionary = {}) -> void:
|
func _event_received(event_name: StringName, event_data: Dictionary = {}) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -7,37 +7,37 @@ func _init():
|
||||||
node_type = name.to_snake_case()
|
node_type = name.to_snake_case()
|
||||||
description = "A Node that passes through the input after the set time."
|
description = "A Node that passes through the input after the set time."
|
||||||
category = "general"
|
category = "general"
|
||||||
|
|
||||||
add_output_port(DeckType.Types.STRING, "Value", "")
|
add_output_port(DeckType.Types.STRING, "Value", "")
|
||||||
|
|
||||||
add_input_port(DeckType.Types.NUMERIC, "Delay Time", "field")
|
add_input_port(DeckType.Types.NUMERIC, "Delay Time", "field")
|
||||||
add_input_port(DeckType.Types.NUMERIC, "Value", "field")
|
add_input_port(DeckType.Types.NUMERIC, "Value", "field")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _receive(to_input_port : int, data: Variant, extra_data: Array = []) -> void:
|
|
||||||
|
func _receive(_to_input_port : int, data: Variant, _extra_data: Array = []) -> void:
|
||||||
|
|
||||||
thread = Thread.new()
|
thread = Thread.new()
|
||||||
thread.start(handle_delay.bind(data))
|
thread.start(handle_delay.bind(data))
|
||||||
|
|
||||||
|
|
||||||
func handle_delay(data):
|
func handle_delay(data):
|
||||||
|
|
||||||
var goal_time = Time.get_ticks_msec() + (int(get_input_ports()[0].value_callback.call()) * 1000)
|
var goal_time = Time.get_ticks_msec() + (int(get_input_ports()[0].value_callback.call()) * 1000)
|
||||||
|
|
||||||
while Time.get_ticks_msec() < goal_time:
|
while Time.get_ticks_msec() < goal_time:
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
print("Delay over")
|
print("Delay over")
|
||||||
send(0, data)
|
send(0, data)
|
||||||
|
|
||||||
|
|
||||||
func _notification(what):
|
func _notification(what):
|
||||||
|
|
||||||
if what == NOTIFICATION_PREDELETE and thread != null:
|
if what == NOTIFICATION_PREDELETE and thread != null:
|
||||||
|
|
||||||
thread.wait_to_finish()
|
thread.wait_to_finish()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var d = request_value(0)
|
var d = request_value(0)
|
||||||
if d == null:
|
if d == null:
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -9,28 +9,28 @@ func _init():
|
||||||
category = "general"
|
category = "general"
|
||||||
|
|
||||||
props_to_serialize = []
|
props_to_serialize = []
|
||||||
|
|
||||||
add_output_port(DeckType.Types.ANY, "Expression Text", "codeblock")
|
add_output_port(DeckType.Types.ANY, "Expression Text", "codeblock")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _value_request(from_port : int) -> Variant:
|
|
||||||
|
func _value_request(_from_port : int) -> Variant:
|
||||||
|
|
||||||
var text = get_output_ports()[0].value_callback.call()
|
var text = get_output_ports()[0].value_callback.call()
|
||||||
|
|
||||||
var err = expr.parse(text)
|
var err = expr.parse(text)
|
||||||
if err != OK:
|
if err != OK:
|
||||||
|
|
||||||
printerr(err)
|
printerr(err)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
var res = expr.execute()
|
var res = expr.execute()
|
||||||
if expr.has_execute_failed():
|
if expr.has_execute_failed():
|
||||||
|
|
||||||
printerr("Expression Execution Failed: ", text)
|
printerr("Expression Execution Failed: ", text)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,6 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(from_port: int) -> Variant:
|
func _value_request(_from_port: int) -> Variant:
|
||||||
var key = ports[0].value_callback.call()
|
var key = ports[0].value_callback.call()
|
||||||
return _belonging_to.variable_stack.get(key)
|
return _belonging_to.variable_stack.get(key)
|
||||||
|
|
|
@ -16,7 +16,6 @@ func _init() -> void:
|
||||||
|
|
||||||
func _pre_connection() -> void:
|
func _pre_connection() -> void:
|
||||||
for port_type: PortType in extra_ports:
|
for port_type: PortType in extra_ports:
|
||||||
var index_of_type: int
|
|
||||||
match port_type:
|
match port_type:
|
||||||
PortType.OUTPUT:
|
PortType.OUTPUT:
|
||||||
add_output_port(DeckType.Types.ANY, "Output %s" % get_output_ports().size())
|
add_output_port(DeckType.Types.ANY, "Output %s" % get_output_ports().size())
|
||||||
|
|
|
@ -24,7 +24,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _receive(on_virtual_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(on_virtual_port: int, _data: Variant, _extra_data: Array = []) -> void:
|
||||||
if on_virtual_port != 0:
|
if on_virtual_port != 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func _receive(on_virtual_port: int, data: Variant, extra_data: Array = []) -> vo
|
||||||
ports_updated.emit()
|
ports_updated.emit()
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_input_port: int) -> Variant:
|
func _value_request(_on_input_port: int) -> Variant:
|
||||||
if ports[0].value != null:
|
if ports[0].value != null:
|
||||||
return ports[0].value
|
return ports[0].value
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_output_port: int) -> Variant:
|
func _value_request(_on_output_port: int) -> Variant:
|
||||||
if noobs == null:
|
if noobs == null:
|
||||||
noobs = Connections.obs_websocket
|
noobs = Connections.obs_websocket
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(to_input_port: int, _data: Variant, _extra_data: Array = []) -> void:
|
||||||
#{ "scene_item_transform": { "alignment": 5, "bounds_alignment": 0, "bounds_height": 0, "bounds_type": "OBS_BOUNDS_NONE", "bounds_width": 0, "crop_bottom": 0, "crop_left": 0, "crop_right": 0, "crop_top": 0, "height": 257, "position_x": 1800, "position_y": 414, "rotation": 0, "scale_x": 1, "scale_y": 1, "source_height": 257, "source_width": 146, "width": 146 }}
|
#{ "scene_item_transform": { "alignment": 5, "bounds_alignment": 0, "bounds_height": 0, "bounds_type": "OBS_BOUNDS_NONE", "bounds_width": 0, "crop_bottom": 0, "crop_left": 0, "crop_right": 0, "crop_top": 0, "height": 257, "position_x": 1800, "position_y": 414, "rotation": 0, "scale_x": 1, "scale_y": 1, "source_height": 257, "source_width": 146, "width": 146 }}
|
||||||
if to_input_port != 3:
|
if to_input_port != 3:
|
||||||
return
|
return
|
||||||
|
|
|
@ -23,7 +23,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _receive(on_input_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(on_input_port: int, _data: Variant, _extra_data: Array = []) -> void:
|
||||||
if on_input_port != 1:
|
if on_input_port != 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var v = request_value(0)
|
var v = request_value(0)
|
||||||
if !v:
|
if !v:
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -35,7 +35,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _receive(on_virtual_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(on_virtual_port: int, _data: Variant, _extra_data: Array = []) -> void:
|
||||||
if on_virtual_port != 2:
|
if on_virtual_port != 2:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(to_input_port: int, _data: Variant, _extra_data: Array = []) -> void:
|
||||||
if to_input_port != 2:
|
if to_input_port != 2:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ func _init() -> void:
|
||||||
"field"
|
"field"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _value_request(from_port: int) -> Variant:
|
func _value_request(_from_port: int) -> Variant:
|
||||||
if ports[0].value_callback.get_object():
|
if ports[0].value_callback.get_object():
|
||||||
return ports[0].value_callback.call()
|
return ports[0].value_callback.call()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -26,7 +26,7 @@ func _init() -> void:
|
||||||
add_input_port(DeckType.Types.BOOL, "Send", "button")
|
add_input_port(DeckType.Types.BOOL, "Send", "button")
|
||||||
|
|
||||||
|
|
||||||
func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void:
|
func _receive(to_input_port: int, data: Variant, _extra_data: Array = []) -> void:
|
||||||
if to_input_port == 6:
|
if to_input_port == 6:
|
||||||
send(0, false)
|
send(0, false)
|
||||||
send(1, 1.0)
|
send(1, 1.0)
|
||||||
|
|
|
@ -21,7 +21,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var va = request_value(0)
|
var va = request_value(0)
|
||||||
var vb = request_value(1)
|
var vb = request_value(1)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Dictionary:
|
func _value_request(_on_port: int) -> Dictionary:
|
||||||
var x = float(get_value_for_input_port(0))
|
var x = float(get_value_for_input_port(0))
|
||||||
var y = float(get_value_for_input_port(1))
|
var y = float(get_value_for_input_port(1))
|
||||||
return {"x": x, "y": y}
|
return {"x": x, "y": y}
|
||||||
|
|
|
@ -22,7 +22,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var va = request_value(0)
|
var va = request_value(0)
|
||||||
var vb = request_value(1)
|
var vb = request_value(1)
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var v = request_value(0)
|
var v = request_value(0)
|
||||||
|
|
||||||
if !v:
|
if !v:
|
||||||
|
|
|
@ -18,7 +18,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var v = request_value(0)
|
var v = request_value(0)
|
||||||
if !v:
|
if !v:
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -21,7 +21,7 @@ func _init() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _value_request(on_port: int) -> Variant:
|
func _value_request(_on_port: int) -> Variant:
|
||||||
var va = request_value(0)
|
var va = request_value(0)
|
||||||
var vb = request_value(1)
|
var vb = request_value(1)
|
||||||
|
|
||||||
|
|
|
@ -115,13 +115,6 @@ func initialize_from_deck() -> void:
|
||||||
add_child(node_renderer)
|
add_child(node_renderer)
|
||||||
node_renderer.position_offset = node_renderer.node.position_as_vector2()
|
node_renderer.position_offset = node_renderer.node.position_as_vector2()
|
||||||
|
|
||||||
for node_id in deck.nodes:
|
|
||||||
var node: DeckNode = deck.nodes[node_id]
|
|
||||||
var from_node = get_children().filter(
|
|
||||||
func(c: DeckNodeRendererGraphNode):
|
|
||||||
return c.node._id == node_id
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
refresh_connections()
|
refresh_connections()
|
||||||
|
|
||||||
## Loops through all [DeckNode]s in [member Deck.nodes] and calls
|
## Loops through all [DeckNode]s in [member Deck.nodes] and calls
|
||||||
|
@ -268,7 +261,7 @@ func _on_copy_nodes_request() -> void:
|
||||||
if selected.is_empty():
|
if selected.is_empty():
|
||||||
return
|
return
|
||||||
|
|
||||||
var selected_ids: Array[String]
|
var selected_ids: Array[String] = []
|
||||||
selected_ids.assign(selected.map(
|
selected_ids.assign(selected.map(
|
||||||
func(x: DeckNodeRendererGraphNode):
|
func(x: DeckNodeRendererGraphNode):
|
||||||
return x.node._id
|
return x.node._id
|
||||||
|
@ -296,7 +289,7 @@ func _on_duplicate_nodes_request() -> void:
|
||||||
if selected.is_empty():
|
if selected.is_empty():
|
||||||
return
|
return
|
||||||
|
|
||||||
var selected_ids: Array[String]
|
var selected_ids: Array[String] = []
|
||||||
selected_ids.assign(selected.map(
|
selected_ids.assign(selected.map(
|
||||||
func(x: DeckNodeRendererGraphNode):
|
func(x: DeckNodeRendererGraphNode):
|
||||||
return x.node._id
|
return x.node._id
|
||||||
|
|
Loading…
Reference in a new issue