2017-03-18 11:33:14 +00:00
|
|
|
// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
|
|
|
|
|
2020-06-25 09:52:46 +00:00
|
|
|
#include "ImGuiImplementation.h"
|
2017-03-18 11:33:14 +00:00
|
|
|
|
2020-06-25 09:52:46 +00:00
|
|
|
#include <CoreMinimal.h>
|
|
|
|
|
|
|
|
// For convenience and easy access to the ImGui source code, we build it as part of this module.
|
2017-03-18 11:33:14 +00:00
|
|
|
// We don't need to define IMGUI_API manually because it is already done for this module.
|
2023-02-16 17:05:16 +00:00
|
|
|
// UE 5.1 stopped defining PLATFORM_XBOXONE, so be safe if not defined
|
|
|
|
#if !defined(PLATFORM_XBOXONE)
|
|
|
|
#define PLATFORM_XBOXONE 0
|
|
|
|
#endif
|
2018-02-02 23:14:17 +00:00
|
|
|
#if PLATFORM_XBOXONE
|
|
|
|
// Disable Win32 functions used in ImGui and not supported on XBox.
|
|
|
|
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
|
|
|
|
#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
|
|
|
|
#endif // PLATFORM_XBOXONE
|
|
|
|
|
2020-06-14 20:50:26 +00:00
|
|
|
#if PLATFORM_WINDOWS
|
|
|
|
#include <Windows/AllowWindowsPlatformTypes.h>
|
|
|
|
#endif // PLATFORM_WINDOWS
|
|
|
|
|
2018-08-10 22:53:03 +00:00
|
|
|
#if WITH_EDITOR
|
2020-07-31 09:24:53 +00:00
|
|
|
|
|
|
|
#include "ImGuiModule.h"
|
|
|
|
#include "Utilities/RedirectingHandle.h"
|
|
|
|
|
|
|
|
// Redirecting handle which will automatically bind to another one, if a different instance of the module is loaded.
|
|
|
|
struct FImGuiContextHandle : public Utilities::TRedirectingHandle<ImGuiContext*>
|
|
|
|
{
|
|
|
|
FImGuiContextHandle(ImGuiContext*& InDefaultContext)
|
|
|
|
: Utilities::TRedirectingHandle<ImGuiContext*>(InDefaultContext)
|
|
|
|
{
|
|
|
|
if (FImGuiModule* Module = FModuleManager::GetModulePtr<FImGuiModule>("ImGui"))
|
|
|
|
{
|
2021-04-15 03:11:49 +00:00
|
|
|
SetParent(Module->ImGuiContextHandle);
|
2020-07-31 09:24:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static ImGuiContext* ImGuiContextPtr = nullptr;
|
|
|
|
static FImGuiContextHandle ImGuiContextPtrHandle(ImGuiContextPtr);
|
|
|
|
|
2018-08-10 22:53:03 +00:00
|
|
|
// Get the global ImGui context pointer (GImGui) indirectly to allow redirections in obsolete modules.
|
2020-07-31 09:24:53 +00:00
|
|
|
#define GImGui (ImGuiContextPtrHandle.Get())
|
2018-08-10 22:53:03 +00:00
|
|
|
#endif // WITH_EDITOR
|
|
|
|
|
2017-03-18 11:33:14 +00:00
|
|
|
#include "imgui.cpp"
|
|
|
|
#include "imgui_demo.cpp"
|
|
|
|
#include "imgui_draw.cpp"
|
2018-09-12 18:21:36 +00:00
|
|
|
#include "imgui_widgets.cpp"
|
2017-03-18 11:33:14 +00:00
|
|
|
|
2022-02-19 18:31:15 +00:00
|
|
|
#include "imgui_tables.cpp"
|
|
|
|
|
2017-03-18 11:33:14 +00:00
|
|
|
#if PLATFORM_WINDOWS
|
2019-07-27 17:06:29 +00:00
|
|
|
#include <Windows/HideWindowsPlatformTypes.h>
|
2017-03-18 11:33:14 +00:00
|
|
|
#endif // PLATFORM_WINDOWS
|
2017-08-28 19:29:07 +00:00
|
|
|
|
2018-04-21 20:40:05 +00:00
|
|
|
#include "ImGuiInteroperability.h"
|
|
|
|
|
2019-03-13 20:40:13 +00:00
|
|
|
|
2017-09-27 20:16:54 +00:00
|
|
|
namespace ImGuiImplementation
|
2017-08-28 19:29:07 +00:00
|
|
|
{
|
2018-08-10 22:53:03 +00:00
|
|
|
#if WITH_EDITOR
|
2020-07-31 09:24:53 +00:00
|
|
|
FImGuiContextHandle& GetContextHandle()
|
2018-08-10 22:53:03 +00:00
|
|
|
{
|
2020-07-31 09:24:53 +00:00
|
|
|
return ImGuiContextPtrHandle;
|
2018-08-10 22:53:03 +00:00
|
|
|
}
|
|
|
|
|
2020-07-31 09:24:53 +00:00
|
|
|
void SetParentContextHandle(FImGuiContextHandle& Parent)
|
2018-08-10 22:53:03 +00:00
|
|
|
{
|
2020-07-31 09:24:53 +00:00
|
|
|
ImGuiContextPtrHandle.SetParent(&Parent);
|
2018-08-10 22:53:03 +00:00
|
|
|
}
|
|
|
|
#endif // WITH_EDITOR
|
2019-07-27 17:06:29 +00:00
|
|
|
}
|