Description

It seems that the compressed animation data within an anim sequence is not updated immediately when a virtual bone is added to a skeleton. If the user attempts to call UAnimSequence::GetBoneTransform in the same editor session as they added the virtual bone the editor will crash. Restarting the editor (or possibly reloading the level) will resolve the issue. It seems that calling USkeleton::HandleSkeletonHierarchyChange from FEditableSkeleton::HandleAddVirtualBone as shown below will resolve the issue but this isn't ideal as it would require making HandleSkeletonHierarchyChange public.

 bool FEditableSkeleton::HandleAddVirtualBone(const FName SourceBoneName, const FName TargetBoneName, FName& NewVirtualBoneName)
{
	FScopedTransaction Transaction(LOCTEXT("AddVirtualBone", "Add Virtual Bone to Skeleton"));
	const bool Success = Skeleton->AddNewVirtualBone(SourceBoneName, TargetBoneName, NewVirtualBoneName);
	if (!Success)
	{
		Transaction.Cancel();
	}
	else
	{
		Skeleton->HandleSkeletonHierarchyChange();	// new line
		OnTreeRefresh.Broadcast();
	}
	return Success;
}
Steps to Reproduce
  • Open Repro_00407082 project (attached)
  • Import Mannequin_StandardBones.fbx from Content dir (import the associated animation as well)
  • Add a virtual bone to the skeleton (in my case I added calf_r to ball_r)
  • Create a character bp and add the mesh and anim sequence as the animation asset
  • In the character bp event graph, add a call to ReproGetBoneTransform from the event tick and setup the inputs
    • Reference the animation asset and your virtual bone name on the bp function
  • Save all
  • Add the character bp to the level and PIE
    • A crash will occur in AEFPerTrackCompressionCodec::GetBoneAtomTranslation from the call to GetBoneTransform in the bp library
  • Restart the editor
  • PIE again
    • This time there is no crash
Callstack

UnrealEditor-Engine-Win64-Debug.dll!AEFPerTrackCompressionCodec::GetBoneAtomTranslation(UE::Math::TTransform<double> & OutAtom, FAnimSequenceDecompressionContext & DecompContext, int TrackIndex) Line 568 C++
UnrealEditor-Engine-Win64-Debug.dll!UAnimCompress_PerTrackCompression::DecompressBone(FAnimSequenceDecompressionContext & DecompContext, int TrackIndex, UE::Math::TTransform<double> & OutAtom) Line 1645 C++
UnrealEditor-Engine-Win64-Debug.dll!UAnimSequence::GetBoneTransform(UE::Math::TTransform<double> & OutAtom, int TrackIndex, float Time, bool bUseRawData) Line 1188 C++
> UnrealEditor-Repro_00407082-Win64-Debug.dll!URepro00407082BlueprintLibrary::ReproGetBoneTransform(const USkeletalMeshComponent * SkeletalMeshComponent, const UAnimSequence * AnimSequence, FName BoneName, float Time, UE::Math::TTransform<double> & Pose) Line 51 C++
UnrealEditor-Repro_00407082-Win64-Debug.dll!URepro00407082BlueprintLibrary::execPlaydeadGetBoneTransform(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 31 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!UObject::execCallMathFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 945 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!FFrame::Step(UObject * Context, void * const Z_Param__Result) Line 423 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1110 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!ProcessScriptFunction<void (_cdecl*)(UObject *,FFrame &,void *)>(UObject * Context, UFunction * Function, FFrame & Stack, void * const Z_Param_Result, void[Image Removed](UObject *, FFrame &, void *) ExecFtor) Line 912 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!ProcessLocalFunction(UObject * Context, UFunction * Fn, FFrame & Stack, void * const Z_Param__Result) Line 1143 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!UObject::execLocalFinalFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 2998 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!FFrame::Step(UObject * Context, void * const Z_Param__Result) Line 423 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1110 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!UObject::ProcessInternal(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1171 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 5912 C++
UnrealEditor-CoreUObject-Win64-Debug.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 2003 C++
UnrealEditor-Engine-Win64-Debug.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 1030 C++
UnrealEditor-Engine-Win64-Debug.dll!AActor::ReceiveTick(float DeltaSeconds) Line 2054 C++
UnrealEditor-Engine-Win64-Debug.dll!AActor::Tick(float DeltaSeconds) Line 1380 C++
UnrealEditor-Engine-Win64-Debug.dll!AActor::TickActor(float DeltaSeconds, ELevelTick TickType, FActorTickFunction & ThisTickFunction) Line 1360 C++
UnrealEditor-Engine-Win64-Debug.dll!FActorTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 197 C++
UnrealEditor-Engine-Win64-Debug.dll!FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 287 C++
UnrealEditor-Engine-Win64-Debug.dll!TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread, bool bDeleteOnCompletion) Line 977 C++
UnrealEditor-Core-Win64-Debug.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 753 C++
UnrealEditor-Core-Win64-Debug.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 642 C++
UnrealEditor-Core-Win64-Debug.dll!FTaskGraphCompatibilityImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type CurrentThread) Line 2115 C++
UnrealEditor-Core-Win64-Debug.dll!FTaskGraphCompatibilityImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TSizedInlineAllocator<4,32,TSizedDefaultAllocator<32>>> & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 2169 C++
UnrealEditor-Engine-Win64-Debug.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 565 C++
UnrealEditor-Engine-Win64-Debug.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 1592 C++
UnrealEditor-Engine-Win64-Debug.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 790 C++
UnrealEditor-Engine-Win64-Debug.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1531 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1777 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 474 C++
UnrealEditor-Win64-Debug.exe!FEngineLoop::Tick() Line 5215 C++
UnrealEditor-Win64-Debug.exe!EngineTick() Line 63 C++
UnrealEditor-Win64-Debug.exe!GuardedMain(const wchar_t * CmdLine) Line 186 C++
UnrealEditor-Win64-Debug.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 272 C++
UnrealEditor-Win64-Debug.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 330 C++

Have Comments or More Details?

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

0
Login to Vote

Cannot Reproduce
ComponentUE - Anim - Runtime
Affects Versions5.0
Target Fix5.2
CreatedMar 21, 2022
ResolvedJan 23, 2023
UpdatedFeb 2, 2023