summaryrefslogtreecommitdiffstats
path: root/Scripts/YOTSCore.cs
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-03-08 15:55:09 -0700
committeryum <yum.food.vr@gmail.com>2026-03-08 15:55:09 -0700
commit07646ab6a712e505b4d42b1c9e95bd0fd4d62d14 (patch)
treeca8a00bce9946ba2e18f98389027a96872d5bc02 /Scripts/YOTSCore.cs
parente0127987aff3758fcccde1e855561b3d6177c87b (diff)
Add blendshape list field
Diffstat (limited to 'Scripts/YOTSCore.cs')
-rw-r--r--Scripts/YOTSCore.cs82
1 files changed, 57 insertions, 25 deletions
diff --git a/Scripts/YOTSCore.cs b/Scripts/YOTSCore.cs
index 4421607..7ae04e4 100644
--- a/Scripts/YOTSCore.cs
+++ b/Scripts/YOTSCore.cs
@@ -116,7 +116,7 @@ namespace YOTS
if (!string.IsNullOrEmpty(parameterName)) {
return parameterName;
}
-
+
// Otherwise, generate one based on menu structure
if (disableMenuEntry) {
return name;
@@ -133,6 +133,8 @@ namespace YOTS
[SerializeField]
public string blendShape;
+ public List<string> blendShapes = new List<string>();
+
// The path to the mesh renderer to apply the blend shape to.
// For example, "Body" or "Shirt".
[SerializeField]
@@ -862,28 +864,43 @@ 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'");
}
+ // Validate that either blendShape or blendShapes is specified
+ if (string.IsNullOrEmpty(bs.blendShape) && (bs.blendShapes == null || bs.blendShapes.Count == 0)) {
+ throw new ArgumentException($"Blend shape in '{toggle.name}' must specify either 'blendShape' or 'blendShapes'");
+ }
// 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 = effectiveOnValue
- });
+ // Collect all blendshape names
+ List<string> allBlendShapes = new List<string>();
+ if (!string.IsNullOrEmpty(bs.blendShape)) {
+ allBlendShapes.Add(bs.blendShape);
+ }
+ if (bs.blendShapes != null) {
+ allBlendShapes.AddRange(bs.blendShapes);
}
- // Handle multiple paths
- if (bs.paths != null) {
- foreach (var path in bs.paths) {
+ foreach (var blendShapeName in allBlendShapes) {
+ // Handle single path
+ if (!string.IsNullOrEmpty(bs.path)) {
onAnim.blendShapes.Add(new GeneratedBlendShape{
- path = path,
- blendShape = bs.blendShape,
+ path = bs.path,
+ blendShape = blendShapeName,
value = effectiveOnValue
});
}
+
+ // Handle multiple paths
+ if (bs.paths != null) {
+ foreach (var path in bs.paths) {
+ onAnim.blendShapes.Add(new GeneratedBlendShape{
+ path = path,
+ blendShape = blendShapeName,
+ value = effectiveOnValue
+ });
+ }
+ }
}
}
}
@@ -930,28 +947,43 @@ 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'");
}
+ // Validate that either blendShape or blendShapes is specified
+ if (string.IsNullOrEmpty(bs.blendShape) && (bs.blendShapes == null || bs.blendShapes.Count == 0)) {
+ throw new ArgumentException($"Blend shape in '{toggle.name}' must specify either 'blendShape' or 'blendShapes'");
+ }
// 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 = effectiveOffValue
- });
+ // Collect all blendshape names
+ List<string> allBlendShapes = new List<string>();
+ if (!string.IsNullOrEmpty(bs.blendShape)) {
+ allBlendShapes.Add(bs.blendShape);
+ }
+ if (bs.blendShapes != null) {
+ allBlendShapes.AddRange(bs.blendShapes);
}
- // Handle multiple paths
- if (bs.paths != null) {
- foreach (var path in bs.paths) {
+ foreach (var blendShapeName in allBlendShapes) {
+ // Handle single path
+ if (!string.IsNullOrEmpty(bs.path)) {
offAnim.blendShapes.Add(new GeneratedBlendShape{
- path = path,
- blendShape = bs.blendShape,
+ path = bs.path,
+ blendShape = blendShapeName,
value = effectiveOffValue
});
}
+
+ // Handle multiple paths
+ if (bs.paths != null) {
+ foreach (var path in bs.paths) {
+ offAnim.blendShapes.Add(new GeneratedBlendShape{
+ path = path,
+ blendShape = blendShapeName,
+ value = effectiveOffValue
+ });
+ }
+ }
}
}
}