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 toAnswerHub just mention UE-77025 in the post.

1
Login to Vote

Unresolved
ComponentAnim - Animation
Affects Versions4.22.3
Target Fix4.25
CreatedJul 10, 2019
UpdatedSep 24, 2019