From 98dba77a0223f3e917170124daefb23fc8a57e3b Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Wed, 13 Nov 2024 15:56:37 +0100 Subject: [PATCH] fix ue 5.5 deprecation warnings inside USGVirtualHandComponent --- .../Components/SGVirtualHandComponent.cpp | 14 ++++++++++++++ .../SenseGlove/Components/SGVirtualHandComponent.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp index 10ba4f17..d44f6243 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp @@ -236,7 +236,11 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec Super::SetCollisionResponseToChannel(ECC_Vehicle, ECR_Block); Super::SetCollisionResponseToChannel(ECC_Destructible, ECR_Block); +#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 + Super::SetAnimInstanceClass(USGVirtualHandAnimInstance::StaticClass()); +#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ Super::SetAnimClass(USGVirtualHandAnimInstance::StaticClass()); +#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ bRight = true; @@ -291,6 +295,15 @@ FSGVirtualHandSettings USGVirtualHandComponent::GetVirtualHandSettings() const return VirtualHandSettings; } +#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 +void USGVirtualHandComponent::SetAnimInstanceClass(UClass* NewClass) +{ + ensureAlwaysMsgf((TIsDerivedFrom::IsDerived), + TEXT("The AnimInstance class must be a subclass of USGVirtualHandAnimInstance!")); + + Super::SetAnimInstanceClass(NewClass); +} +#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ void USGVirtualHandComponent::SetAnimClass(UClass* NewClass) { ensureAlwaysMsgf((TIsDerivedFrom::IsDerived), @@ -298,6 +311,7 @@ void USGVirtualHandComponent::SetAnimClass(UClass* NewClass) Super::SetAnimClass(NewClass); } +#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ void USGVirtualHandComponent::PostInitProperties() { diff --git a/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h b/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h index 4ed53727..2c11b6a5 100644 --- a/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h +++ b/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h @@ -146,7 +146,11 @@ public: } public: +#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 + virtual void SetAnimInstanceClass(class UClass* NewClass) override; +#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ virtual void SetAnimClass(class UClass* NewClass) override; +#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ virtual void PostInitProperties() override;