Skip to content

Commit

Permalink
Updated to Unreal Engine 4.18 (backward compatible).
Browse files Browse the repository at this point in the history
  • Loading branch information
segross committed Nov 5, 2017
1 parent 9db4abc commit 2b19b21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Source/ImGui/Private/ImGuiContextManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 10 additions & 2 deletions Source/ImGui/Private/ImGuiContextProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2b19b21

Please sign in to comment.