2023-11-28 09:48:16 +01:00
|
|
|
extends DeckNode
|
|
|
|
|
|
|
|
var noobs: NoOBSWS
|
|
|
|
|
|
|
|
|
|
|
|
func _init() -> void:
|
|
|
|
name = "OBS WS Generic Request"
|
|
|
|
node_type = "obs_generic_request"
|
2023-12-14 19:15:42 +01:00
|
|
|
description = "Makes an OBS request and sends its result through. Use if if you really know what you're doing."
|
2023-11-28 09:48:16 +01:00
|
|
|
category = "obs"
|
|
|
|
|
|
|
|
props_to_serialize = []
|
|
|
|
|
|
|
|
add_virtual_port(
|
|
|
|
DeckType.Types.STRING,
|
|
|
|
"Request type",
|
|
|
|
"field"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_virtual_port(
|
|
|
|
DeckType.Types.STRING,
|
|
|
|
"Request data",
|
|
|
|
"codeblock"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_output_port(
|
|
|
|
DeckType.Types.DICTIONARY,
|
|
|
|
"Result"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_virtual_port(
|
|
|
|
DeckType.Types.BOOL,
|
|
|
|
"Request",
|
|
|
|
"button"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-12-04 15:16:39 +01:00
|
|
|
func _receive(on_virtual_port: int, _data: Variant, _extra_data: Array = []) -> void:
|
2023-11-28 09:48:16 +01:00
|
|
|
if on_virtual_port != 2:
|
|
|
|
return
|
|
|
|
|
|
|
|
if noobs == null:
|
|
|
|
noobs = Connections.obs_websocket
|
|
|
|
|
|
|
|
print(get_virtual_ports()[1].value)
|
|
|
|
var e: Dictionary = type_convert(get_virtual_ports()[1].value, TYPE_DICTIONARY)
|
|
|
|
print(e)
|
|
|
|
if typeof(e) != TYPE_DICTIONARY:
|
|
|
|
return
|
|
|
|
|
|
|
|
var req := noobs.make_generic_request(
|
|
|
|
get_virtual_ports()[0].value,
|
|
|
|
str_to_var(get_virtual_ports()[1].value)
|
|
|
|
)
|
|
|
|
|
|
|
|
await req.response_received
|
|
|
|
|
|
|
|
var d := req.message.get_data()
|
|
|
|
send(0, d)
|