mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-17 11:50:11 +08:00
a5bc6c50ac
* chore: preserve outfit side PhysBone even if the bone names match * chore: remove PhysBone pruning as it is no longer needed * chore: show error if outfit PhysBones affect to humanoid bones * test: replace DuplicatePBStripping test to PreserveOutfitPB test * test: remove unnecessary PhysBone from TransformMappingHandledCorrectly test * Revert "test: replace DuplicatePBStripping test to PreserveOutfitPB test" This reverts commit8fe8f15866
. * Revert "chore: show error if outfit PhysBones affect to humanoid bones" This reverts commit4f3761ebf2
. * Revert "chore: remove PhysBone pruning as it is no longer needed" This reverts commitb0c339e9d0
. * chore: restore duplicate PhysBone pruning * test: add test for non duplicated bones * chore: preserve outfit side PhysBone more than 1mm away from the avatar side bone * test: remove PhysBone stripping tests that consider PhysBone properties * test: add PhysBone stripping tests that consider bones distance * fix: merge outfit side PhysBone that is just 1mm away from the avatar side bone --------- Co-authored-by: bd_ <bd_@nadena.dev>
68 lines
2.5 KiB
C#
68 lines
2.5 KiB
C#
using nadena.dev.modular_avatar.core.editor;
|
|
using NUnit.Framework;
|
|
using VRC.SDK3.Dynamics.PhysBone.Components;
|
|
|
|
namespace modular_avatar_tests.DuplicatePBStripping
|
|
{
|
|
public class DuplicatePBStripping : TestBase
|
|
{
|
|
[Test]
|
|
public void StripsExtraPBones_withNullRootTransform()
|
|
{
|
|
var prefab = CreatePrefab("DuplicatePBStripping_nullRef.prefab");
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
Assert.AreEqual(1, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
|
|
}
|
|
|
|
[Test]
|
|
public void StripsExtraPBones_withExplicitRootTransform()
|
|
{
|
|
var prefab = CreatePrefab("DuplicatePBStripping_objRef.prefab");
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
Assert.AreEqual(1, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
|
|
}
|
|
|
|
[Test]
|
|
public void StripsExtraPBones_withSiblingRootTransform()
|
|
{
|
|
var prefab = CreatePrefab("DuplicatePBStripping_otherRef.prefab");
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
Assert.AreEqual(1, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
|
|
}
|
|
|
|
[Test]
|
|
public void StripsExtraPBones_notWhenTargetDiffers()
|
|
{
|
|
var prefab = CreatePrefab("DuplicatePBStripping_preserve.prefab");
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
// Note that this prefab has one duplicate, one non-duplicate component
|
|
Assert.AreEqual(2, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
|
|
}
|
|
|
|
[Test]
|
|
public void StripsExtraPBones_near()
|
|
{
|
|
var prefab = CreatePrefab("DuplicatePBStripping_near.prefab");
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
// Note that this prefab has a pair of PhysBones whose names match and are just 1mm apart.
|
|
// They should be merged because some outfit authors copy the entire armature, including PhysBones.
|
|
Assert.AreEqual(1, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
|
|
}
|
|
|
|
[Test]
|
|
public void StripsExtraPBones_far()
|
|
{
|
|
var prefab = CreatePrefab("DuplicatePBStripping_far.prefab");
|
|
AvatarProcessor.ProcessAvatar(prefab);
|
|
|
|
// Note that this prefab has a pair of PhysBones whose names match but are more than 1mm apart.
|
|
// They should not be merged to preserve intentionally attached PhysBone, which is not copied from the avatar.
|
|
Assert.AreEqual(2, prefab.GetComponentsInChildren<VRCPhysBone>().Length);
|
|
}
|
|
}
|
|
} |