mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
82 lines
2.3 KiB
GDScript
82 lines
2.3 KiB
GDScript
extends DeckNode
|
|
|
|
var noobs: NoOBSWS
|
|
|
|
enum InputPorts{
|
|
SCENE_NAME,
|
|
SOURCE_ID,
|
|
XFORM,
|
|
SET,
|
|
}
|
|
|
|
func _init() -> void:
|
|
name = "Set Source Transform"
|
|
node_type = "obs_set_source_transform"
|
|
description = ""
|
|
category = "obs"
|
|
|
|
props_to_serialize = []
|
|
|
|
add_input_port(
|
|
DeckType.Types.STRING,
|
|
"Scene name",
|
|
"field"
|
|
)
|
|
|
|
add_input_port(
|
|
DeckType.Types.NUMERIC,
|
|
"Source ID",
|
|
"field"
|
|
)
|
|
|
|
add_input_port(
|
|
DeckType.Types.DICTIONARY,
|
|
"Transform"
|
|
)
|
|
|
|
add_input_port(
|
|
DeckType.Types.BOOL,
|
|
"Set",
|
|
"button"
|
|
)
|
|
|
|
|
|
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 }}
|
|
if to_input_port != 3:
|
|
return
|
|
|
|
if noobs == null:
|
|
noobs = Connections.obs_websocket
|
|
|
|
var scene_name: String
|
|
if request_value(InputPorts.SCENE_NAME) != null:
|
|
scene_name = request_value(InputPorts.SCENE_NAME)
|
|
elif get_input_ports()[InputPorts.SCENE_NAME].value_callback.get_object() && get_input_ports()[InputPorts.SCENE_NAME].value_callback.call() != "":
|
|
scene_name = get_input_ports()[InputPorts.SCENE_NAME].value_callback.call()
|
|
|
|
if scene_name.is_empty():
|
|
return
|
|
|
|
var source_id: float
|
|
var res_as = await request_value_async(InputPorts.SOURCE_ID)
|
|
if res_as != null:
|
|
source_id = res_as
|
|
elif get_input_ports()[InputPorts.SOURCE_ID].value_callback.get_object() && get_input_ports()[InputPorts.SOURCE_ID].value_callback.call() != null:
|
|
source_id = get_input_ports()[InputPorts.SOURCE_ID].value_callback.call()
|
|
|
|
var xform: Dictionary
|
|
if request_value(InputPorts.XFORM) != null:
|
|
xform = request_value(InputPorts.XFORM)
|
|
elif get_input_ports()[InputPorts.XFORM].value_callback.get_object() && get_input_ports()[InputPorts.XFORM].value_callback.call() != null:
|
|
xform = get_input_ports()[InputPorts.XFORM].value_callback.call()
|
|
|
|
if xform.is_empty():
|
|
return
|
|
|
|
var req := noobs.make_generic_request("SetSceneItemTransform",
|
|
{
|
|
"scene_name": scene_name,
|
|
"scene_item_id": source_id,
|
|
"scene_item_transform": xform,
|
|
})
|