Merge pull request #1 from sinbad/master

Fix compilation error on UE 5.1
This commit is contained in:
benui 2023-11-01 13:16:03 -07:00 committed by GitHub
commit 487cd08df9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 7 deletions

View File

@ -19,5 +19,11 @@
"Type": "DeveloperTool",
"LoadingPhase": "PreDefault"
}
],
"Plugins": [
{
"Name": "EnhancedInput",
"Enabled": true
}
]
}

View File

@ -62,6 +62,7 @@ public class ImGui : ModuleRules
new string[]
{
"CoreUObject",
"EnhancedInput",
"Engine",
"InputCore",
"Slate",

View File

@ -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

View File

@ -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());
}
}

View File

@ -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.

View File

@ -7,6 +7,8 @@
#include <GameFramework/PlayerInput.h>
#include <UObject/UObjectIterator.h>
#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<UPlayerInput>())
if (UEnhancedPlayerInput* DefaultPlayerInput = GetMutableDefault<UEnhancedPlayerInput>())
{
UpdatePlayerInput(DefaultPlayerInput, KeyBind);
}
// Update all existing player inputs to see changes in running PIE session.
for (TObjectIterator<UPlayerInput> It; It; ++It)
for (TObjectIterator<UEnhancedPlayerInput> It; It; ++It)
{
UpdatePlayerInput(*It, KeyBind);
}

View File

@ -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)
{