After remove control rig track from the skeletal mesh, Linked Anim Graph in Post Process Anim BP of the SK Mesh does NOT work.
This issue can be fixed by the following code.
// add #include "Animation/AnimNode_LinkedInputPose.h" void FControlRigBindingHelper::UnBindFromSequencerInstance(UControlRig* ControlRig) { check(ControlRig); if (!ControlRig->IsValidLowLevel() || ControlRig->HasAnyFlags(RF_BeginDestroyed) || !IsValid(ControlRig)) { return; } if (UControlRigComponent* ControlRigComponent = Cast<UControlRigComponent>(ControlRig->GetObjectBinding()->GetBoundObject())) { // todo: how do we reset the state? //ControlRig->Initialize(); } else if (USkeletalMeshComponent* SkeletalMeshComponent = Cast<USkeletalMeshComponent>(ControlRig->GetObjectBinding()->GetBoundObject())) { if (!SkeletalMeshComponent->IsValidLowLevel() || SkeletalMeshComponent->HasAnyFlags(RF_BeginDestroyed) || !IsValid(SkeletalMeshComponent)) { return; } UControlRigLayerInstance* AnimInstance = Cast<UControlRigLayerInstance>(SkeletalMeshComponent->GetAnimInstance()); if (AnimInstance) { if (!AnimInstance->IsValidLowLevel() || AnimInstance->HasAnyFlags(RF_BeginDestroyed) || !IsValid(AnimInstance)) { return; } AnimInstance->ResetNodes(); AnimInstance->RecalcRequiredBones(); AnimInstance->RemoveControlRigTrack(ControlRig->GetUniqueID()); } FAnimCustomInstanceHelper::UnbindFromSkeletalMeshComponent< UControlRigLayerInstance>(SkeletalMeshComponent); //////// // add if (UAnimInstance* postProcessAnimInstance = SkeletalMeshComponent->PostProcessAnimInstance) { postProcessAnimInstance->InitializeAnimation(); if (FAnimNode_LinkedInputPose* inputNode = postProcessAnimInstance->GetLinkedInputPoseNode()) { inputNode->CachedInputPose.SetBoneContainer(&postProcessAnimInstance->GetRequiredBones()); } } //////// } }
expect : There is no change. The SkeletalMesh's head size does not change from (3,3,3).
result : The SkeletalMesh's head return to normal size ( 1, 1 ,1 )
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-166721 in the post.
0 |
Component | UE - Anim - Rigging - Control Rig |
---|---|
Affects Versions | 5.0.3, 5.1 |
Target Fix | 5.6 |
Created | Oct 11, 2022 |
---|---|
Updated | Sep 19, 2024 |