mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 02:35:06 +08:00
497d16f89d
* feat: inferring prefix/suffix now supports infer with HeuristicBoneMapper * feat: inferring prefix/suffix is now triggered when prefix/suffix is empty and merge target changed * chore: add comment for inferring prefix/suffix with HeuristicBoneMapper * feat: support using Humanoid Rig on RenameBonesByHeuristic * feat: support using cloth's Humanoid Rig on merge_armature.adjust_names * feat: support outfits' hips in one more deep place * chore: refine condition on Heuristic Bone Mapper's exact humanoid bone matching * chore: unify the process for get outfit's humanoid bones * chore: rename variable name to clarify means * chore: use InitializeOnLoadMethod instead of reflection to get boneNamePattern from Editor Assembly * test: add some tests for SetupOutfit and InferPrefixSuffix
72 lines
2.8 KiB
C#
72 lines
2.8 KiB
C#
using modular_avatar_tests;
|
|
using nadena.dev.modular_avatar.core;
|
|
using nadena.dev.modular_avatar.core.editor;
|
|
using NUnit.Framework;
|
|
using UnityEngine;
|
|
|
|
public class SetupOutfitRenameTest : TestBase
|
|
{
|
|
[Test]
|
|
public void TestSetupHumanoidOutfit()
|
|
{
|
|
var root = CreateCommonPrefab("shapell.fbx");
|
|
#if MA_VRCSDK3_AVATARS
|
|
root.AddComponent<VRC.SDK3.Avatars.Components.VRCAvatarDescriptor>();
|
|
#endif
|
|
var root_chest = root.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Chest);
|
|
|
|
var outfit = CreateCommonPrefab("shapell.fbx");
|
|
outfit.transform.SetParent(root.transform);
|
|
var outfit_chest = outfit.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Chest);
|
|
outfit_chest.name = "c";
|
|
|
|
SetupOutfit.SetupOutfitUI(outfit);
|
|
|
|
Assert.AreEqual(root_chest.name, outfit_chest.name);
|
|
}
|
|
|
|
[Test]
|
|
public void TestSetupUpperChestOutfit()
|
|
{
|
|
var root = CreateCommonPrefab("shapell.fbx");
|
|
#if MA_VRCSDK3_AVATARS
|
|
root.AddComponent<VRC.SDK3.Avatars.Components.VRCAvatarDescriptor>();
|
|
#endif
|
|
var root_armature = root.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Hips).parent.gameObject;
|
|
var root_chest = root.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Chest).gameObject;
|
|
|
|
var outfit = CreateChild(root, "Outfit");
|
|
var outfit_armature = CreateChild(outfit, "armature");
|
|
var outfit_hips = CreateChild(outfit_armature, "hips");
|
|
var outfit_spine = CreateChild(outfit_hips, "spine");
|
|
var outfit_chest = CreateChild(outfit_spine, "chest");
|
|
var outfit_upperchest = CreateChild(outfit_chest, "upperchest");
|
|
|
|
SetupOutfit.SetupOutfitUI(outfit);
|
|
|
|
Assert.AreSame(root_armature, outfit_armature.GetComponent<ModularAvatarMergeArmature>().mergeTargetObject);
|
|
Assert.AreSame(root_chest, outfit_upperchest.GetComponent<ModularAvatarMergeArmature>().mergeTargetObject);
|
|
}
|
|
|
|
[Test]
|
|
public void TestSetupSetupedOutfit()
|
|
{
|
|
var root = CreateCommonPrefab("shapell.fbx");
|
|
#if MA_VRCSDK3_AVATARS
|
|
root.AddComponent<VRC.SDK3.Avatars.Components.VRCAvatarDescriptor>();
|
|
#endif
|
|
var root_hips = root.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Hips);
|
|
var root_armature = root.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Hips).parent.gameObject;
|
|
|
|
var outfit = CreateChild(root, "Outfit");
|
|
var outfit_armature = CreateChild(outfit, "armature");
|
|
var outfit_hips = CreateChild(outfit_armature, "HIP");
|
|
outfit_armature.AddComponent<ModularAvatarMergeArmature>();
|
|
|
|
SetupOutfit.SetupOutfitUI(outfit);
|
|
|
|
Assert.AreEqual(root_armature, outfit_armature.GetComponent<ModularAvatarMergeArmature>().mergeTargetObject);
|
|
Assert.AreEqual(root_hips.name, outfit_hips.name);
|
|
}
|
|
}
|