2024-10-28 01:06:35 +08:00
|
|
|
|
#if MA_VRCSDK3_AVATARS
|
|
|
|
|
|
|
|
|
|
using modular_avatar_tests;
|
2024-02-26 17:03:28 +08:00
|
|
|
|
using nadena.dev.modular_avatar.animation;
|
|
|
|
|
using nadena.dev.modular_avatar.core;
|
|
|
|
|
using nadena.dev.modular_avatar.core.editor;
|
|
|
|
|
using nadena.dev.ndmf;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using BuildContext = nadena.dev.ndmf.BuildContext;
|
|
|
|
|
|
|
|
|
|
namespace UnitTests.MergeAnimatorTests
|
|
|
|
|
{
|
|
|
|
|
internal class MergeSingleTests : TestBase
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void NoErrorWhenAnimatorIsNull()
|
|
|
|
|
{
|
|
|
|
|
var av = CreateRoot("root");
|
|
|
|
|
|
|
|
|
|
var merge = av.AddComponent<ModularAvatarMergeAnimator>();
|
|
|
|
|
|
|
|
|
|
var ctx = new BuildContext(av, null);
|
|
|
|
|
ctx.ActivateExtensionContext<ModularAvatarContext>();
|
|
|
|
|
ctx.ActivateExtensionContext<AnimationServicesContext>();
|
|
|
|
|
|
|
|
|
|
var errors = ErrorReport.CaptureErrors(() => new MergeAnimatorProcessor().OnPreprocessAvatar(av, ctx));
|
|
|
|
|
|
|
|
|
|
Assert.IsEmpty(errors);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void MergeAnimationOverrideController()
|
|
|
|
|
{
|
|
|
|
|
var av = CreateRoot("root");
|
|
|
|
|
|
|
|
|
|
var merge = av.AddComponent<ModularAvatarMergeAnimator>();
|
|
|
|
|
merge.animator = LoadAsset<AnimatorOverrideController>("AOC_Override.overrideController");
|
|
|
|
|
|
|
|
|
|
var ctx = new BuildContext(av, null);
|
|
|
|
|
ctx.ActivateExtensionContext<ModularAvatarContext>();
|
|
|
|
|
ctx.ActivateExtensionContext<AnimationServicesContext>();
|
|
|
|
|
|
|
|
|
|
var errors = ErrorReport.CaptureErrors(() => new MergeAnimatorProcessor().OnPreprocessAvatar(av, ctx));
|
|
|
|
|
|
|
|
|
|
Assert.IsEmpty(errors);
|
|
|
|
|
|
|
|
|
|
var state = FindStateInLayer(findFxLayer(av, "Target"), "Anim1");
|
|
|
|
|
Assert.IsTrue(state.motion.name.StartsWith("Anim2"));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-28 01:06:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|