Description

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
   }
}

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-77025 in the post.

2
Login to Vote

Fixed
ComponentUE - Anim - Runtime
Affects Versions4.22.3
Target Fix5.0-m6
Fix Commit15953164
Main Commit15953164
CreatedJul 10, 2019
ResolvedApr 12, 2021
UpdatedNov 30, 2022
View Jira Issue