2023-11-10 14:37:56 +08:00
|
|
|
|
#if MA_VRCSDK3_AVATARS
|
|
|
|
|
|
|
|
|
|
using nadena.dev.modular_avatar.core.editor;
|
2023-01-06 22:45:10 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace modular_avatar_tests.AnimateAddedBones
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This test verifies that merged animations which affect a bone newly added to an armature by Merge Armature
|
|
|
|
|
/// are properly adjusted for the new bone path.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AnimateAddedBones : TestBase
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void AnimatesAddedBones()
|
|
|
|
|
{
|
|
|
|
|
var prefab = CreatePrefab("AnimateAddedBones.prefab");
|
|
|
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
|
|
2023-01-06 22:54:48 +08:00
|
|
|
|
var layerName = "merged";
|
2023-01-06 22:45:10 +08:00
|
|
|
|
|
2023-03-25 14:29:00 +08:00
|
|
|
|
var motion = findFxClip(prefab, layerName);
|
2023-01-06 22:45:10 +08:00
|
|
|
|
|
|
|
|
|
var cubeObject = prefab.transform.Find("Armature/Hips").GetChild(0).gameObject;
|
|
|
|
|
Assert.True(cubeObject.name.StartsWith("Cube$"));
|
|
|
|
|
|
|
|
|
|
var binding =
|
|
|
|
|
EditorCurveBinding.FloatCurve("Armature/Hips/" + cubeObject.name, typeof(Transform),
|
|
|
|
|
"localEulerAnglesRaw.x");
|
|
|
|
|
Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding));
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-10 14:37:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|