diff --git a/Content/Luprex/InputActions/IA_Dummy.uasset b/Content/Luprex/InputActions/IA_Dummy.uasset new file mode 100644 index 00000000..1a0c4cf0 --- /dev/null +++ b/Content/Luprex/InputActions/IA_Dummy.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5af47ee39bf343a101b7d246624a8dc1fb494024cde64c21eb98c2f029075fb +size 1311 diff --git a/Content/Luprex/lxMappingsForPIE.uasset b/Content/Luprex/lxMappingsForPIE.uasset new file mode 100644 index 00000000..4b9877b9 --- /dev/null +++ b/Content/Luprex/lxMappingsForPIE.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb7f09c94d1ad5ca6f5a503f847c54216dad25fc1bd16ab47e1e6ca16af7a075 +size 11610 diff --git a/Content/Luprex/lxWidgetMacroLibrary.uasset b/Content/Luprex/lxWidgetMacroLibrary.uasset new file mode 100644 index 00000000..05f063c9 --- /dev/null +++ b/Content/Luprex/lxWidgetMacroLibrary.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e233a68905766a7cba284a9b4b49e0ad5019a7053df6fd8735950b40f30dbeec +size 31967 diff --git a/Content/Widgets/WB_Hotkeys.uasset b/Content/Widgets/WB_Hotkeys.uasset index 53e60a1a..4694cee7 100644 --- a/Content/Widgets/WB_Hotkeys.uasset +++ b/Content/Widgets/WB_Hotkeys.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a85cbbd8752ea2a819a457f632a54efc7534b7503ca813a8333785acb026378d -size 211426 +oid sha256:069915db68f5303ce8ba8e522ba70e8fa5abe6e2062c5d8d9a233ef59259b83d +size 208309 diff --git a/Source/Integration/UtilityLibrary.cpp b/Source/Integration/UtilityLibrary.cpp index d76d8dd6..9e9351d0 100644 --- a/Source/Integration/UtilityLibrary.cpp +++ b/Source/Integration/UtilityLibrary.cpp @@ -212,10 +212,8 @@ void UlxUtilityLibrary::GetPositionOfGridPanelMiddleCell(UGridPanel *GridPanel, } } -ElxUsedOrNotUsed UlxUtilityLibrary::IsKeyUsedByMappingContext(const FKeyEvent &KeyEvent, const UInputMappingContext *MappingContext) +ElxUsedOrNotUsed UlxUtilityLibrary::IsKeyUsedByMappingContext(const FKey &Key, const UInputMappingContext *MappingContext) { - FKey Key = KeyEvent.GetKey(); - if (!MappingContext) { return ElxUsedOrNotUsed::NotUsed; @@ -223,69 +221,9 @@ ElxUsedOrNotUsed UlxUtilityLibrary::IsKeyUsedByMappingContext(const FKeyEvent &K for (const FEnhancedActionKeyMapping& Mapping : MappingContext->GetMappings()) { - if (Mapping.Key == Key) - { - return ElxUsedOrNotUsed::Used; - } + if (Mapping.Key == Key) return ElxUsedOrNotUsed::Used; } return ElxUsedOrNotUsed::NotUsed; } -class UEnhancedPlayerInputExposed : public UEnhancedPlayerInput -{ -public: - const TArray& GetEnhancedActionMappings() const { return UEnhancedPlayerInput::GetEnhancedActionMappings(); } -}; - -ElxUsedOrNotUsed UlxUtilityLibrary::IsKeyUsedByPlayerController(const FKeyEvent &KeyEvent, bool IncludeEscapeAndFkeys, const APlayerController *PlayerController, const UObject *Context) -{ - if (PlayerController == nullptr) PlayerController = Context->GetWorld()->GetFirstPlayerController(); - - FKey Key = KeyEvent.GetKey(); - - UEnhancedPlayerInput *PlayerInput = Cast(PlayerController->PlayerInput); - if (PlayerInput == nullptr) - { - return ElxUsedOrNotUsed::NotUsed; - } - UEnhancedPlayerInputExposed *Exposed = static_cast(PlayerInput); - - for (const FInputActionKeyMapping& ActionMapping : Exposed->ActionMappings) - { - if (ActionMapping.Key == Key) - { - return ElxUsedOrNotUsed::Used; // Found a match in legacy Action Mappings. - } - } - - for (const FInputAxisKeyMapping& AxisMapping : Exposed->AxisMappings) - { - if (AxisMapping.Key == Key) - { - return ElxUsedOrNotUsed::Used; // Found a match in legacy Axis Mappings. - } - } - - for (const FEnhancedActionKeyMapping& Mapping : Exposed->GetEnhancedActionMappings()) - { - if (Mapping.Key == Key) - { - return ElxUsedOrNotUsed::Used; // Found a match in the active, flattened mappings. - } - } - - if (IncludeEscapeAndFkeys) - { - if (Key == EKeys::Escape || - Key == EKeys::F1 || Key == EKeys::F2 || Key == EKeys::F3 || - Key == EKeys::F4 || Key == EKeys::F5 || Key == EKeys::F6 || - Key == EKeys::F7 || Key == EKeys::F8 || Key == EKeys::F9 || - Key == EKeys::F10 || Key == EKeys::F11 || Key == EKeys::F12) - { - return ElxUsedOrNotUsed::Used; - } - } - - return ElxUsedOrNotUsed::NotUsed; -} diff --git a/Source/Integration/UtilityLibrary.h b/Source/Integration/UtilityLibrary.h index 0d866c95..55482f55 100644 --- a/Source/Integration/UtilityLibrary.h +++ b/Source/Integration/UtilityLibrary.h @@ -133,21 +133,11 @@ public: UFUNCTION(BlueprintPure, Category="Widget") static void GetPositionOfGridPanelMiddleCell(UGridPanel *GridPanel, FVector2D &UpperLeftXY, FVector2D &LowerRightXY); - // Check if a given key is used by the mapping context. + // Check if a given key is used by the specified mapping context. + // + // This is true if the key is mapped to anything at all within + // the specified mapping context. // UFUNCTION(BlueprintCallable, Category = "Input", meta = (ExpandEnumAsExecs="ReturnValue")) - static ElxUsedOrNotUsed IsKeyUsedByMappingContext(const FKeyEvent &KeyEvent, const UInputMappingContext *MappingContext); - - // Check if a given key is used by the player controller. - // - // If you pass in a null pointer for the player controller, then this - // function will use the first player controller by default. - // - // If 'Include Escape and FKeys' is checked, then the escape key - // and the function keys are also considered to be 'used' by the - // player controller. It is generally a good idea to treat these - // keys as reserved for play-in-editor. - // - UFUNCTION(BlueprintCallable, Category = "Input", meta = (WorldContext="Context", ExpandEnumAsExecs="ReturnValue", IncludeEscapeAndFkeys="true")) - static ElxUsedOrNotUsed IsKeyUsedByPlayerController(const FKeyEvent &KeyEvent, bool IncludeEscapeAndFkeys, const APlayerController *PlayerController, const UObject *Context); + static ElxUsedOrNotUsed IsKeyUsedByMappingContext(const FKey &Key, const UInputMappingContext *MappingContext); };