opti: prune garbage sample expression parameters found in VRChat's template asset (#578)

This commit is contained in:
bd_ 2023-12-26 16:10:45 +09:00 committed by GitHub
parent 93aa4db3e8
commit 9e4c876305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,17 @@
using System.Linq;
using nadena.dev.ndmf;
namespace nadena.dev.modular_avatar.core.editor
{
internal class PruneParametersPass : Pass<PruneParametersPass>
{
protected override void Execute(ndmf.BuildContext context)
{
var expParams = context.AvatarDescriptor.expressionParameters;
if (expParams != null && context.IsTemporaryAsset(expParams))
{
expParams.parameters = expParams.parameters.Where(p => !string.IsNullOrEmpty(p.name)).ToArray();
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 81c7d9255ba848e4be29b291bc086ed6
timeCreated: 1703573974

View File

@ -30,7 +30,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
seq.Run("Clone animators", AnimationUtil.CloneAllControllers); seq.Run("Clone animators", AnimationUtil.CloneAllControllers);
seq = InPhase(BuildPhase.Transforming); seq = InPhase(BuildPhase.Transforming);
seq.Run("Validate configuration", seq.Run("Validate configuration",
context => ComponentValidation.ValidateAll(context.AvatarRootObject)); context => ComponentValidation.ValidateAll(context.AvatarRootObject));
seq.WithRequiredExtension(typeof(ModularAvatarContext), _s1 => seq.WithRequiredExtension(typeof(ModularAvatarContext), _s1 =>
{ {
@ -83,6 +83,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
UnityEngine.Object.DestroyImmediate(component); UnityEngine.Object.DestroyImmediate(component);
} }
}); });
seq.Run(PruneParametersPass.Instance);
}); });
InPhase(BuildPhase.Optimizing) InPhase(BuildPhase.Optimizing)