minor fixes

This commit is contained in:
Mamadou Babaei
2023-03-28 10:37:51 +02:00
parent 611ea0438a
commit 9ea132a98a
4 changed files with 25 additions and 21 deletions
@@ -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<FName, FRotator>& 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)
@@ -197,8 +197,8 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
bRight = true;
bHiddenInGameIfNoGloveDetected = true;
const FString SkeletalMeshPath(Pimpl->GetDefaultMeshPath());
const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMesh(*SkeletalMeshPath);
const FString SkeletalMeshPath{Pimpl->GetDefaultMeshPath()};
const ConstructorHelpers::FObjectFinder<USkeletalMesh> 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<FName, FRotator> USGVirtualHandComponent::GetFingersBonesRotations()
{
TMap<FName, FRotator> 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<USkeletalMesh>(
StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath));
const FString SkeletalMeshPath{GetDefaultMeshPath()};
USkeletalMesh* SkeletalMesh{
Cast<USkeletalMesh>(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 */
;
@@ -38,5 +38,4 @@
ASGPlayerController::ASGPlayerController(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
@@ -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;