Updated to Unreal Engine 4.18 (backward compatible).

This commit is contained in:
Sebastian 2017-11-05 22:36:39 +00:00
parent 9db4abcb0a
commit 2b19b2108a
2 changed files with 12 additions and 4 deletions

View File

@ -146,12 +146,12 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetWorldContextData(co
const int32 Index = GetWorldContextIndex(*WorldContext);
checkf(Index != Utilities::INVALID_CONTEXT_INDEX, TEXT("Couldn't find context index for world %s: WorldType = %d"),
*World.GetName(), World.WorldType);
*World.GetName(), static_cast<int32>(World.WorldType));
#if WITH_EDITOR
checkf(!GEngine->IsEditor() || Index != Utilities::EDITOR_CONTEXT_INDEX,
TEXT("Context index %d is reserved for editor and cannot be used for world %s: WorldType = %d, NetMode = %d"),
Index, *World.GetName(), World.WorldType, World.GetNetMode());
Index, *World.GetName(), static_cast<int32>(World.WorldType), static_cast<int32>(World.GetNetMode()));
#endif
FContextData* Data = Contexts.Find(Index);

View File

@ -7,6 +7,8 @@
#include "ImGuiImplementation.h"
#include "ImGuiInteroperability.h"
#include <Runtime/Launch/Resources/Version.h>
static constexpr float DEFAULT_CANVAS_WIDTH = 3840.f;
static constexpr float DEFAULT_CANVAS_HEIGHT = 2160.f;
@ -16,7 +18,13 @@ namespace
{
FString GetSaveDirectory()
{
FString Directory = FPaths::Combine(*FPaths::GameSavedDir(), TEXT("ImGui"));
#if (ENGINE_MAJOR_VERSION > 4 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 18))
const FString SavedDir = FPaths::ProjectSavedDir();
#else
const FString SavedDir = FPaths::GameSavedDir();
#endif
FString Directory = FPaths::Combine(*SavedDir, TEXT("ImGui"));
// Make sure that directory is created.
IPlatformFile::GetPlatformPhysical().CreateDirectory(*Directory);
@ -87,7 +95,7 @@ FImGuiContextProxy::FImGuiContextProxy(FImGuiContextProxy&& Other)
FImGuiContextProxy& FImGuiContextProxy::operator=(FImGuiContextProxy&& Other)
{
// Swapping context so it can be destroyed with the other object.
using std::swap;
using std::swap;
swap(Context, Other.Context);
// Just moving remaining data that doesn't affect cleanup.