From 1770a04e4359e488b384807c31566d095b2c1b3a Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Thu, 30 Dec 2021 23:02:41 -0800 Subject: [PATCH] should fix double sending for single thing --- src/modules/external_interface.rs | 4 ++-- src/modules/message_handler.rs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/modules/external_interface.rs b/src/modules/external_interface.rs index 8d16c8a..d763378 100644 --- a/src/modules/external_interface.rs +++ b/src/modules/external_interface.rs @@ -77,9 +77,9 @@ impl Hotkeys { }; } - pub fn change_scene(&self, _scene: Scenes, sub_scene: Option) { + pub fn change_scene(&self, scene: Scenes, sub_scene: Option) { let hotkey: &str; - if sub_scene.is_none() { + if scene == Scenes::Augmented { hotkey = self.hotkeys["hotkeys"]["obs"]["camera_scene_augmented"].as_str().unwrap() } else { hotkey = self.get_hotkey_from_scene(sub_scene.unwrap()) diff --git a/src/modules/message_handler.rs b/src/modules/message_handler.rs index 4090f51..6a7c83c 100644 --- a/src/modules/message_handler.rs +++ b/src/modules/message_handler.rs @@ -88,7 +88,6 @@ impl MessageHandler for StreamState { } }, StateUpdate::Scene(value) => { - hotkey_handler.change_scene(value, None); self.current_scene = value; if value == Scenes::Screen { @@ -98,6 +97,18 @@ impl MessageHandler for StreamState { self.timer_finished = true; } + match self.current_scene { + Scenes::Camera => { + hotkey_handler.change_scene(Scenes::Camera, Some(self.camera_sub_scene)); + }, + Scenes::Screen => { + hotkey_handler.change_scene(Scenes::Screen, Some(self.screen_sub_scene)); + }, + Scenes::Augmented => { + hotkey_handler.change_scene(Scenes::Augmented, None); + } + } + return (Some(update), None); }, StateUpdate::StreamSoundToggleOn(value) => {hotkey_handler.toggle_stream_sound(value); return (Some(update), None)},