mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 16:30:32 +00:00
d4ffe9443f
- Removed explicit PCH. - Fixed includes to compile for all supported engine versions, including non-unity builds. - Configured build.cs to treat ImGui as an engine module and added stricter compilation rules.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
|
|
|
|
#pragma once
|
|
|
|
#include <Engine/Engine.h>
|
|
#include <Engine/GameInstance.h>
|
|
#include <Engine/GameViewportClient.h>
|
|
#include <UObject/WeakObjectPtr.h>
|
|
|
|
|
|
// Utilities helping to get a World Context.
|
|
|
|
namespace Utilities
|
|
{
|
|
template<typename T>
|
|
FORCEINLINE const FWorldContext* GetWorldContext(const T* Obj);
|
|
|
|
FORCEINLINE const FWorldContext* GetWorldContext(const UGameInstance& GameInstance)
|
|
{
|
|
return GameInstance.GetWorldContext();
|
|
}
|
|
|
|
template<typename T>
|
|
FORCEINLINE const FWorldContext* GetWorldContext(const TWeakObjectPtr<T>& Obj)
|
|
{
|
|
return Obj.IsValid() ? GetWorldContext(*Obj.Get()) : nullptr;
|
|
}
|
|
|
|
FORCEINLINE const FWorldContext* GetWorldContext(const UGameViewportClient& GameViewportClient)
|
|
{
|
|
return GetWorldContext(GameViewportClient.GetGameInstance());
|
|
}
|
|
|
|
FORCEINLINE const FWorldContext* GetWorldContext(const UWorld& World)
|
|
{
|
|
return GetWorldContext(World.GetGameInstance());
|
|
}
|
|
|
|
template<typename T>
|
|
FORCEINLINE const FWorldContext* GetWorldContext(const T* Obj)
|
|
{
|
|
return Obj ? GetWorldContext(*Obj) : nullptr;
|
|
}
|
|
|
|
const FWorldContext* GetWorldContextFromNetMode(ENetMode NetMode);
|
|
}
|