From f84dfc3186970ebcebad869cc5b76c0e5a995d29 Mon Sep 17 00:00:00 2001 From: gpsnmeajp <33391403+gpsnmeajp@users.noreply.github.com> Date: Sun, 11 Dec 2022 03:28:18 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A6=96=E7=B7=9A=E5=88=B6=E5=BE=A1?= =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=B4=E3=83=AA=E3=82=BA=E3=83=A0=E3=81=AE?= =?UTF-8?q?=E5=AE=9F=E8=A3=85=E3=81=A8=E3=80=81=E6=97=A2=E5=AD=98=E9=A0=85?= =?UTF-8?q?=E7=9B=AE=E3=81=AE=E6=97=A5=E6=9C=AC=E8=AA=9E=E5=8C=96=E3=80=81?= =?UTF-8?q?VMCProtocol=E3=81=AB=E3=82=88=E3=82=8B=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=82=AB=E3=83=83=E3=83=88=E5=AE=9F=E8=A1=8C?= =?UTF-8?q?=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/ControlWPFWindow.cs | 53 +++++++++++++++++++ .../ExternalSender/ExternalReceiverForVMC.cs | 17 ++++++ Assets/Scripts/Setting/Settings.cs | 8 +++ .../FunctionKeyAddWindow.xaml.cs | 6 +++ .../ControlWindowWPF/MainWindow.xaml | 6 ++- .../ControlWindowWPF/MainWindow.xaml.cs | 12 +++++ .../ControlWindowWPF/Resources/Chinese.xaml | 11 +++- .../ControlWindowWPF/Resources/English.xaml | 11 +++- .../ControlWindowWPF/Resources/Japanese.xaml | 17 ++++-- .../ControlWindowWPF/Resources/Korean.xaml | 17 ++++-- UnityMemoryMappedFile/PipeCommands.cs | 12 +++++ 11 files changed, 159 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/ControlWPFWindow.cs b/Assets/Scripts/ControlWPFWindow.cs index f2f317a9..b2bc2e78 100644 --- a/Assets/Scripts/ControlWPFWindow.cs +++ b/Assets/Scripts/ControlWPFWindow.cs @@ -70,6 +70,8 @@ public class ControlWPFWindow : MonoBehaviour public PostProcessingManager postProcessingManager; + public AlwaysLookCameraScript alwaysLookCameraScript; + private uint defaultWindowStyle; private uint defaultExWindowStyle; @@ -383,6 +385,19 @@ private void Server_Received(object sender, DataReceivedEventArgs e) var d = (PipeCommands.SetDefaultFace)e.Data; SetDefaultFace(d.face); } + else if (e.CommandType == typeof(PipeCommands.SetAutoEyeMovementConfig)) + { + var d = (PipeCommands.SetAutoEyeMovementConfig)e.Data; + Settings.Current.FluctuationEnable = d.FluctuationEnable; + Settings.Current.AutoLookCameraEnable = d.AutoLookCameraEnable; + + SetAlwaysLookCamera(); + } + else if (e.CommandType == typeof(PipeCommands.GetAutoEyeMovementConfig)) + { + var d = (PipeCommands.GetAutoEyeMovementConfig)e.Data; + LoadAlwaysLookCamera(); + } else if (e.CommandType == typeof(PipeCommands.LoadSettings)) { var d = (PipeCommands.LoadSettings)e.Data; @@ -1034,6 +1049,20 @@ private void SetAdvancedGraphicsOption() postProcessingManager.Apply(Settings.Current); } + private async void LoadAlwaysLookCamera() + { + SetAlwaysLookCamera(); + await server.SendCommandAsync(new PipeCommands.SetAutoEyeMovementConfig + { + FluctuationEnable = Settings.Current.FluctuationEnable, + AutoLookCameraEnable = Settings.Current.AutoLookCameraEnable, + }); + } + private void SetAlwaysLookCamera() + { + alwaysLookCameraScript.Apply(Settings.Current); + } + private bool isFirstTimeExecute = true; #region VRM @@ -2258,6 +2287,29 @@ public void DoKeyAction(KeyAction action) case Functions.ShowPhotoWindow: server?.SendCommandAsync(new PipeCommands.ShowPhotoWindow { }); break; + case Functions.FixedGazeControlCamera: + alwaysLookCameraScript.ManualOperation(AlwaysLookCameraScript.FixedGaze.Camera); + break; + case Functions.FixedGazeControlAhead: + alwaysLookCameraScript.ManualOperation(AlwaysLookCameraScript.FixedGaze.Ahead); + break; + case Functions.FixedGazeControlFront: + alwaysLookCameraScript.ManualOperation(AlwaysLookCameraScript.FixedGaze.Front); + break; + case Functions.FixedGazeControlOff: + alwaysLookCameraScript.ManualOperation(AlwaysLookCameraScript.FixedGaze.Off); + break; + case Functions.AutoLookCamerOn: + Settings.Current.AutoLookCameraEnable = true; + LoadAlwaysLookCamera(); + break; + case Functions.AutoLookCamerOff: + Settings.Current.AutoLookCameraEnable = false; + LoadAlwaysLookCamera(); + break; + default: + Debug.LogError("Unimplemented functions!"); + break; } } } @@ -2795,6 +2847,7 @@ await server.SendCommandAsync(new PipeCommands.SetHandFreeOffset SetExternalBonesReceiverEnable(Settings.Current.ExternalBonesReceiverEnable); LoadAdvancedGraphicsOption(); + LoadAlwaysLookCamera(); AdditionalSettingAction?.Invoke(null); diff --git a/Assets/Scripts/ExternalSender/ExternalReceiverForVMC.cs b/Assets/Scripts/ExternalSender/ExternalReceiverForVMC.cs index 6f61e822..f5a5d306 100644 --- a/Assets/Scripts/ExternalSender/ExternalReceiverForVMC.cs +++ b/Assets/Scripts/ExternalSender/ExternalReceiverForVMC.cs @@ -471,6 +471,23 @@ void OnDataReceived(uOSC.Message message) } //受信と更新のタイミングは切り離した } + //ショートカット操作 V3.1 + else if (message.address == "/VMC/Ext/Set/Shortcut" && (message.values[0] is string)) + { + string shortcut = (string)message.values[0]; + + if (shortcut.StartsWith("Functions.")) { + Functions func; + if (Enum.TryParse(shortcut.Replace("Functions.", ""), out func)) { + KeyAction action = new KeyAction + { + FunctionAction = true, + Function = func, + }; + window.DoKeyAction(action); + } + } + } } } diff --git a/Assets/Scripts/Setting/Settings.cs b/Assets/Scripts/Setting/Settings.cs index da9fa518..d890cd6f 100644 --- a/Assets/Scripts/Setting/Settings.cs +++ b/Assets/Scripts/Setting/Settings.cs @@ -463,6 +463,12 @@ public class Settings [OptionalField] public bool TurnOffAmbientLight; + [OptionalField] + public bool FluctuationEnable; + [OptionalField] + public bool AutoLookCameraEnable; + + //初期値 [OnDeserializing()] internal void OnDeserializingMethod(StreamingContext context) @@ -611,6 +617,8 @@ internal void OnDeserializingMethod(StreamingContext context) TurnOffAmbientLight = false; ExternalBonesReceiverEnable = false; + FluctuationEnable = true; + AutoLookCameraEnable = false; } } } diff --git a/ControlWindowWPF/ControlWindowWPF/FunctionKeyAddWindow.xaml.cs b/ControlWindowWPF/ControlWindowWPF/FunctionKeyAddWindow.xaml.cs index bd38b8e7..2339d8fd 100644 --- a/ControlWindowWPF/ControlWindowWPF/FunctionKeyAddWindow.xaml.cs +++ b/ControlWindowWPF/ControlWindowWPF/FunctionKeyAddWindow.xaml.cs @@ -36,6 +36,12 @@ public partial class FunctionKeyAddWindow : Window LanguageSelector.Get("Functions_PauseTracking"), LanguageSelector.Get("Functions_ShowCalibrationWindow"), LanguageSelector.Get("Functions_ShowPhotoWindow"), + LanguageSelector.Get("Functions_FixedGazeControlCamera"), + LanguageSelector.Get("Functions_FixedGazeControlAhead"), + LanguageSelector.Get("Functions_FixedGazeControlFront"), + LanguageSelector.Get("Functions_FixedGazeControlOff"), + LanguageSelector.Get("Functions_AutoLookCamerOn"), + LanguageSelector.Get("Functions_AutoLookCamerOff"), }; public FunctionKeyAddWindow() { diff --git a/ControlWindowWPF/ControlWindowWPF/MainWindow.xaml b/ControlWindowWPF/ControlWindowWPF/MainWindow.xaml index 2d5e91aa..c84bd56c 100644 --- a/ControlWindowWPF/ControlWindowWPF/MainWindow.xaml +++ b/ControlWindowWPF/ControlWindowWPF/MainWindow.xaml @@ -146,6 +146,7 @@ + @@ -173,6 +174,9 @@ + + + @@ -191,7 +195,7 @@ -