diff --git a/ImGui.uplugin b/ImGui.uplugin index 588f211..63a7f3d 100644 --- a/ImGui.uplugin +++ b/ImGui.uplugin @@ -19,5 +19,11 @@ "Type": "DeveloperTool", "LoadingPhase": "PreDefault" } + ], + "Plugins": [ + { + "Name": "EnhancedInput", + "Enabled": true + } ] } \ No newline at end of file diff --git a/Source/ImGui/ImGui.Build.cs b/Source/ImGui/ImGui.Build.cs index ef1d029..903c231 100644 --- a/Source/ImGui/ImGui.Build.cs +++ b/Source/ImGui/ImGui.Build.cs @@ -62,6 +62,7 @@ public class ImGui : ModuleRules new string[] { "CoreUObject", + "EnhancedInput", "Engine", "InputCore", "Slate", diff --git a/Source/ImGui/Private/ImGuiImplementation.cpp b/Source/ImGui/Private/ImGuiImplementation.cpp index 6261002..ac2d97b 100644 --- a/Source/ImGui/Private/ImGuiImplementation.cpp +++ b/Source/ImGui/Private/ImGuiImplementation.cpp @@ -6,7 +6,10 @@ // For convenience and easy access to the ImGui source code, we build it as part of this module. // We don't need to define IMGUI_API manually because it is already done for this module. - +// UE 5.1 stopped defining PLATFORM_XBOXONE, so be safe if not defined +#if !defined(PLATFORM_XBOXONE) + #define PLATFORM_XBOXONE 0 +#endif #if PLATFORM_XBOXONE // Disable Win32 functions used in ImGui and not supported on XBox. #define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS diff --git a/Source/ImGui/Private/ImGuiInputHandler.cpp b/Source/ImGui/Private/ImGuiInputHandler.cpp index 67cc667..b4288d4 100644 --- a/Source/ImGui/Private/ImGuiInputHandler.cpp +++ b/Source/ImGui/Private/ImGuiInputHandler.cpp @@ -135,7 +135,7 @@ FReply UImGuiInputHandler::OnMouseButtonDown(const FPointerEvent& MouseEvent) FImGuiContextProxy* Proxy = ModuleManager->GetContextManager().GetContextProxy(0); if (Proxy) { - GEngine->AddOnScreenDebugMessage(15, 10, Proxy->WantsMouseCapture() ? FColor::Green : FColor::Red, TEXT("Handler Down")); + //GEngine->AddOnScreenDebugMessage(15, 10, Proxy->WantsMouseCapture() ? FColor::Green : FColor::Red, TEXT("Handler Down")); return ToReply(Proxy->WantsMouseCapture()); } } diff --git a/Source/ImGui/Private/ImGuiModuleSettings.h b/Source/ImGui/Private/ImGuiModuleSettings.h index e685b2e..369f076 100644 --- a/Source/ImGui/Private/ImGuiModuleSettings.h +++ b/Source/ImGui/Private/ImGuiModuleSettings.h @@ -175,7 +175,7 @@ protected: // Path to own implementation of ImGui Input Handler allowing to customize handling of keyboard and gamepad input. // If not set then default handler is used. - UPROPERTY(EditAnywhere, config, Category = "Extensions", meta = (MetaClass = "ImGuiInputHandler")) + UPROPERTY(EditAnywhere, config, Category = "Extensions", meta = (MetaClass = "/Script/ImGui.ImGuiInputHandler")) FSoftClassPath ImGuiInputHandlerClass; // Whether ImGui should share keyboard input with game. diff --git a/Source/ImGui/Private/Utilities/DebugExecBindings.cpp b/Source/ImGui/Private/Utilities/DebugExecBindings.cpp index 49bf80f..d3c4107 100644 --- a/Source/ImGui/Private/Utilities/DebugExecBindings.cpp +++ b/Source/ImGui/Private/Utilities/DebugExecBindings.cpp @@ -7,6 +7,8 @@ #include #include +#include "EnhancedPlayerInput.h" + namespace { @@ -49,7 +51,7 @@ namespace #endif } - void UpdatePlayerInput(UPlayerInput* PlayerInput, const FKeyBind& KeyBind) + void UpdatePlayerInput(UEnhancedPlayerInput* PlayerInput, const FKeyBind& KeyBind) { const int32 Index = PlayerInput->DebugExecBindings.IndexOfByPredicate([&](const FKeyBind& PlayerKeyBind) { @@ -86,13 +88,13 @@ namespace DebugExecBindings const FKeyBind KeyBind = CreateKeyBind(KeyInfo, Command); // Update default player input, so changes will be visible in all PIE sessions created after this point. - if (UPlayerInput* DefaultPlayerInput = GetMutableDefault()) + if (UEnhancedPlayerInput* DefaultPlayerInput = GetMutableDefault()) { UpdatePlayerInput(DefaultPlayerInput, KeyBind); } // Update all existing player inputs to see changes in running PIE session. - for (TObjectIterator It; It; ++It) + for (TObjectIterator It; It; ++It) { UpdatePlayerInput(*It, KeyBind); } diff --git a/Source/ImGui/Private/Widgets/SImGuiCanvasControl.cpp b/Source/ImGui/Private/Widgets/SImGuiCanvasControl.cpp index cfdbec3..505e935 100644 --- a/Source/ImGui/Private/Widgets/SImGuiCanvasControl.cpp +++ b/Source/ImGui/Private/Widgets/SImGuiCanvasControl.cpp @@ -176,7 +176,7 @@ FReply SImGuiCanvasControl::OnDragOver(const FGeometry& MyGeometry, const FDragD if (Operation.IsValid()) { const FSlateRenderTransform ScreenToWidget = MyGeometry.GetAccumulatedRenderTransform().Inverse(); - const FVector2D DragDelta = ScreenToWidget.TransformVector(DragDropEvent.GetScreenSpacePosition() - Operation->StartPosition); + const FVector2D DragDelta = ScreenToWidget.TransformVector(FVector2D(DragDropEvent.GetScreenSpacePosition() - Operation->StartPosition)); if (Operation->DragType == EDragType::Content) {