minor fixes

This commit is contained in:
Mamadou Babaei
2023-03-28 10:39:53 +02:00
parent 33c07a0108
commit 6aa953279b
4 changed files with 25 additions and 21 deletions
@@ -93,7 +93,7 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
const USkeletalMesh* HandMesh{VirtualHand-> const USkeletalMesh* HandMesh{VirtualHand->
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
GetSkeletalMeshAsset() GetSkeletalMeshAsset()
#else #else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
SkeletalMesh SkeletalMesh
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
}; };
@@ -108,13 +108,13 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
return FAnimInstanceProxy::Evaluate(Output); return FAnimInstanceProxy::Evaluate(Output);
} }
FComponentSpacePoseContext PoseContext(Output.AnimInstanceProxy); FComponentSpacePoseContext PoseContext{Output.AnimInstanceProxy};
PoseContext.Pose.InitPose(Output.Pose); PoseContext.Pose.InitPose(Output.Pose);
for (const TTuple<FName, FRotator>& Bone: BonesRotations) for (const TTuple<FName, FRotator>& Bone: BonesRotations)
{ {
FName BoneName(Bone.Key); FName BoneName{Bone.Key};
FRotator BoneRotation(Bone.Value); FRotator BoneRotation{Bone.Value};
const int32 BoneIndex = GetRequiredBones().GetPoseBoneIndexForBoneName(BoneName); const int32 BoneIndex = GetRequiredBones().GetPoseBoneIndexForBoneName(BoneName);
if (BoneIndex == INDEX_NONE) if (BoneIndex == INDEX_NONE)
@@ -197,8 +197,8 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
bRight = true; bRight = true;
bHiddenInGameIfNoGloveDetected = true; bHiddenInGameIfNoGloveDetected = true;
const FString SkeletalMeshPath(Pimpl->GetDefaultMeshPath()); const FString SkeletalMeshPath{Pimpl->GetDefaultMeshPath()};
const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMesh(*SkeletalMeshPath); const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMesh{*SkeletalMeshPath};
ensureAlwaysMsgf(SkeletalMesh.Succeeded() && SkeletalMesh.Object, ensureAlwaysMsgf(SkeletalMesh.Succeeded() && SkeletalMesh.Object,
TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath); TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath);
Super::SetSkeletalMesh(SkeletalMesh.Object, true); Super::SetSkeletalMesh(SkeletalMesh.Object, true);
@@ -229,9 +229,11 @@ void USGVirtualHandComponent::PostEditChangeProperty(FPropertyChangedEvent& Prop
{ {
Super::PostEditChangeProperty(PropertyChangedEvent); Super::PostEditChangeProperty(PropertyChangedEvent);
const FName PropertyName{PropertyChangedEvent.Property const FName PropertyName{
PropertyChangedEvent.Property
? PropertyChangedEvent.Property->GetFName() ? PropertyChangedEvent.Property->GetFName()
: NAME_None}; : NAME_None
};
if (PropertyName == GET_MEMBER_NAME_CHECKED(USGVirtualHandComponent, bRight)) if (PropertyName == GET_MEMBER_NAME_CHECKED(USGVirtualHandComponent, bRight))
{ {
if (!Pimpl->IsUsingUserMesh()) if (!Pimpl->IsUsingUserMesh())
@@ -294,7 +296,7 @@ bool USGVirtualHandComponent::IsGloveConnected() const
USGHandPose* USGVirtualHandComponent::GetHandPose() USGHandPose* USGVirtualHandComponent::GetHandPose()
{ {
USGHandPose* HandPose = nullptr; USGHandPose* HandPose{nullptr};
if (IsValid(Glove)) if (IsValid(Glove))
{ {
@@ -306,9 +308,11 @@ USGHandPose* USGVirtualHandComponent::GetHandPose()
const FName& USGVirtualHandComponent::GetFingerBoneName(const int32 Finger, const int32 Joint) const const FName& USGVirtualHandComponent::GetFingerBoneName(const int32 Finger, const int32 Joint) const
{ {
const FName& Name{IsRight() const FName& Name{
IsRight()
? GetRightHandFingerBoneName(Finger, Joint) ? GetRightHandFingerBoneName(Finger, Joint)
: GetLeftHandFingerBoneName(Finger, Joint)}; : GetLeftHandFingerBoneName(Finger, Joint)
};
return Name; return Name;
} }
@@ -340,7 +344,7 @@ TMap<FName, FRotator> USGVirtualHandComponent::GetFingersBonesRotations()
{ {
TMap<FName, FRotator> Rotations; TMap<FName, FRotator> Rotations;
if(!IsGloveConnected()) if (!IsGloveConnected())
{ {
return MoveTemp(Rotations); return MoveTemp(Rotations);
} }
@@ -384,7 +388,7 @@ USGVirtualHandComponent::FImpl::~FImpl() = default;
bool USGVirtualHandComponent::FImpl::IsEditor() const bool USGVirtualHandComponent::FImpl::IsEditor() const
{ {
const UWorld* World = Owner->GetWorld(); const UWorld* World{Owner->GetWorld()};
if (World && World->WorldType == EWorldType::Editor) if (World && World->WorldType == EWorldType::Editor)
{ {
return true; return true;
@@ -435,9 +439,10 @@ bool USGVirtualHandComponent::FImpl::IsUsingUserMesh() const
USkeletalMesh* USGVirtualHandComponent::FImpl::LoadDefaultMesh() const USkeletalMesh* USGVirtualHandComponent::FImpl::LoadDefaultMesh() const
{ {
const FString SkeletalMeshPath(GetDefaultMeshPath()); const FString SkeletalMeshPath{GetDefaultMeshPath()};
USkeletalMesh* SkeletalMesh = Cast<USkeletalMesh>( USkeletalMesh* SkeletalMesh{
StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath)); Cast<USkeletalMesh>(StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath))
};
ensureAlwaysMsgf(SkeletalMesh, TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath); ensureAlwaysMsgf(SkeletalMesh, TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath);
@@ -454,7 +459,7 @@ USkeletalMesh* USGVirtualHandComponent::FImpl::GetMesh() const
return Owner-> return Owner->
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
GetSkeletalMeshAsset() GetSkeletalMeshAsset()
#else #else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
SkeletalMesh SkeletalMesh
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
; ;
@@ -468,7 +473,7 @@ USkeleton* USGVirtualHandComponent::FImpl::GetSkeleton() const
return SkeletalMesh-> return SkeletalMesh->
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
GetSkeleton() GetSkeleton()
#else #else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
Skeleton Skeleton
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
; ;
@@ -482,7 +487,7 @@ const FReferenceSkeleton& USGVirtualHandComponent::FImpl::GetRefSkeleton() const
return SkeletalMesh-> return SkeletalMesh->
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
GetRefSkeleton() GetRefSkeleton()
#else #else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
RefSkeleton RefSkeleton
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
; ;
@@ -38,5 +38,4 @@
ASGPlayerController::ASGPlayerController(const FObjectInitializer& ObjectInitializer) ASGPlayerController::ASGPlayerController(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer) : Super(ObjectInitializer)
{ {
} }
@@ -141,7 +141,7 @@ ASGVirtualHandActor::FImpl::~FImpl() = default;
bool ASGVirtualHandActor::FImpl::IsEditor() const bool ASGVirtualHandActor::FImpl::IsEditor() const
{ {
const UWorld* World = Owner->GetWorld(); const UWorld* World{Owner->GetWorld()};
if (World && World->WorldType == EWorldType::Editor) if (World && World->WorldType == EWorldType::Editor)
{ {
return true; return true;