mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Fixed Linux and standalone compile errors.
This commit is contained in:
parent
a76f4bc451
commit
16056820e9
@ -3,11 +3,32 @@
|
|||||||
#include "ImGuiDelegatesContainer.h"
|
#include "ImGuiDelegatesContainer.h"
|
||||||
|
|
||||||
#include "ImGuiModule.h"
|
#include "ImGuiModule.h"
|
||||||
#include "Utilities/RedirectingHandle.h"
|
|
||||||
#include "Utilities/WorldContextIndex.h"
|
#include "Utilities/WorldContextIndex.h"
|
||||||
|
|
||||||
|
|
||||||
// Redirecting handle which will automatically bind to another one, if a different instance of the module is loaded.
|
#if !WITH_EDITOR
|
||||||
|
//
|
||||||
|
// Non-editor version without container redirection
|
||||||
|
//
|
||||||
|
|
||||||
|
static FImGuiDelegatesContainer DelegatesContainer;
|
||||||
|
|
||||||
|
FImGuiDelegatesContainer& FImGuiDelegatesContainer::Get()
|
||||||
|
{
|
||||||
|
return DelegatesContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !WITH_EDITOR
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
//
|
||||||
|
// Editor version supporting container redirection needed for hot-reloading
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "Utilities/RedirectingHandle.h"
|
||||||
|
|
||||||
|
// Redirecting handle which will always bind to a container from the currently loaded module.
|
||||||
struct FImGuiDelegatesContainerHandle : Utilities::TRedirectingHandle<FImGuiDelegatesContainer>
|
struct FImGuiDelegatesContainerHandle : Utilities::TRedirectingHandle<FImGuiDelegatesContainer>
|
||||||
{
|
{
|
||||||
FImGuiDelegatesContainerHandle(FImGuiDelegatesContainer& InDefaultContainer)
|
FImGuiDelegatesContainerHandle(FImGuiDelegatesContainer& InDefaultContainer)
|
||||||
@ -47,6 +68,9 @@ void FImGuiDelegatesContainer::MoveContainer(FImGuiDelegatesContainerHandle& Oth
|
|||||||
GetHandle().SetParent(&OtherContainerHandle);
|
GetHandle().SetParent(&OtherContainerHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // WITH_EDITOR
|
||||||
|
|
||||||
|
|
||||||
int32 FImGuiDelegatesContainer::GetContextIndex(UWorld* World)
|
int32 FImGuiDelegatesContainer::GetContextIndex(UWorld* World)
|
||||||
{
|
{
|
||||||
return Utilities::GetWorldContextIndex(*World);
|
return Utilities::GetWorldContextIndex(*World);
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
#include <Delegates/Delegate.h>
|
#include <Delegates/Delegate.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
struct FImGuiDelegatesContainerHandle;
|
struct FImGuiDelegatesContainerHandle;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct FImGuiDelegatesContainer
|
struct FImGuiDelegatesContainer
|
||||||
{
|
{
|
||||||
@ -15,11 +17,13 @@ public:
|
|||||||
// Get the current instance (can change during hot-reloading).
|
// Get the current instance (can change during hot-reloading).
|
||||||
static FImGuiDelegatesContainer& Get();
|
static FImGuiDelegatesContainer& Get();
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
// Get the handle to the container instance (can attach to other handles in hot-reloaded modules).
|
// Get the handle to the container instance (can attach to other handles in hot-reloaded modules).
|
||||||
static FImGuiDelegatesContainerHandle& GetHandle();
|
static FImGuiDelegatesContainerHandle& GetHandle();
|
||||||
|
|
||||||
// Redirect to the other container and if this one is still active move its data to the other one.
|
// Redirect to the other container and if this one is still active move its data to the other one.
|
||||||
static void MoveContainer(FImGuiDelegatesContainerHandle& OtherContainerHandle);
|
static void MoveContainer(FImGuiDelegatesContainerHandle& OtherContainerHandle);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Get delegate to ImGui world early debug event from known world instance.
|
// Get delegate to ImGui world early debug event from known world instance.
|
||||||
FSimpleMulticastDelegate& OnWorldEarlyDebug(UWorld* World) { return OnWorldEarlyDebug(GetContextIndex(World)); }
|
FSimpleMulticastDelegate& OnWorldEarlyDebug(UWorld* World) { return OnWorldEarlyDebug(GetContextIndex(World)); }
|
||||||
|
@ -26,8 +26,8 @@ public:
|
|||||||
FTextureManager& operator=(const FTextureManager&) = delete;
|
FTextureManager& operator=(const FTextureManager&) = delete;
|
||||||
|
|
||||||
// Moving transfers ownership and leaves source empty.
|
// Moving transfers ownership and leaves source empty.
|
||||||
FTextureManager(FTextureManager&&) = default;
|
FTextureManager(FTextureManager&&) = delete;
|
||||||
FTextureManager& operator=(FTextureManager&&) = default;
|
FTextureManager& operator=(FTextureManager&&) = delete;
|
||||||
|
|
||||||
// Initialize error texture that will be used for rendering textures without registered resources. Can be called
|
// Initialize error texture that will be used for rendering textures without registered resources. Can be called
|
||||||
// multiple time, if color needs to be changed.
|
// multiple time, if color needs to be changed.
|
||||||
|
@ -167,10 +167,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
|
virtual void SetProperties(const FImGuiModuleProperties& Properties);
|
||||||
|
virtual struct FImGuiContextHandle& GetImGuiContextHandle();
|
||||||
|
virtual struct FImGuiDelegatesContainerHandle& GetDelegatesContainerHandle();
|
||||||
friend struct FImGuiContextHandle;
|
friend struct FImGuiContextHandle;
|
||||||
friend struct FImGuiDelegatesContainerHandle;
|
friend struct FImGuiDelegatesContainerHandle;
|
||||||
virtual void SetProperties(const FImGuiModuleProperties& Properties);
|
|
||||||
virtual FImGuiContextHandle& GetImGuiContextHandle();
|
|
||||||
virtual FImGuiDelegatesContainerHandle& GetDelegatesContainerHandle();
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user