From 6d199117f3803580622ce440f95564aea43a346a Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Mon, 13 Mar 2023 10:38:15 +0100 Subject: [PATCH] minor fixes --- .../SGVirtualHandAnimInstanceProxy.cpp | 8 ++--- .../Components/SGVirtualHandComponent.cpp | 35 +++++++++++-------- .../GameFramework/SGPlayerController.cpp | 1 - .../GameFramework/SGVirtualHandActor.cpp | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp b/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp index 2d3dfc80..5338a79e 100644 --- a/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp @@ -93,7 +93,7 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output) const USkeletalMesh* HandMesh{VirtualHand-> #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 GetSkeletalMeshAsset() -#else +#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ SkeletalMesh #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ }; @@ -108,13 +108,13 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output) return FAnimInstanceProxy::Evaluate(Output); } - FComponentSpacePoseContext PoseContext(Output.AnimInstanceProxy); + FComponentSpacePoseContext PoseContext{Output.AnimInstanceProxy}; PoseContext.Pose.InitPose(Output.Pose); for (const TTuple& Bone: BonesRotations) { - FName BoneName(Bone.Key); - FRotator BoneRotation(Bone.Value); + FName BoneName{Bone.Key}; + FRotator BoneRotation{Bone.Value}; const int32 BoneIndex = GetRequiredBones().GetPoseBoneIndexForBoneName(BoneName); if (BoneIndex == INDEX_NONE) diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp index 883ad26e..f212c2ac 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp @@ -197,8 +197,8 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec bRight = true; bHiddenInGameIfNoGloveDetected = true; - const FString SkeletalMeshPath(Pimpl->GetDefaultMeshPath()); - const ConstructorHelpers::FObjectFinder SkeletalMesh(*SkeletalMeshPath); + const FString SkeletalMeshPath{Pimpl->GetDefaultMeshPath()}; + const ConstructorHelpers::FObjectFinder SkeletalMesh{*SkeletalMeshPath}; ensureAlwaysMsgf(SkeletalMesh.Succeeded() && SkeletalMesh.Object, TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath); Super::SetSkeletalMesh(SkeletalMesh.Object, true); @@ -229,9 +229,11 @@ void USGVirtualHandComponent::PostEditChangeProperty(FPropertyChangedEvent& Prop { Super::PostEditChangeProperty(PropertyChangedEvent); - const FName PropertyName{PropertyChangedEvent.Property + const FName PropertyName{ + PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() - : NAME_None}; + : NAME_None + }; if (PropertyName == GET_MEMBER_NAME_CHECKED(USGVirtualHandComponent, bRight)) { if (!Pimpl->IsUsingUserMesh()) @@ -294,7 +296,7 @@ bool USGVirtualHandComponent::IsGloveConnected() const USGHandPose* USGVirtualHandComponent::GetHandPose() { - USGHandPose* HandPose = nullptr; + USGHandPose* HandPose{nullptr}; if (IsValid(Glove)) { @@ -306,9 +308,11 @@ USGHandPose* USGVirtualHandComponent::GetHandPose() const FName& USGVirtualHandComponent::GetFingerBoneName(const int32 Finger, const int32 Joint) const { - const FName& Name{IsRight() + const FName& Name{ + IsRight() ? GetRightHandFingerBoneName(Finger, Joint) - : GetLeftHandFingerBoneName(Finger, Joint)}; + : GetLeftHandFingerBoneName(Finger, Joint) + }; return Name; } @@ -340,7 +344,7 @@ TMap USGVirtualHandComponent::GetFingersBonesRotations() { TMap Rotations; - if(!IsGloveConnected()) + if (!IsGloveConnected()) { return MoveTemp(Rotations); } @@ -384,7 +388,7 @@ USGVirtualHandComponent::FImpl::~FImpl() = default; bool USGVirtualHandComponent::FImpl::IsEditor() const { - const UWorld* World = Owner->GetWorld(); + const UWorld* World{Owner->GetWorld()}; if (World && World->WorldType == EWorldType::Editor) { return true; @@ -435,9 +439,10 @@ bool USGVirtualHandComponent::FImpl::IsUsingUserMesh() const USkeletalMesh* USGVirtualHandComponent::FImpl::LoadDefaultMesh() const { - const FString SkeletalMeshPath(GetDefaultMeshPath()); - USkeletalMesh* SkeletalMesh = Cast( - StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath)); + const FString SkeletalMeshPath{GetDefaultMeshPath()}; + USkeletalMesh* SkeletalMesh{ + Cast(StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath)) + }; ensureAlwaysMsgf(SkeletalMesh, TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath); @@ -454,7 +459,7 @@ USkeletalMesh* USGVirtualHandComponent::FImpl::GetMesh() const return Owner-> #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 GetSkeletalMeshAsset() -#else +#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ SkeletalMesh #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ ; @@ -468,7 +473,7 @@ USkeleton* USGVirtualHandComponent::FImpl::GetSkeleton() const return SkeletalMesh-> #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 GetSkeleton() -#else +#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ Skeleton #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ ; @@ -482,7 +487,7 @@ const FReferenceSkeleton& USGVirtualHandComponent::FImpl::GetRefSkeleton() const return SkeletalMesh-> #if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1 GetRefSkeleton() -#else +#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ RefSkeleton #endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */ ; diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPlayerController.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPlayerController.cpp index ed3539c7..4d1f29d6 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPlayerController.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPlayerController.cpp @@ -38,5 +38,4 @@ ASGPlayerController::ASGPlayerController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { - } \ No newline at end of file diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp index c467f5bc..b62828d8 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp @@ -141,7 +141,7 @@ ASGVirtualHandActor::FImpl::~FImpl() = default; bool ASGVirtualHandActor::FImpl::IsEditor() const { - const UWorld* World = Owner->GetWorld(); + const UWorld* World{Owner->GetWorld()}; if (World && World->WorldType == EWorldType::Editor) { return true;