using System.Reflection; using modular_avatar_tests; using nadena.dev.modular_avatar.core.editor; using NUnit.Framework; using UnityEngine; public class HipsMatchTest : TestBase { [Test] public void SetupHeuristicPrefersFirstHipsMatch() { var root = CreateCommonPrefab("shapell.fbx"); #if MA_VRCSDK3_AVATARS root.AddComponent(); #endif var root_hips = root.GetComponent().GetBoneTransform(HumanBodyBones.Hips).gameObject; var root_armature = root_hips.transform.parent.gameObject; var root_secondary = CreateChild(root, "PBC"); var root_alt_hips = CreateChild(root_secondary, "Hips"); var outfit = CreateChild(root, "Outfit"); var outfit_armature = CreateChild(outfit, "Armature"); var outfit_hips = CreateChild(outfit_armature, "Hips"); Assert.IsTrue(SetupOutfit.FindBones(outfit, out var det_av_root, out var det_av_hips, out var det_outfit_hips)); Assert.AreSame(root, det_av_root); Assert.AreSame(root_hips, det_av_hips); Assert.AreSame(outfit_hips, det_outfit_hips); } [Test] public void TestOutfitDeepHipsMatch() { var root = CreateCommonPrefab("shapell.fbx"); #if MA_VRCSDK3_AVATARS root.AddComponent(); #endif var root_hips = root.GetComponent().GetBoneTransform(HumanBodyBones.Hips).gameObject; root_hips.name = "hip"; var outfit = CreateChild(root, "Outfit"); var outfit_armature = CreateChild(outfit, "armature"); var outfit_armature2 = CreateChild(outfit_armature, "armature2"); var outfit_hips = CreateChild(outfit_armature2, "hips"); Assert.IsTrue(SetupOutfit.FindBones(outfit, out var det_av_root, out var det_av_hips, out var det_outfit_hips)); Assert.AreSame(root, det_av_root); Assert.AreSame(root_hips, det_av_hips); Assert.AreSame(outfit_hips, det_outfit_hips); } }