diff --git a/classes/deck/nodes/obs_search_source.gd b/classes/deck/nodes/obs_search_source.gd index 28b7f93..eab53a2 100644 --- a/classes/deck/nodes/obs_search_source.gd +++ b/classes/deck/nodes/obs_search_source.gd @@ -2,6 +2,10 @@ extends DeckNode var noobs: NoOBSWS +var cached_scene_name: String +var cached_source_name: String +var cached_id # TODO: evaluate if this caching is actually needed + func _init() -> void: name = "Get Source ID" @@ -47,6 +51,12 @@ func _value_request(_on_output_port: int) -> Variant: if source_name.is_empty(): return null + if cached_scene_name == scene_name && cached_source_name == scene_name: + return cached_id + + cached_scene_name = scene_name + cached_source_name = source_name + var req := noobs.make_generic_request( "GetSceneItemId", { @@ -59,6 +69,7 @@ func _value_request(_on_output_port: int) -> Variant: var data := req.message.get_data() #if int(data.request_status.code) != NoOBSWS.Enums.RequestStatus.NO_ERROR: #return null + cached_id = data.response_data.scene_item_id return data.response_data.scene_item_id diff --git a/classes/deck/nodes/obs_set_source_transform.gd b/classes/deck/nodes/obs_set_source_transform.gd index 73cfaec..b9f6882 100644 --- a/classes/deck/nodes/obs_set_source_transform.gd +++ b/classes/deck/nodes/obs_set_source_transform.gd @@ -2,6 +2,8 @@ extends DeckNode var noobs: NoOBSWS +var lock := false # TODO: evaluate if this locking is actually needed + enum InputPorts{ SCENE_NAME, SOURCE_ID, @@ -9,6 +11,7 @@ enum InputPorts{ SET, } + func _init() -> void: name = "Set Source Transform" node_type = "obs_set_source_transform" @@ -49,6 +52,9 @@ func _receive(to_input_port: int, _data: Variant, _extra_data: Array = []) -> vo if noobs == null: noobs = Connections.obs_websocket + if lock: + return + var scene_name: String if request_value(InputPorts.SCENE_NAME) != null: scene_name = request_value(InputPorts.SCENE_NAME) @@ -74,9 +80,26 @@ func _receive(to_input_port: int, _data: Variant, _extra_data: Array = []) -> vo 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, - }) + lock = true + + #noobs.make_generic_request("SetSceneItemTransform", + #{ + #"scene_name": scene_name, + #"scene_item_id": source_id, + #"scene_item_transform": xform, + #}) + #var sleep := noobs.make_generic_request("Sleep", {"sleep_frames": 1}) + #sleep.response_received.connect(func(): lock = false) + var b := noobs.make_batch_request(false, NoOBSWS.Enums.RequestBatchExecutionType.SERIAL_FRAME) + b.add_request( + "SetSceneItemTransform", + "", + { + "scene_name": scene_name, + "scene_item_id": source_id, + "scene_item_transform": xform, + } + ) + b.add_request("Sleep", "", {"sleep_frames": 1}) + b.response_received.connect(func(): lock = false) + b.send() diff --git a/graph_node_renderer/twitch_setup_dialog.tscn b/graph_node_renderer/twitch_setup_dialog.tscn index 60a57b7..9054361 100644 --- a/graph_node_renderer/twitch_setup_dialog.tscn +++ b/graph_node_renderer/twitch_setup_dialog.tscn @@ -14,9 +14,9 @@ script = ExtResource("1_xx7my") anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 -offset_left = -179.5 +offset_left = 8.0 offset_top = 8.0 -offset_right = 179.5 +offset_right = 367.0 offset_bottom = 109.0 grow_horizontal = 2 size_flags_horizontal = 4 diff --git a/project.godot b/project.godot index e570897..f74f7ac 100644 --- a/project.godot +++ b/project.godot @@ -16,7 +16,6 @@ run/main_scene="res://graph_node_renderer/deck_holder_renderer.tscn" config/use_custom_user_dir=true config/custom_user_dir_name="dotdeck" config/features=PackedStringArray("4.2", "Forward Plus") -run/low_processor_mode=true config/icon="res://icon.svg" [autoload]