From b73feb6b71a2f2108417c8a7fc099c9fe4002aa2 Mon Sep 17 00:00:00 2001 From: bd_ Date: Tue, 15 Oct 2024 19:13:08 -0700 Subject: [PATCH] fix: inactive menu items don't appear in RO debugger (#1291) --- .../AnimationGeneration/ReactiveObjectAnalyzer.cs | 8 +++++--- Editor/ReactiveObjects/Simulator/ROSimulator.cs | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectAnalyzer.cs b/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectAnalyzer.cs index 643c4a4e..923ac135 100644 --- a/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectAnalyzer.cs +++ b/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectAnalyzer.cs @@ -21,6 +21,8 @@ namespace nadena.dev.modular_avatar.core.editor public const string BlendshapePrefix = "blendShape."; public const string DeletedShapePrefix = "deletedShape."; + + public bool OptimizeShapes = true; public ImmutableDictionary ForcePropertyOverrides { get; set; } = ImmutableDictionary.Empty; @@ -277,13 +279,13 @@ namespace nadena.dev.modular_avatar.core.editor // corresponding mesh. If we can't, delete ops are merged into the main list of operations. initialStates = new Dictionary(); - + foreach (var (key, info) in shapes.ToList()) { if (info.actionGroups.Count == 0) { // never active control; ignore it entirely - shapes.Remove(key); + if (OptimizeShapes) shapes.Remove(key); continue; } @@ -297,7 +299,7 @@ namespace nadena.dev.modular_avatar.core.editor // If we're now constant-on, we can skip animation generation if (info.actionGroups[^1].IsConstant) { - shapes.Remove(key); + if (OptimizeShapes) shapes.Remove(key); } } } diff --git a/Editor/ReactiveObjects/Simulator/ROSimulator.cs b/Editor/ReactiveObjects/Simulator/ROSimulator.cs index 66e1578d..40b9be8c 100644 --- a/Editor/ReactiveObjects/Simulator/ROSimulator.cs +++ b/Editor/ReactiveObjects/Simulator/ROSimulator.cs @@ -264,6 +264,7 @@ namespace nadena.dev.modular_avatar.core.editor.Simulator _lastComputeContext.InvokeOnInvalidate(this, MaybeRefreshUI); var analysis = new ReactiveObjectAnalyzer(_lastComputeContext); + analysis.OptimizeShapes = false; analysis.ForcePropertyOverrides = PropertyOverrides.Value; analysis.ForceMenuItems = MenuItemOverrides.Value; var result = analysis.Analyze(avatar.gameObject);