Download

Proper timing to do transform to affect final pose in UAnimInstance

Hi, Unreal gurus,

I decide to narrow down of my questions a bit.

From the UAnimInstance API, there are functions like:

NativeUpdateAnimation(),
NativePostEvaluateAnimation(),
BlueprintPostEvaluateAnimation()

many of them sound related to the animation result.

As a experiment, I plan to inject a piece of code in order to affect the final pose:



if( !mesh ) {
GEngine->AddOnScreenDebugMessage( -1, 10.0f, FColor::Red, TEXT( "No mesh AVAILABLE!!" ) );
return;
}
auto bone = mesh->GetBoneIndex( TEXT( "foot_r" ) );
mesh->BoneSpaceTransforms[bone].SetRotation( FQuat( FRotator( 90, 90, 90 ) ) );


I tried do so in former 2, where I’m sure these lines are executed, But I cannot observe any change to the character.
BlueprintPostEvaluateAnimation() is even NOT called at all. ( That’s weird, according to the UAnimInstance source code, it’s invoked in PostEvaluateAnimation(). )

So where do you suggest me to inject these code to change final pose?
Thank you.

I also found an article from sir Rama : https://wiki.unrealengine.com/Animation_Blueprint,_Set_Custom_Variables_Via_C%2B%2B#In-Depth_Code_Sample ,
while this approach utilizing Skeletal Control, which direct me to FAnimNode_SkeletalControlBase.

But it really turn back to what I ask in another thread earlier about:
How to manipulate AnimNode_* related class, and how to associate it with AnimInstance or AnimBlueprint ?

If someone can shed a light for this helpless lamb, please lend me a hand.
Thank you.

Hi,

Here is my speculation so far after reading pages of API reference and tons of source code, although I’m not totally sure for all of them.

A Terminology mapping from UE4Editor to C++ API

A node in AnimGraph → FAnimNode_*
“Transform a bone” in AnimGraph → FAnimNode_SkeletalControlBase(?)

A state machine in AnimGraph → FAnimNode_StateMachine

A “pose link” in AnimGraph -> FComponentSpacePoseContext

Implementation of a state machine lies in FBakedAnimationStateMachine, while in AnimGraph, it’s wrapped in FAnimNode_StateMachine.

I’m sharing this in order to ease the pain who is striding the same path, and also welcome any correction or suggestion while I’m still digging.

I really hope there is someone who can share a little bit of experience about implement an AnimClass with AnimGraph in C++.
Thank you.

====================================================================
Correction:
The animation graph node we can see in the Animation Blueprint Editor is actually defined based on FAnimGraphNode_Base, which belongs to “AnimGraph” module,
while FAnimNode_Base is the node working behind the scene and belongs to “AnimGraphRuntime.”