modular-avatar/Assets/_ModularAvatar/EditModeTests/BlendshapeSyncTests/BlendshapeSyncIntegrationTest.cs
bd_ c454bc1ed8
fix: blendshape sync not being processed (#466)
* Add integration test for blendshape sync

* fix: blendshape sync not being processed

This change refactors AnimationDatabase to be part of the same extension
context as the TrackObjectRenames functionality (which is renamed back to
PathMappings). This then allows us to sequence deactivation of this context
to come after blendshape processing completes.

Fixes: #461
2023-10-01 00:09:43 +09:00

41 lines
1.6 KiB
C#

using System.Collections.Immutable;
using System.Linq;
using modular_avatar_tests;
using nadena.dev.modular_avatar.animation;
using nadena.dev.ndmf;
using NUnit.Framework;
using UnityEditor;
namespace modular_avatar_tests
{
public class BlendshapeSyncIntegrationTest : TestBase
{
[Test]
public void IntegrationTest_BlendshapeSync()
{
var root = CreatePrefab("BlendshapeSyncIntegrationTest.prefab");
AvatarProcessor.ProcessAvatar(root);
var clip = findFxClip(root, "Base Layer");
var bindings = AnimationUtility.GetCurveBindings(clip)
.Select(binding =>
{
var constantKey = AnimationUtility.GetEditorCurve(clip, binding).keys[0].value;
return (binding.path, binding.propertyName, constantKey);
}).ToImmutableHashSet();
Assert.True(bindings.Contains(("BaseMesh", "blendShape.shape_0", 0.1f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.shape_0_local", 0.3f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.shape_1", 0.2f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.missing_mesh_shape", 0.4f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.missing_mesh_shape_2", 0.5f)));
Assert.True(bindings.Contains(("SyncedMesh", "blendShape.shape_0_local", 0.1f)));
Assert.True(bindings.Contains(("SyncedMesh", "blendShape.shape_1", 0.2f)));
Assert.AreEqual(bindings.Count, 7);
}
}
}