miggor-StreamGraph/classes/deck/nodes/obs/obs_set_input_settings.gd
Lera Elvoé 49b8a23281 add more OBS nodes, allow specifying event subscription types in OBS connection dialog (#81)
adds:
- OBS Event Received
- OBS Set Source Visible
- OBS Is Source Visible?
- OBS Set Input Settings

Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/81
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
2024-02-26 11:37:57 +00:00

59 lines
1.1 KiB
GDScript

# (c) 2023-present Eroax
# (c) 2023-present Yagich
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
extends DeckNode
var noobs: NoOBSWS
func _init() -> void:
name = "OBS Set Input Settings"
node_type = name.to_snake_case()
description = "Sets settings on a source in OBS."
aliases = ["source"]
add_input_port(
DeckType.Types.STRING,
"Input/Source name",
"field",
)
add_input_port(
DeckType.Types.DICTIONARY,
"Settings",
)
add_input_port(
DeckType.Types.ANY,
"Set",
"button",
Port.UsageType.TRIGGER,
)
func _receive(to_input_port: int, data: Variant) -> void:
if noobs == null:
noobs = Connections.obs_websocket
var input_name
var settings
match to_input_port:
0:
input_name = str(data)
settings = await resolve_input_port_value_async(1)
1:
settings = data
input_name = await resolve_input_port_value_async(0)
2:
input_name = await resolve_input_port_value_async(0)
settings = await resolve_input_port_value_async(1)
var r := noobs.make_generic_request(
"SetInputSettings",
{
"input_name": input_name,
"input_settings": settings,
}
)