mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Updated to Unreal Engine 4.18 (backward compatible).
This commit is contained in:
parent
9db4abcb0a
commit
2b19b2108a
@ -146,12 +146,12 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetWorldContextData(co
|
|||||||
const int32 Index = GetWorldContextIndex(*WorldContext);
|
const int32 Index = GetWorldContextIndex(*WorldContext);
|
||||||
|
|
||||||
checkf(Index != Utilities::INVALID_CONTEXT_INDEX, TEXT("Couldn't find context index for world %s: WorldType = %d"),
|
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
|
#if WITH_EDITOR
|
||||||
checkf(!GEngine->IsEditor() || Index != Utilities::EDITOR_CONTEXT_INDEX,
|
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"),
|
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
|
#endif
|
||||||
|
|
||||||
FContextData* Data = Contexts.Find(Index);
|
FContextData* Data = Contexts.Find(Index);
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "ImGuiImplementation.h"
|
#include "ImGuiImplementation.h"
|
||||||
#include "ImGuiInteroperability.h"
|
#include "ImGuiInteroperability.h"
|
||||||
|
|
||||||
|
#include <Runtime/Launch/Resources/Version.h>
|
||||||
|
|
||||||
|
|
||||||
static constexpr float DEFAULT_CANVAS_WIDTH = 3840.f;
|
static constexpr float DEFAULT_CANVAS_WIDTH = 3840.f;
|
||||||
static constexpr float DEFAULT_CANVAS_HEIGHT = 2160.f;
|
static constexpr float DEFAULT_CANVAS_HEIGHT = 2160.f;
|
||||||
@ -16,7 +18,13 @@ namespace
|
|||||||
{
|
{
|
||||||
FString GetSaveDirectory()
|
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.
|
// Make sure that directory is created.
|
||||||
IPlatformFile::GetPlatformPhysical().CreateDirectory(*Directory);
|
IPlatformFile::GetPlatformPhysical().CreateDirectory(*Directory);
|
||||||
@ -87,7 +95,7 @@ FImGuiContextProxy::FImGuiContextProxy(FImGuiContextProxy&& Other)
|
|||||||
FImGuiContextProxy& FImGuiContextProxy::operator=(FImGuiContextProxy&& Other)
|
FImGuiContextProxy& FImGuiContextProxy::operator=(FImGuiContextProxy&& Other)
|
||||||
{
|
{
|
||||||
// Swapping context so it can be destroyed with the other object.
|
// Swapping context so it can be destroyed with the other object.
|
||||||
using std::swap;
|
using std::swap;
|
||||||
swap(Context, Other.Context);
|
swap(Context, Other.Context);
|
||||||
|
|
||||||
// Just moving remaining data that doesn't affect cleanup.
|
// Just moving remaining data that doesn't affect cleanup.
|
||||||
|
Loading…
Reference in New Issue
Block a user