From 3e1b80b24a9e507110725be2a51c8b1acb79897b Mon Sep 17 00:00:00 2001 From: yum Date: Sun, 30 Nov 2025 19:18:41 -0800 Subject: add top-level offValue/onValue --- Scripts/YOTSCore.cs | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'Scripts') diff --git a/Scripts/YOTSCore.cs b/Scripts/YOTSCore.cs index 2d88081..b5f08f6 100644 --- a/Scripts/YOTSCore.cs +++ b/Scripts/YOTSCore.cs @@ -74,6 +74,16 @@ namespace YOTS [SerializeField] public float onThreshold = 1.0f; + // Default value for blendshapes when the toggle is off. Range from 0-100. + // Individual blendshapes can override this with their own offValue. + [SerializeField] + public float offValue = 0.0f; + + // Default value for blendshapes when the toggle is on. Range from 0-100. + // Individual blendshapes can override this with their own onValue. + [SerializeField] + public float onValue = 100.0f; + // Whether the corresponding VRChat parameter is synced. [SerializeField] public bool synced = true; @@ -843,23 +853,26 @@ namespace YOTS if (string.IsNullOrEmpty(bs.path) && (bs.paths == null || bs.paths.Count == 0)) { throw new ArgumentException($"Blend shape in '{toggle.name}' must specify either 'path' or 'paths'"); } - + + // Use toggle's onValue if blendshape is using the default (100.0f) + float effectiveOnValue = (bs.onValue == 100.0f) ? toggle.onValue : bs.onValue; + // Handle single path if (!string.IsNullOrEmpty(bs.path)) { onAnim.blendShapes.Add(new GeneratedBlendShape{ path = bs.path, blendShape = bs.blendShape, - value = bs.onValue + value = effectiveOnValue }); } - + // Handle multiple paths if (bs.paths != null) { foreach (var path in bs.paths) { onAnim.blendShapes.Add(new GeneratedBlendShape{ path = path, blendShape = bs.blendShape, - value = bs.onValue + value = effectiveOnValue }); } } @@ -903,23 +916,26 @@ namespace YOTS if (string.IsNullOrEmpty(bs.path) && (bs.paths == null || bs.paths.Count == 0)) { throw new ArgumentException($"Blend shape in '{toggle.name}' must specify either 'path' or 'paths'"); } - + + // Use toggle's offValue if blendshape is using the default (0.0f) + float effectiveOffValue = (bs.offValue == 0.0f) ? toggle.offValue : bs.offValue; + // Handle single path if (!string.IsNullOrEmpty(bs.path)) { offAnim.blendShapes.Add(new GeneratedBlendShape{ path = bs.path, blendShape = bs.blendShape, - value = bs.offValue + value = effectiveOffValue }); } - + // Handle multiple paths if (bs.paths != null) { foreach (var path in bs.paths) { offAnim.blendShapes.Add(new GeneratedBlendShape{ path = path, blendShape = bs.blendShape, - value = bs.offValue + value = effectiveOffValue }); } } -- cgit v1.2.3