2023-12-15 22:44:25 +01:00
|
|
|
# (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 = "Set Scene"
|
|
|
|
node_type = "obs_set_scene"
|
|
|
|
description = "Sets the current scene in OBS."
|
|
|
|
|
|
|
|
props_to_serialize = []
|
|
|
|
|
|
|
|
add_input_port(
|
|
|
|
DeckType.Types.STRING,
|
|
|
|
"Scene Name",
|
|
|
|
"field"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_input_port(
|
|
|
|
DeckType.Types.BOOL,
|
|
|
|
"Switch",
|
|
|
|
"button"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-02-22 08:23:25 +01:00
|
|
|
func _receive(on_input_port: int, _data: Variant) -> void:
|
2023-12-15 22:44:25 +01:00
|
|
|
if on_input_port != 1:
|
|
|
|
return
|
|
|
|
|
|
|
|
if noobs == null:
|
|
|
|
noobs = Connections.obs_websocket
|
|
|
|
|
2024-01-25 08:20:41 +01:00
|
|
|
var scene_name_req = await resolve_input_port_value_async(0, "")
|
|
|
|
if scene_name_req == null:
|
|
|
|
return
|
|
|
|
|
|
|
|
var scene_name: String = scene_name_req
|
2023-12-15 22:44:25 +01:00
|
|
|
|
|
|
|
if scene_name.is_empty():
|
|
|
|
return
|
|
|
|
|
|
|
|
noobs.make_generic_request(
|
|
|
|
"SetCurrentProgramScene",
|
|
|
|
{"scene_name": scene_name}
|
|
|
|
)
|