mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-28 10:15:06 +08:00
fix: menu item is not considered for unused parameter detection (#915)
This commit is contained in:
parent
bdb2dc2a42
commit
f3168253f6
@ -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<string, DetectedParameter> parameters,
|
||||
ModularAvatarMenuItem menuItem)
|
||||
{
|
||||
AddParam(menuItem.Control.parameter.name);
|
||||
foreach (var subParam in menuItem.Control.subParameters ??
|
||||
Array.Empty<VRCExpressionsMenu.Control.Parameter>()) 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<string, DetectedParameter> parameters, VRCExpressionsMenu menu,
|
||||
HashSet<VRCExpressionsMenu> visited)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user