From 5f992ff082f8a5321ed7674b00b79416bcfc3bb7 Mon Sep 17 00:00:00 2001 From: Yukina Nagatsuki Date: Thu, 21 Mar 2024 14:50:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Avatar/DynamicOVRLipSync.cs | 6 ------ Assets/Scripts/ControlWPFWindow.cs | 2 -- 2 files changed, 8 deletions(-) diff --git a/Assets/Scripts/Avatar/DynamicOVRLipSync.cs b/Assets/Scripts/Avatar/DynamicOVRLipSync.cs index bcc35f82..2d4c61c1 100644 --- a/Assets/Scripts/Avatar/DynamicOVRLipSync.cs +++ b/Assets/Scripts/Avatar/DynamicOVRLipSync.cs @@ -21,7 +21,6 @@ public class DynamicOVRLipSync : OVRLipSyncContextBase // smoothing amount public int SmoothAmount = 100; - private GameObject VRMmodel; public bool EnableLipSync = false; @@ -51,11 +50,6 @@ public void SetMicrophoneDevice(string device) micSelected = true; } - public void ImportVRMmodel(GameObject vrmmodel) - { - VRMmodel = vrmmodel; - } - // Use this for initialization void Start() { diff --git a/Assets/Scripts/ControlWPFWindow.cs b/Assets/Scripts/ControlWPFWindow.cs index 7fde95d6..21bb7270 100644 --- a/Assets/Scripts/ControlWPFWindow.cs +++ b/Assets/Scripts/ControlWPFWindow.cs @@ -1100,8 +1100,6 @@ public void LoadNewModel(GameObject model) renderer.updateWhenOffscreen = true; } - //LipSync - LipSync.ImportVRMmodel(CurrentModel); //まばたき faceController.ImportVRMmodel(CurrentModel); From 7d5a5dabfc5985764087bc11f7de36c203baf375 Mon Sep 17 00:00:00 2001 From: Yukina Nagatsuki Date: Sat, 23 Mar 2024 00:04:42 +0900 Subject: [PATCH 2/2] =?UTF-8?q?FaceController=E3=81=AE=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E5=8C=96=E3=82=92OnCurrentModelChanged=E3=81=AE=E3=82=A4?= =?UTF-8?q?=E3=83=99=E3=83=B3=E3=83=88=E3=83=8F=E3=83=B3=E3=83=89=E3=83=A9?= =?UTF-8?q?=E3=81=A7=E8=A1=8C=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Avatar/FaceController.cs | 65 +++++++++++++------------ Assets/Scripts/ControlWPFWindow.cs | 3 -- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Assets/Scripts/Avatar/FaceController.cs b/Assets/Scripts/Avatar/FaceController.cs index 43cfcd99..606dd8e8 100644 --- a/Assets/Scripts/Avatar/FaceController.cs +++ b/Assets/Scripts/Avatar/FaceController.cs @@ -102,13 +102,6 @@ public string GetCaseSensitiveKeyName(string upperCase) return KeyUpperCaseDictionary.ContainsKey(upperCase) ? KeyUpperCaseDictionary[upperCase] : upperCase; } - public void ImportVRMmodel(GameObject vrmmodel) - { - VRMmodel = vrmmodel; - proxy = null; - InitializeProxy(); - } - private void Start() { var dict = new Dictionary(); @@ -121,6 +114,23 @@ private void Start() CreateAnimation(); } + private void OnEnable() + { + VMCEvents.OnCurrentModelChanged += OnCurrentModelChanged; + } + + private void OnDisable() + { + VMCEvents.OnCurrentModelChanged -= OnCurrentModelChanged; + } + + private void OnCurrentModelChanged(GameObject model) + { + VRMmodel = model; + proxy = null; + InitializeProxy(); + } + private void CreateAnimation() { if (animationController == null) animationController = new AnimationController(); @@ -412,39 +422,32 @@ private void InitializeProxy() // Update is called once per frame void Update() { - if (VRMmodel != null) + if (VRMmodel == null) return; + + if (IsSetting == false) { - if (proxy == null) + if (EnableBlink && ViveProEyeEnabled == false) { - InitializeProxy(); - } - if (IsSetting == false) - { - if (EnableBlink && ViveProEyeEnabled == false) + isReset = false; + if (StopBlink == false) { - isReset = false; - if (StopBlink == false) - { - if (animationController?.Next() == false) - {//最後まで行ったら値更新のためにアニメーション作り直す - CreateAnimation(); - } + if (animationController?.Next() == false) + {//最後まで行ったら値更新のためにアニメーション作り直す + CreateAnimation(); } } - else + } + else + { + if (isReset == false) { - if (isReset == false) - { - isReset = true; - animationController?.Reset(); - } + isReset = true; + animationController?.Reset(); } - } - - AccumulateBlendShapes(); } + AccumulateBlendShapes(); } } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ControlWPFWindow.cs b/Assets/Scripts/ControlWPFWindow.cs index 21bb7270..0737c3f7 100644 --- a/Assets/Scripts/ControlWPFWindow.cs +++ b/Assets/Scripts/ControlWPFWindow.cs @@ -1100,9 +1100,6 @@ public void LoadNewModel(GameObject model) renderer.updateWhenOffscreen = true; } - //まばたき - faceController.ImportVRMmodel(CurrentModel); - IKManager.Instance.ModelInitialize(); VMCEvents.OnModelLoaded?.Invoke(CurrentModel);