mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 02:35:06 +08:00
opti: prune garbage sample expression parameters found in VRChat's template asset (#578)
This commit is contained in:
parent
93aa4db3e8
commit
9e4c876305
17
Editor/OptimizationPasses/PruneParametersPass.cs
Normal file
17
Editor/OptimizationPasses/PruneParametersPass.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
Editor/OptimizationPasses/PruneParametersPass.cs.meta
Normal file
3
Editor/OptimizationPasses/PruneParametersPass.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81c7d9255ba848e4be29b291bc086ed6
|
||||
timeCreated: 1703573974
|
@ -30,7 +30,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
|
||||
seq.Run("Clone animators", AnimationUtil.CloneAllControllers);
|
||||
|
||||
seq = InPhase(BuildPhase.Transforming);
|
||||
seq.Run("Validate configuration",
|
||||
seq.Run("Validate configuration",
|
||||
context => ComponentValidation.ValidateAll(context.AvatarRootObject));
|
||||
seq.WithRequiredExtension(typeof(ModularAvatarContext), _s1 =>
|
||||
{
|
||||
@ -83,6 +83,7 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
|
||||
UnityEngine.Object.DestroyImmediate(component);
|
||||
}
|
||||
});
|
||||
seq.Run(PruneParametersPass.Instance);
|
||||
});
|
||||
|
||||
InPhase(BuildPhase.Optimizing)
|
||||
|
Loading…
Reference in New Issue
Block a user