Fix deprecation warnings in IsBindable (#45)

Merging PR #45: Fix deprecation warnings in IsBindable.
Replaced FKey::IsFloatAxis and FKey::IsVectorAxis calls with the corresponding FKey::IsAxis[1|2|3]D method calls.
Background: FKey::IsFloatAxis and FKey::IsVectorAxis are marked as deprecated as of UE4.26, replaced with FKey::IsAxis[1|2|3]D methods.
This commit is contained in:
Brandon Grimshaw 2021-03-05 06:27:29 +13:00 committed by GitHub
parent ea74c3c872
commit 47473c3eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -40,8 +40,13 @@ namespace
bool IsBindable(const FKey& Key) bool IsBindable(const FKey& Key)
{ {
#if ENGINE_COMPATIBILITY_LEGACY_KEY_AXIS_API
return Key.IsValid() && Key != EKeys::AnyKey && !Key.IsFloatAxis() && !Key.IsVectorAxis() return Key.IsValid() && Key != EKeys::AnyKey && !Key.IsFloatAxis() && !Key.IsVectorAxis()
&& !Key.IsGamepadKey() && !Key.IsModifierKey() && !Key.IsMouseButton(); && !Key.IsGamepadKey() && !Key.IsModifierKey() && !Key.IsMouseButton();
#else
return Key.IsValid() && Key != EKeys::AnyKey && !Key.IsAxis1D() && !Key.IsAxis2D()
&& !Key.IsAxis3D() && !Key.IsGamepadKey() && !Key.IsModifierKey() && !Key.IsMouseButton();
#endif
} }
void UpdatePlayerInput(UPlayerInput* PlayerInput, const FKeyBind& KeyBind) void UpdatePlayerInput(UPlayerInput* PlayerInput, const FKeyBind& KeyBind)

View File

@ -31,3 +31,5 @@
// Starting from version 4.24, world actor tick event has additional world parameter. // Starting from version 4.24, world actor tick event has additional world parameter.
#define ENGINE_COMPATIBILITY_LEGACY_WORLD_ACTOR_TICK BELOW_ENGINE_VERSION(4, 24) #define ENGINE_COMPATIBILITY_LEGACY_WORLD_ACTOR_TICK BELOW_ENGINE_VERSION(4, 24)
// Starting from version 4.26, FKey::IsFloatAxis and FKey::IsVectorAxis are deprecated and replaced with FKey::IsAxis[1|2|3]D methods.
#define ENGINE_COMPATIBILITY_LEGACY_KEY_AXIS_API BELOW_ENGINE_VERSION(4, 26)