Fixed a few errors and warnings on PS4 and XBox platforms.

This commit is contained in:
Sebastian 2018-02-02 23:14:17 +00:00
parent b2f4f43d7e
commit 2e994ac124
3 changed files with 15 additions and 9 deletions

View File

@ -9,6 +9,12 @@
// //
// 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.
#if PLATFORM_XBOXONE
// Disable Win32 functions used in ImGui and not supported on XBox.
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
#endif // PLATFORM_XBOXONE
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS
#include <AllowWindowsPlatformTypes.h> #include <AllowWindowsPlatformTypes.h>
#endif // PLATFORM_WINDOWS #endif // PLATFORM_WINDOWS

View File

@ -151,17 +151,17 @@ void FImGuiModuleManager::AddWidgetToViewport(UGameViewportClient* GameViewport)
// This makes sure that context for this world is created. // This makes sure that context for this world is created.
auto& Proxy = ContextManager.GetWorldContextProxy(*GameViewport->GetWorld()); auto& Proxy = ContextManager.GetWorldContextProxy(*GameViewport->GetWorld());
TSharedPtr<SImGuiWidget> Widget; TSharedPtr<SImGuiWidget> SharedWidget;
SAssignNew(Widget, SImGuiWidget).ModuleManager(this).GameViewport(GameViewport) SAssignNew(SharedWidget, SImGuiWidget).ModuleManager(this).GameViewport(GameViewport)
.ContextIndex(Utilities::GetWorldContextIndex(GameViewport)); .ContextIndex(Utilities::GetWorldContextIndex(GameViewport));
if (TWeakPtr<SImGuiWidget>* Slot = Widgets.FindByPredicate([](auto& Widget) { return !Widget.IsValid(); })) if (TWeakPtr<SImGuiWidget>* Slot = Widgets.FindByPredicate([](auto& Widget) { return !Widget.IsValid(); }))
{ {
*Slot = Widget; *Slot = SharedWidget;
} }
else else
{ {
Widgets.Emplace(Widget); Widgets.Emplace(SharedWidget);
} }
} }

View File

@ -10,6 +10,11 @@
namespace Utilities namespace Utilities
{ {
FORCEINLINE const FWorldContext* GetWorldContext(const UGameInstance& GameInstance)
{
return GameInstance.GetWorldContext();
}
template<typename T> template<typename T>
FORCEINLINE const FWorldContext* GetWorldContext(const TWeakObjectPtr<T>& Obj) FORCEINLINE const FWorldContext* GetWorldContext(const TWeakObjectPtr<T>& Obj)
{ {
@ -22,11 +27,6 @@ namespace Utilities
return Obj ? GetWorldContext(*Obj) : nullptr; return Obj ? GetWorldContext(*Obj) : nullptr;
} }
FORCEINLINE const FWorldContext* GetWorldContext(const UGameInstance& GameInstance)
{
return GameInstance.GetWorldContext();
}
FORCEINLINE const FWorldContext* GetWorldContext(const UGameViewportClient& GameViewportClient) FORCEINLINE const FWorldContext* GetWorldContext(const UGameViewportClient& GameViewportClient)
{ {
return GetWorldContext(GameViewportClient.GetGameInstance()); return GetWorldContext(GameViewportClient.GetGameInstance());