From 8e2ecd131aa6b77b8e6642cea06fc68ef39c3d81 Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 19 Feb 2025 15:44:34 -0800 Subject: Add sync & save flags to ToggleSpec --- README.md | 13 +++++++++++++ Scripts/YOTSCore.cs | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0c4768b..720b571 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,19 @@ Toggle options are documented in two places: truth. 2. The [Examples](./Examples). +## Technical details + +* Toggles are created as boolean parameters. +* Radial puppets (sliders) are created as float parameters. +* By default, all parameters are synced and saved. These can both be + overridden. +* The generated VRChat parameter and animator parameters use the "name" field. + No namespacing is applied. +* The generated animator has exactly as many layers as the maximum length of + any dependency chain in your dependency graph. +* The generated animator's parameters and layers are simply appended to your + input animator. + ## Motivation Animators have a two fundamental problems: diff --git a/Scripts/YOTSCore.cs b/Scripts/YOTSCore.cs index cb71c40..a4d3add 100644 --- a/Scripts/YOTSCore.cs +++ b/Scripts/YOTSCore.cs @@ -53,6 +53,14 @@ namespace YOTS [SerializeField] public float defaultValue = 1.0f; + // Whether the corresponding VRChat parameter is synced. + [SerializeField] + public bool synced = true; + + // Whether the corresponding VRChat parameter is saved. + [SerializeField] + public bool saved = true; + public ToggleSpec(string name) { this.name = name; } @@ -832,7 +840,8 @@ namespace YOTS name = toggle.name, valueType = toggle.type == "radial" ? VRCExpressionParameters.ValueType.Float : VRCExpressionParameters.ValueType.Bool, defaultValue = toggle.defaultValue, - saved = true + saved = toggle.saved, + networkSynced = toggle.synced }); } vrcParams.parameters = paramList.ToArray(); @@ -843,15 +852,15 @@ namespace YOTS yotsSubmenu.controls = new List(); foreach (var toggle in toggleSpecs) { VRCExpressionsMenu currentMenu = yotsSubmenu; + // Recursively create menus until we wind up at the leaf. if (!string.IsNullOrEmpty(toggle.menuPath) && toggle.menuPath != "/") { string trimmedPath = toggle.menuPath.Trim('/'); var sections = trimmedPath.Split('/'); foreach (var section in sections) { currentMenu = GetOrCreateSubmenu(currentMenu, section); - modifiedMenus.Add(currentMenu); } } - // Add toggle controls + // Add toggle. if (toggle.type == "radial") { currentMenu.controls.Add(new VRCExpressionsMenu.Control{ name = toggle.name, @@ -870,7 +879,7 @@ namespace YOTS } } - // Add YOTS submenu to main menu + // Add YOTS submenu to main menu. vrcMenu.controls.Add(new VRCExpressionsMenu.Control{ name = "YOTS", type = VRCExpressionsMenu.Control.ControlType.SubMenu, -- cgit v1.2.3