miggor-StreamGraph/classes/deck/nodes/obs/obs_event_received.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

48 lines
993 B
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 cached_data: Dictionary
func _init() -> void:
name = "OBS Event Received"
node_type = name.to_snake_case()
description = ""
add_input_port(
DeckType.Types.STRING,
"Event Name",
"field",
Port.UsageType.VALUE_REQUEST,
)
add_output_port(
DeckType.Types.ANY,
"Event Received",
"",
Port.UsageType.TRIGGER,
)
add_output_port(
DeckType.Types.DICTIONARY,
"Event Data",
)
func _event_received(event_name: StringName, event_data: Dictionary = {}) -> void:
if event_name != &"obs_event":
return
if event_data.get("event_type", "") != await resolve_input_port_value_async(0):
return
cached_data = event_data.event_data
var id := UUID.v4()
send(0, event_data.event_data, id)
send(1, event_data.event_data, id)
func _value_request(__on_output_port: int) -> Variant:
return cached_data