From 4cb2a2be4b5181b524ac284b77f3c8f04fed2c7e Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 19 Feb 2025 16:25:07 -0800 Subject: Skip YOTS if no config is on avatar --- README.md | 2 +- Scripts/YOTSNDMFGenerator.cs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 894c4f7..27c54b5 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Open your text editor of choice and paste this in: "toggles": [ { "name": "Shirt", - "meshToggles": ["Shirt"], + "meshToggles": ["Shirt"] } ] } diff --git a/Scripts/YOTSNDMFGenerator.cs b/Scripts/YOTSNDMFGenerator.cs index 602c247..c3b7783 100644 --- a/Scripts/YOTSNDMFGenerator.cs +++ b/Scripts/YOTSNDMFGenerator.cs @@ -29,7 +29,13 @@ namespace YOTS InPhase(BuildPhase.Resolving) .Run("Cache YOTS Config", ctx => { var config = ctx.AvatarRootObject.GetComponentInChildren(); - if (config == null || config.jsonConfig == null) { + if (config == null) { + ctx.GetState().skipGeneration = true; + Debug.Log("No YOTS config found - skipping."); + return; + } + if (config.jsonConfig == null) { + ctx.GetState().skipGeneration = true; ErrorReport.WithContextObject(ctx.AvatarRootObject, () => { ErrorReport.ReportException( new Exception("No YOTS config found"), @@ -47,6 +53,9 @@ namespace YOTS InPhase(BuildPhase.Transforming) .Run("Generate YOTS Animator", ctx => { var config = ctx.GetState(); + if (config.skipGeneration) { + return; + } if (config == null) { ErrorReport.WithContextObject(ctx.AvatarRootObject, () => { ErrorReport.ReportException( @@ -165,6 +174,7 @@ namespace YOTS private class YOTSBuildState { public string jsonConfig; + public bool skipGeneration; } private static VRCExpressionsMenu DeepCopyMenu(VRCExpressionsMenu sourceMenu) { -- cgit v1.2.3