diff --git a/Editor/ParameterPolicy.cs b/Editor/ParameterPolicy.cs index d031e489..41288167 100644 --- a/Editor/ParameterPolicy.cs +++ b/Editor/ParameterPolicy.cs @@ -1,5 +1,6 @@ #if MA_VRCSDK3_AVATARS +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -11,6 +12,7 @@ using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.ScriptableObjects; using VRC.SDK3.Dynamics.Contact.Components; using VRC.SDK3.Dynamics.PhysBone.Components; +using Object = UnityEngine.Object; namespace nadena.dev.modular_avatar.core.editor { @@ -156,6 +158,12 @@ namespace nadena.dev.modular_avatar.core.editor WalkBlendTree(parameters, mergeBlendTree.BlendTree as BlendTree); break; } + + case ModularAvatarMenuItem menuItem: + { + AddMenuItemParameters(parameters, menuItem); + break; + } } } @@ -171,6 +179,28 @@ namespace nadena.dev.modular_avatar.core.editor } } + private static void AddMenuItemParameters(Dictionary parameters, + ModularAvatarMenuItem menuItem) + { + AddParam(menuItem.Control.parameter.name); + foreach (var subParam in menuItem.Control.subParameters ?? + Array.Empty()) AddParam(subParam.name); + + void AddParam(string name) + { + if (string.IsNullOrWhiteSpace(name)) return; + + var param = new DetectedParameter + { + OriginalName = name, + IsPrefix = false, + Source = menuItem + }; + + parameters[param.MapKey] = param; + } + } + private static void WalkMenu(Dictionary parameters, VRCExpressionsMenu menu, HashSet visited) {