UE 5.2 fixes

This commit is contained in:
Steve Streeting 2023-07-11 15:08:14 +01:00
parent 097719426a
commit 8f6180969e
3 changed files with 7 additions and 4 deletions

View File

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

View File

@ -7,6 +7,8 @@
#include <GameFramework/PlayerInput.h> #include <GameFramework/PlayerInput.h>
#include <UObject/UObjectIterator.h> #include <UObject/UObjectIterator.h>
#include "EnhancedPlayerInput.h"
namespace namespace
{ {
@ -49,7 +51,7 @@ namespace
#endif #endif
} }
void UpdatePlayerInput(UPlayerInput* PlayerInput, const FKeyBind& KeyBind) void UpdatePlayerInput(UEnhancedPlayerInput* PlayerInput, const FKeyBind& KeyBind)
{ {
const int32 Index = PlayerInput->DebugExecBindings.IndexOfByPredicate([&](const FKeyBind& PlayerKeyBind) const int32 Index = PlayerInput->DebugExecBindings.IndexOfByPredicate([&](const FKeyBind& PlayerKeyBind)
{ {
@ -86,13 +88,13 @@ namespace DebugExecBindings
const FKeyBind KeyBind = CreateKeyBind(KeyInfo, Command); const FKeyBind KeyBind = CreateKeyBind(KeyInfo, Command);
// Update default player input, so changes will be visible in all PIE sessions created after this point. // 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); UpdatePlayerInput(DefaultPlayerInput, KeyBind);
} }
// Update all existing player inputs to see changes in running PIE session. // 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); UpdatePlayerInput(*It, KeyBind);
} }

View File

@ -176,7 +176,7 @@ FReply SImGuiCanvasControl::OnDragOver(const FGeometry& MyGeometry, const FDragD
if (Operation.IsValid()) if (Operation.IsValid())
{ {
const FSlateRenderTransform ScreenToWidget = MyGeometry.GetAccumulatedRenderTransform().Inverse(); 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) if (Operation->DragType == EDragType::Content)
{ {