mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 02:35:06 +08:00
efa263b551
* feat: add version defines for VRCSDK * chore: early return if VRCSDK project but not VRChat avatar
65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
#if MA_VRCSDK3_AVATARS
|
|
|
|
using System.Linq;
|
|
using modular_avatar_tests;
|
|
using nadena.dev.modular_avatar.core.editor;
|
|
using NUnit.Framework;
|
|
using UnityEngine;
|
|
|
|
namespace UnitTests.ReactiveComponent
|
|
{
|
|
public class BlendshapeSyncTest : TestBase
|
|
{
|
|
[Test]
|
|
public void blendshapeSync_propagatesThroughMeshes()
|
|
{
|
|
var root = CreatePrefab("BlendshapeSyncTest.prefab");
|
|
|
|
var analysis = new ReactiveObjectAnalyzer().Analyze(root);
|
|
|
|
var m1 = analysis.Shapes[new TargetProp()
|
|
{
|
|
TargetObject = root.transform.Find("m1").GetComponent<SkinnedMeshRenderer>(),
|
|
PropertyName = "blendShape.bottom"
|
|
}];
|
|
var m2 = analysis.Shapes[new TargetProp()
|
|
{
|
|
TargetObject = root.transform.Find("m2").GetComponent<SkinnedMeshRenderer>(),
|
|
PropertyName = "blendShape.bottom"
|
|
}];
|
|
var m3 = analysis.Shapes[new TargetProp()
|
|
{
|
|
TargetObject = root.transform.Find("m3").GetComponent<SkinnedMeshRenderer>(),
|
|
PropertyName = "blendShape.top"
|
|
}];
|
|
|
|
Assert.IsTrue(analysis.Shapes.ContainsKey(new TargetProp()
|
|
{
|
|
TargetObject = root.transform.Find("m1").GetComponent<SkinnedMeshRenderer>(),
|
|
PropertyName = "deletedShape.bottom"
|
|
}));
|
|
|
|
Assert.AreEqual(4, analysis.Shapes.Count);
|
|
|
|
foreach (var ag in m1.actionGroups)
|
|
{
|
|
ag.TargetProp = new TargetProp();
|
|
}
|
|
|
|
foreach (var ag in m2.actionGroups)
|
|
{
|
|
ag.TargetProp = new TargetProp();
|
|
}
|
|
|
|
foreach (var ag in m3.actionGroups)
|
|
{
|
|
ag.TargetProp = new TargetProp();
|
|
}
|
|
|
|
Assert.AreEqual(m2.actionGroups, m1.actionGroups);
|
|
Assert.AreEqual(m3.actionGroups, m1.actionGroups);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |