fix: auto-rename PB parameters are not applied on animators (#803)

This commit is contained in:
bd_ 2024-03-28 09:38:05 +00:00 committed by GitHub
parent cb2fd75ec6
commit 7881aa920e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,6 +64,14 @@ namespace nadena.dev.modular_avatar.core.editor
private int internalParamIndex = 0;
// TODO: Move into NDMF
private ImmutableList<string> PhysBoneSuffixes = ImmutableList<string>.Empty
.Add("_IsGrabbed")
.Add("_IsPosed")
.Add("_Angle")
.Add("_Stretch")
.Add("_Squish");
class ParameterInfo
{
private static long encounterOrderCounter;
@ -367,7 +375,19 @@ namespace nadena.dev.modular_avatar.core.editor
var controller = merger.animator as AnimatorController;
if (controller != null)
{
ProcessAnimator(ref controller, paramInfo.GetParameterRemappingsAt(obj));
var mappings = paramInfo.GetParameterRemappingsAt(obj);
var remap = mappings.SelectMany(item =>
{
if (item.Key.Item1 == ParameterNamespace.Animator) return new[] { item };
return PhysBoneSuffixes.Select(suffix =>
new KeyValuePair<(ParameterNamespace, string), ParameterMapping>(
(ParameterNamespace.Animator, item.Key.Item2 + suffix),
new ParameterMapping(item.Value.ParameterName + suffix, item.Value.IsHidden)
)
);
}).ToImmutableDictionary();
ProcessAnimator(ref controller, remap);
merger.animator = controller;
}