mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-04 19:49:02 +08:00
chore: rename variable name to clarify means
This commit is contained in:
parent
6f39151317
commit
14d46b4546
@ -308,7 +308,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
List<Transform> skipped = null,
|
||||
HashSet<Transform> unassigned = null,
|
||||
Animator avatarAnimator = null,
|
||||
Dictionary<Transform, HumanBodyBones> humanoidBones = null
|
||||
Dictionary<Transform, HumanBodyBones> outfitHumanoidBones = null
|
||||
)
|
||||
{
|
||||
Dictionary<Transform, Transform> mappings = new Dictionary<Transform, Transform>();
|
||||
@ -360,11 +360,11 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
List<HumanBodyBones> bodyBones = null;
|
||||
var isMapped = false;
|
||||
|
||||
if (humanoidBones != null && humanoidBones.TryGetValue(child, out var humanoidBone))
|
||||
if (outfitHumanoidBones != null && outfitHumanoidBones.TryGetValue(child, out var outfitHumanoidBone))
|
||||
{
|
||||
if (avatarAnimator != null)
|
||||
{
|
||||
var avatarBone = avatarAnimator.GetBoneTransform(humanoidBone);
|
||||
var avatarBone = avatarAnimator.GetBoneTransform(outfitHumanoidBone);
|
||||
if (avatarBone != null && unassigned.Contains(avatarBone))
|
||||
{
|
||||
mappings[child] = avatarBone;
|
||||
@ -372,10 +372,10 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
lcNameToXform.Remove(NormalizeName(avatarBone.gameObject.name));
|
||||
isMapped = true;
|
||||
} else {
|
||||
bodyBones = new List<HumanBodyBones> { humanoidBone };
|
||||
bodyBones = new List<HumanBodyBones> { outfitHumanoidBone };
|
||||
}
|
||||
} else {
|
||||
bodyBones = new List<HumanBodyBones>() { humanoidBone };
|
||||
bodyBones = new List<HumanBodyBones>() { outfitHumanoidBone };
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
return mappings;
|
||||
}
|
||||
|
||||
internal static void RenameBonesByHeuristic(ModularAvatarMergeArmature config, List<Transform> skipped = null, Dictionary<Transform, HumanBodyBones> humanoidBones = null, Animator avatarAnimator = null)
|
||||
internal static void RenameBonesByHeuristic(ModularAvatarMergeArmature config, List<Transform> skipped = null, Dictionary<Transform, HumanBodyBones> outfitHumanoidBones = null, Animator avatarAnimator = null)
|
||||
{
|
||||
var target = config.mergeTarget.Get(RuntimeUtil.FindAvatarTransformInParents(config.transform));
|
||||
if (target == null) return;
|
||||
@ -445,7 +445,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
|
||||
void Traverse(Transform src, Transform dst)
|
||||
{
|
||||
var mappings = AssignBoneMappings(config, src.gameObject, dst.gameObject, skipped: skipped, humanoidBones: humanoidBones, avatarAnimator: avatarAnimator);
|
||||
var mappings = AssignBoneMappings(config, src.gameObject, dst.gameObject, skipped: skipped, outfitHumanoidBones: outfitHumanoidBones, avatarAnimator: avatarAnimator);
|
||||
|
||||
foreach (var pair in mappings)
|
||||
{
|
||||
|
@ -133,8 +133,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
outfitRoot = outfitRoot.parent;
|
||||
}
|
||||
|
||||
var humanoidBones = SetupOutfit.GetOutfitHumanoidBones(outfitRoot, outfitAnimator);
|
||||
HeuristicBoneMapper.RenameBonesByHeuristic(target, humanoidBones: humanoidBones, avatarAnimator: avatarAnimator);
|
||||
var outfitHumanoidBones = SetupOutfit.GetOutfitHumanoidBones(outfitRoot, outfitAnimator);
|
||||
HeuristicBoneMapper.RenameBonesByHeuristic(target, outfitHumanoidBones: outfitHumanoidBones, avatarAnimator: avatarAnimator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,10 +158,10 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
merge.InferPrefixSuffix();
|
||||
|
||||
var outfitAnimator = outfitRoot.GetComponent<Animator>();
|
||||
var humanoidBones = GetOutfitHumanoidBones(outfitRoot.transform, outfitAnimator);
|
||||
var outfitHumanoidBones = GetOutfitHumanoidBones(outfitRoot.transform, outfitAnimator);
|
||||
var avatarAnimator = avatarRoot.GetComponent<Animator>();
|
||||
List<Transform> subRoots = new List<Transform>();
|
||||
HeuristicBoneMapper.RenameBonesByHeuristic(merge, skipped: subRoots, humanoidBones: humanoidBones, avatarAnimator: avatarAnimator);
|
||||
HeuristicBoneMapper.RenameBonesByHeuristic(merge, skipped: subRoots, outfitHumanoidBones: outfitHumanoidBones, avatarAnimator: avatarAnimator);
|
||||
|
||||
// If the outfit has an UpperChest bone but the avatar doesn't, add an additional MergeArmature to
|
||||
// help with this
|
||||
@ -248,19 +248,19 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<Transform, HumanBodyBones> humanoidBones = null;
|
||||
Dictionary<Transform, HumanBodyBones> outfitHumanoidBones = null;
|
||||
if (outfitAnimator != null)
|
||||
{
|
||||
humanoidBones = new Dictionary<Transform, HumanBodyBones>();
|
||||
outfitHumanoidBones = new Dictionary<Transform, HumanBodyBones>();
|
||||
foreach (HumanBodyBones boneIndex in Enum.GetValues(typeof(HumanBodyBones)))
|
||||
{
|
||||
var bone = boneIndex != HumanBodyBones.LastBone ? outfitAnimator.GetBoneTransform(boneIndex) : null;
|
||||
if (bone == null) continue;
|
||||
humanoidBones[bone] = boneIndex;
|
||||
outfitHumanoidBones[bone] = boneIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return humanoidBones;
|
||||
return outfitHumanoidBones;
|
||||
}
|
||||
|
||||
private static void FixAPose(GameObject avatarRoot, Transform outfitArmature)
|
||||
|
Loading…
x
Reference in New Issue
Block a user