If user execute "Remove Unused Bones from Skeleton" on Skeleton where PoseAsset exists, the index held in FPoseData :: TrackToBufferIndex in PoseAsset will not be corrected, and it will refer to the incorrect index.
The following codes can fix this issue.
void FPoseDataContainer::DeleteTrack(int32 TrackIndex)
{
if (TrackMap.Contains(Tracks[TrackIndex]))
{
TrackMap.Remove(Tracks[TrackIndex]);
}
Tracks.RemoveAt(TrackIndex);
for (auto& Pose : Poses)
{
int32* BufferIndex = Pose.TrackToBufferIndex.Find(TrackIndex);
if (BufferIndex)
{
Pose.LocalSpacePose.RemoveAt(*BufferIndex);
Pose.TrackToBufferIndex.Remove(TrackIndex);
// add
for (auto& TrackToBufferIndex : Pose.TrackToBufferIndex)
{
if (*BufferIndex <= TrackToBufferIndex.Value)
{
TrackToBufferIndex.Value--;
}
}
}
#if WITH_EDITOR
// if not editor, they can't save this data, so it will run again when editor runs
Pose.SourceLocalSpacePose.RemoveAt(TrackIndex);
#endif // WITH_EDITOR
}
}
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-77025 in the post.
| 2 |
| Component | UE - Anim - Runtime |
|---|---|
| Affects Versions | 4.22.3 |
| Target Fix | 5.0-m6 |
| Created | Jul 10, 2019 |
|---|---|
| Resolved | Apr 12, 2021 |
| Updated | Nov 30, 2022 |