mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-28 10:15:06 +08:00
fix: ESO selects the last hips candidate, when it should pick the first (#520)
Fixes: #509
This commit is contained in:
parent
c17df16652
commit
c86804db1f
@ -302,7 +302,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool FindBones(Object obj, out GameObject avatarRoot, out GameObject avatarHips,
|
internal static bool FindBones(Object obj, out GameObject avatarRoot, out GameObject avatarHips,
|
||||||
out GameObject outfitHips)
|
out GameObject outfitHips)
|
||||||
{
|
{
|
||||||
avatarHips = outfitHips = null;
|
avatarHips = outfitHips = null;
|
||||||
@ -361,8 +361,12 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
if (tempHip.name.Contains(avatarHips.name))
|
if (tempHip.name.Contains(avatarHips.name))
|
||||||
{
|
{
|
||||||
outfitHips = tempHip.gameObject;
|
outfitHips = tempHip.gameObject;
|
||||||
|
// Prefer the first hips we find
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (outfitHips != null) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
hipsCandidates.Add(avatarHips.name);
|
hipsCandidates.Add(avatarHips.name);
|
||||||
|
1
SetupUnitTests.ps1
Normal file
1
SetupUnitTests.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
new-item -itemtype symboliclink -value UnitTests~ -Path UnitTests
|
7
SetupUnitTests.ps1.meta
Normal file
7
SetupUnitTests.ps1.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eda33529cf6a43e4c84f0ce4832a0800
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
29
UnitTests~/EasySetupOutfit/PreferFirstHipsMatch.cs
Normal file
29
UnitTests~/EasySetupOutfit/PreferFirstHipsMatch.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using modular_avatar_tests;
|
||||||
|
using nadena.dev.modular_avatar.core.editor;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using UnityEngine;
|
||||||
|
using VRC.SDK3.Avatars.Components;
|
||||||
|
|
||||||
|
public class PreferFirstHipsMatch : TestBase
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void SetupHeuristicPrefersFirstHipsMatch()
|
||||||
|
{
|
||||||
|
var root = CreatePrefab("shapell.fbx");
|
||||||
|
root.AddComponent<VRCAvatarDescriptor>();
|
||||||
|
var root_hips = root.GetComponent<Animator>().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(EasySetupOutfit.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);
|
||||||
|
}
|
||||||
|
}
|
3
UnitTests~/EasySetupOutfit/PreferFirstHipsMatch.cs.meta
Normal file
3
UnitTests~/EasySetupOutfit/PreferFirstHipsMatch.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9041d36a92ec4079804fb918c3a9b3d1
|
||||||
|
timeCreated: 1699511111
|
Loading…
Reference in New Issue
Block a user