mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-11 23:19:00 +08:00
feat: support outfits' hips in one more deep place
This commit is contained in:
parent
b470421f02
commit
3ef94d99dd
@ -512,6 +512,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
var hipsCandidates = new List<string>();
|
var hipsCandidates = new List<string>();
|
||||||
|
var hipsExtraCandidateRoots = new List<Transform>();
|
||||||
|
|
||||||
if (outfitHips == null)
|
if (outfitHips == null)
|
||||||
{
|
{
|
||||||
@ -520,6 +521,23 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
foreach (Transform child in outfitRoot.transform)
|
foreach (Transform child in outfitRoot.transform)
|
||||||
{
|
{
|
||||||
foreach (Transform tempHip in child)
|
foreach (Transform tempHip in child)
|
||||||
|
{
|
||||||
|
if (tempHip.name.Contains(avatarHips.name))
|
||||||
|
{
|
||||||
|
outfitHips = tempHip.gameObject;
|
||||||
|
// Prefer the first hips we find
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hipsExtraCandidateRoots.Add(tempHip);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outfitHips != null) return true; // found an exact match, bail outgit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sometimes, Hips is in deeper place(like root -> Armature -> Armature 1 -> Hips).
|
||||||
|
foreach (Transform extraCandidateRoot in hipsExtraCandidateRoots)
|
||||||
|
{
|
||||||
|
foreach (Transform tempHip in extraCandidateRoot)
|
||||||
{
|
{
|
||||||
if (tempHip.name.Contains(avatarHips.name))
|
if (tempHip.name.Contains(avatarHips.name))
|
||||||
{
|
{
|
||||||
@ -533,6 +551,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
hipsCandidates.Add(avatarHips.name);
|
hipsCandidates.Add(avatarHips.name);
|
||||||
|
hipsExtraCandidateRoots = new List<Transform>();
|
||||||
|
|
||||||
// If that doesn't work out, we'll check for heuristic bone mapper mappings.
|
// If that doesn't work out, we'll check for heuristic bone mapper mappings.
|
||||||
foreach (var hbm in HeuristicBoneMapper.BoneToNameMap[HumanBodyBones.Hips])
|
foreach (var hbm in HeuristicBoneMapper.BoneToNameMap[HumanBodyBones.Hips])
|
||||||
@ -553,6 +572,25 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
outfitHips = tempHip.gameObject;
|
outfitHips = tempHip.gameObject;
|
||||||
}
|
}
|
||||||
|
hipsExtraCandidateRoots.Add(tempHip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outfitHips == null)
|
||||||
|
{
|
||||||
|
// Sometimes, Hips is in deeper place(like root -> Armature -> Armature 1 -> Hips).
|
||||||
|
foreach (Transform extraCandidateRoot in hipsExtraCandidateRoots)
|
||||||
|
{
|
||||||
|
foreach (Transform tempHip in extraCandidateRoot)
|
||||||
|
{
|
||||||
|
foreach (var candidate in hipsCandidates)
|
||||||
|
{
|
||||||
|
if (HeuristicBoneMapper.NormalizeName(tempHip.name).Contains(candidate))
|
||||||
|
{
|
||||||
|
outfitHips = tempHip.gameObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user