summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-02-19 15:44:34 -0800
committeryum <yum.food.vr@gmail.com>2025-02-19 15:44:34 -0800
commit8e2ecd131aa6b77b8e6642cea06fc68ef39c3d81 (patch)
tree2f49304124523749917144f939c632c86f514d7a
parent375adc170c9349be1d1a9ee11e5e2b0337444081 (diff)
Add sync & save flags to ToggleSpec
-rw-r--r--README.md13
-rw-r--r--Scripts/YOTSCore.cs17
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<VRCExpressionsMenu.Control>();
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,