diff --git a/VRCOSC.Game/Modules/SRanipalAPIInterface.cs b/VRCOSC.Game/Modules/SRanipalAPIInterface.cs index 7c9370ca..5506d4ab 100644 --- a/VRCOSC.Game/Modules/SRanipalAPIInterface.cs +++ b/VRCOSC.Game/Modules/SRanipalAPIInterface.cs @@ -26,8 +26,8 @@ public void Initialise(bool eye, bool lip) public void Release() { - if (eyeAvailable) SRanipalAPI.Release(2); - if (lipAvailable) SRanipalAPI.Release(3); + SRanipalAPI.Release(2); + SRanipalAPI.Release(3); EyeStatus.SetDefault(); LipStatus.SetDefault(); @@ -35,17 +35,7 @@ public void Release() public void Update() { - if (eyeAvailable) updateEye(); - if (lipAvailable) updateLip(); - } - - private void updateEye() - { - SRanipalAPI.GetEyeData(ref EyeData); - } - - private void updateLip() - { - SRanipalAPI.GetLipData(ref LipData); + if (eyeAvailable) SRanipalAPI.GetEyeData(ref EyeData); + if (lipAvailable) SRanipalAPI.GetLipData(ref LipData); } } diff --git a/VRCOSC.Modules/FaceTracking/Interface/SRanipalInterface.cs b/VRCOSC.Modules/FaceTracking/Interface/SRanipalInterface.cs index 5b64078a..c3f2f3f3 100644 --- a/VRCOSC.Modules/FaceTracking/Interface/SRanipalInterface.cs +++ b/VRCOSC.Modules/FaceTracking/Interface/SRanipalInterface.cs @@ -27,8 +27,8 @@ public void Initialise(bool eye, bool lip) public void Update() { APIInterface.Update(); - EyeData.Update(APIInterface.EyeData); - LipData.Update(APIInterface.LipData); + if (EyeAvailable) EyeData.Update(APIInterface.EyeData); + if (LipAvailable) LipData.Update(APIInterface.LipData); } public void Release() diff --git a/VRCOSC.Modules/FaceTracking/SRanipalModule.cs b/VRCOSC.Modules/FaceTracking/SRanipalModule.cs index dae7e616..13932f4b 100644 --- a/VRCOSC.Modules/FaceTracking/SRanipalModule.cs +++ b/VRCOSC.Modules/FaceTracking/SRanipalModule.cs @@ -48,6 +48,8 @@ public SRanipalModule() private void handleStatus(string name, Error status) { + if (State.Value != ModuleState.Started) return; + switch (status) { case Error.WORK: @@ -118,8 +120,8 @@ protected override void OnAvatarChange() if (AvatarConfig is null) return; Log($"Avatar change detected. Parsing avatar {AvatarConfig.Name} with {AvatarConfig.Parameters.Count} parameters"); - lipParams.ForEach(key => auditParameter(key)); - eyeParams.ForEach(key => auditParameter(key)); + if (GetSetting(SRanipalSetting.EyeEnable)) eyeParams.ForEach(key => auditParameter(key)); + if (GetSetting(SRanipalSetting.LipEnable)) lipParams.ForEach(key => auditParameter(key)); var finalCount = parameterData.Select(pair => pair.Value.TotalCount).Sum(); Log($"Detected {finalCount} usable parameters");