UAnimInstance::GetPoseSnapshot
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_API
Description
Returns a read-only pointer to the stored pose snapshot with the given name, or nullptr if no snapshot exists under that name. Use this to inspect snapshot data from C++ or to verify a snapshot exists before using it in the animation graph.
Caveats & Gotchas
- • The returned pointer is owned by the anim instance and becomes invalid if the snapshot is removed via RemovePoseSnapshot or the anim instance is destroyed. Do not hold onto it beyond the current scope.
- • Snapshots captured at different LOD levels contain different bone sets. If you compare or blend snapshots captured at different LODs, missing bones fall back to reference pose which can cause visual artifacts.
Signature
ENGINE_API const FPoseSnapshot* GetPoseSnapshot(FName SnapshotName) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SnapshotName | FName | Name of the pose snapshot to retrieve, as passed to SavePoseSnapshot or AddPoseSnapshot. | — |
Return Type
const FPoseSnapshot* Example
Retrieve and inspect a stored pose snapshot C++
void UMyAnimInstance::LogSnapshotInfo(FName SnapshotName)
{
if (const FPoseSnapshot* Snapshot = GetPoseSnapshot(SnapshotName))
{
UE_LOG(LogAnimation, Log, TEXT("Snapshot '%s' has %d bones"),
*SnapshotName.ToString(), Snapshot->LocalTransforms.Num());
}
else
{
UE_LOG(LogAnimation, Warning, TEXT("No snapshot found with name '%s'"),
*SnapshotName.ToString());
}
} See Also
Tags
Version History
Introduced in: 4.20
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?