diff --git a/Editor/OptimizationPasses/PruneParametersPass.cs b/Editor/OptimizationPasses/PruneParametersPass.cs new file mode 100644 index 00000000..97da2939 --- /dev/null +++ b/Editor/OptimizationPasses/PruneParametersPass.cs @@ -0,0 +1,17 @@ +using System.Linq; +using nadena.dev.ndmf; + +namespace nadena.dev.modular_avatar.core.editor +{ + internal class PruneParametersPass : Pass + { + 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(); + } + } + } +} \ No newline at end of file diff --git a/Editor/OptimizationPasses/PruneParametersPass.cs.meta b/Editor/OptimizationPasses/PruneParametersPass.cs.meta new file mode 100644 index 00000000..c36e34b9 --- /dev/null +++ b/Editor/OptimizationPasses/PruneParametersPass.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 81c7d9255ba848e4be29b291bc086ed6 +timeCreated: 1703573974 \ No newline at end of file diff --git a/Editor/PluginDefinition/PluginDefinition.cs b/Editor/PluginDefinition/PluginDefinition.cs index e2796c9f..0d9b5d32 100644 --- a/Editor/PluginDefinition/PluginDefinition.cs +++ b/Editor/PluginDefinition/PluginDefinition.cs @@ -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)