BlueRoseNote/03-UnrealEngine/Animation/UE5商城动画重定向插件笔记.md

38 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: UE5商城动画重定向插件笔记
date: 2023-09-05 12:02:29
excerpt:
tags:
- AnimationRetargeting
rating: ⭐
---
# MixamoAnimationRetargeting
主要逻辑位于FMixamoSkeletonRetargeter
- UE4MannequinToMixamo_BoneNamesMapping
- UE4MannequinToMixamo_ChainNamesMapping
- UE5MannequinToMixamo_BoneNamesMapping
- UE5MannequinToMixamo_ChainNamesMapping
重定向逻辑位于FMixamoSkeletonRetargeter::Retarget()
## 判断骨骼格式
```c++
bool FSkeletonMatcher::IsMatching(const USkeleton* Skeleton) const
{
// No Skeleton, No matching...
if (Skeleton == nullptr)
{ return false;
}
const int32 NumExpectedBones = BoneNames.Num();
int32 nMatchingBones = 0;
const FReferenceSkeleton & SkeletonRefSkeleton = Skeleton->GetReferenceSkeleton();
for (int32 i = 0; i < NumExpectedBones; ++i)
{ const int32 BoneIndex = SkeletonRefSkeleton.FindBoneIndex(BoneNames[i]);
if (BoneIndex != INDEX_NONE)
{ ++nMatchingBones;
} } const float MatchedPercentage = float(nMatchingBones) / float(NumExpectedBones);
return MatchedPercentage >= MinimumMatchingPerc;
}
```