Add cleanup pass and exception reporting

This commit is contained in:
bd_ 2023-09-20 19:24:36 +09:00
parent a837008f3a
commit 30112030d4

View File

@ -1,4 +1,6 @@
using nadena.dev.ndmf; using System;
using nadena.dev.modular_avatar.editor.ErrorReporting;
using nadena.dev.ndmf;
using nadena.dev.ndmf.animation; using nadena.dev.ndmf.animation;
using nadena.dev.ndmf.fluent; using nadena.dev.ndmf.fluent;
using UnityEngine; using UnityEngine;
@ -14,6 +16,11 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
public override string QualifiedName => "nadena.dev.modular-avatar"; public override string QualifiedName => "nadena.dev.modular-avatar";
public override string DisplayName => "Modular Avatar"; public override string DisplayName => "Modular Avatar";
protected override void OnUnhandledException(Exception e)
{
BuildReport.LogException(e);
}
protected override void Configure() protected override void Configure()
{ {
Sequence seq = InPhase(BuildPhase.Resolving); Sequence seq = InPhase(BuildPhase.Resolving);
@ -56,6 +63,13 @@ namespace nadena.dev.modular_avatar.core.editor.plugin
animator.avatar = avatar; animator.avatar = avatar;
} }
}); });
seq.Run("Purge ModularAvatar components", ctx =>
{
foreach (var component in ctx.AvatarRootTransform.GetComponentsInChildren<AvatarTagComponent>(true))
{
UnityEngine.Object.DestroyImmediate(component);
}
});
}); });
InPhase(BuildPhase.Optimizing) InPhase(BuildPhase.Optimizing)