mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Merge pull request #1 from sinbad/master
Fix compilation error on UE 5.1
This commit is contained in:
commit
487cd08df9
@ -19,5 +19,11 @@
|
|||||||
"Type": "DeveloperTool",
|
"Type": "DeveloperTool",
|
||||||
"LoadingPhase": "PreDefault"
|
"LoadingPhase": "PreDefault"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"Plugins": [
|
||||||
|
{
|
||||||
|
"Name": "EnhancedInput",
|
||||||
|
"Enabled": true
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -62,6 +62,7 @@ public class ImGui : ModuleRules
|
|||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
|
"EnhancedInput",
|
||||||
"Engine",
|
"Engine",
|
||||||
"InputCore",
|
"InputCore",
|
||||||
"Slate",
|
"Slate",
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
|
|
||||||
// For convenience and easy access to the ImGui source code, we build it as part of this module.
|
// 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.
|
// 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
|
#if PLATFORM_XBOXONE
|
||||||
// Disable Win32 functions used in ImGui and not supported on XBox.
|
// Disable Win32 functions used in ImGui and not supported on XBox.
|
||||||
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
|
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
|
||||||
|
@ -135,7 +135,7 @@ FReply UImGuiInputHandler::OnMouseButtonDown(const FPointerEvent& MouseEvent)
|
|||||||
FImGuiContextProxy* Proxy = ModuleManager->GetContextManager().GetContextProxy(0);
|
FImGuiContextProxy* Proxy = ModuleManager->GetContextManager().GetContextProxy(0);
|
||||||
if (Proxy)
|
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());
|
return ToReply(Proxy->WantsMouseCapture());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ protected:
|
|||||||
|
|
||||||
// Path to own implementation of ImGui Input Handler allowing to customize handling of keyboard and gamepad input.
|
// 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.
|
// 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;
|
FSoftClassPath ImGuiInputHandlerClass;
|
||||||
|
|
||||||
// Whether ImGui should share keyboard input with game.
|
// Whether ImGui should share keyboard input with game.
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user