UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BoneReference.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "BoneIndices.h"
7#include "BoneReference.generated.h"
8
9struct FBoneContainer;
10class USkeleton;
11
12USTRUCT()
14{
16
17
18 UPROPERTY(EditAnywhere, Category = BoneReference)
19 FName BoneName;
20
22 int32 BoneIndex:31;
23
27 uint32 bUseSkeletonIndex:1;
28
29 FCompactPoseBoneIndex CachedCompactPoseIndex;
30
32 : BoneName(NAME_None)
33 , BoneIndex(INDEX_NONE)
34 , bUseSkeletonIndex(false)
35 , CachedCompactPoseIndex(INDEX_NONE)
36 {
37 }
38
40 : BoneName(InBoneName)
41 , BoneIndex(INDEX_NONE)
42 , bUseSkeletonIndex(false)
43 , CachedCompactPoseIndex(INDEX_NONE)
44 {
45 }
46
47 bool operator==(const FBoneReference& Other) const
48 {
49 return BoneName == Other.BoneName;
50 }
51
52 bool operator!=(const FBoneReference& Other) const
53 {
54 return BoneName != Other.BoneName;
55 }
56
58 ENGINE_API bool Initialize(const FBoneContainer& RequiredBones);
59
60 // only used by blendspace 'PerBoneBlend'. This is skeleton indices since the input is skeleton
61 // @note, if you use this function, it won't work with GetCompactPoseIndex, GetMeshPoseIndex;
62 // it triggers ensure in those functions
64
66 void Reset()
67 {
68 BoneName = NAME_None;
69 InvalidateCachedBoneIndex();
70 }
71
73 bool HasValidSetup() const
74 {
75 return (BoneIndex != INDEX_NONE);
76 }
77
79 ENGINE_API bool IsValidToEvaluate(const FBoneContainer& RequiredBones) const;
81 bool IsValidToEvaluate() const
82 {
83 return (!bUseSkeletonIndex && CachedCompactPoseIndex != INDEX_NONE);
84 }
85
87 {
88 BoneIndex = INDEX_NONE;
89 CachedCompactPoseIndex = FCompactPoseBoneIndex(INDEX_NONE);
90 }
91
92 ENGINE_API FSkeletonPoseBoneIndex GetSkeletonPoseIndex(const FBoneContainer& RequiredBones) const;
93
94 ENGINE_API FMeshPoseBoneIndex GetMeshPoseIndex(const FBoneContainer& RequiredBones) const;
95
96 ENGINE_API FCompactPoseBoneIndex GetCompactPoseIndex(const FBoneContainer& RequiredBones) const;
97
98 // need this because of BoneReference being used in CurveMetaData and that is in SmartName
100
101 ENGINE_API bool Serialize(FArchive& Ar);
102};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FArchive & operator<<(FArchive &Ar, FEnvQueryDebugProfileData::FStep &Data)
Definition EnvQueryTypes.cpp:489
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition NameTypes.h:617
Definition Skeleton.h:295
@ false
Definition radaudio_common.h:23
Definition BoneContainer.h:192
Definition BoneReference.h:14
bool operator==(const FBoneReference &Other) const
Definition BoneReference.h:47
void InvalidateCachedBoneIndex()
Definition BoneReference.h:86
bool IsValidToEvaluate() const
Definition BoneReference.h:81
void Reset()
Definition BoneReference.h:66
bool operator!=(const FBoneReference &Other) const
Definition BoneReference.h:52
bool HasValidSetup() const
Definition BoneReference.h:73
FBoneReference(const FName &InBoneName)
Definition BoneReference.h:39
Definition BoneIndices.h:63
Definition BoneIndices.h:71
Definition BoneIndices.h:79