mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 16:30:32 +00:00
867a34e640
- Added new FImGuiDelegates interface for ImGui debug delegates. - Added FImGuiDelegatesContainer for ImGui delegates. - Added code preserving delegates during hot-reloading and moving them to a new module. - Depreciated old FImGuiModule delegates interface and FImGuiDelegateHandle. - Delegates registered with depreciated interface are redirected and get benefit of being preserved during hot-reloading. This can be controlled with IMGUI_REDIRECT_OBSOLETE_DELEGATES. - Added IMGUI_WITH_OBSOLETE_DELEGATES allowing to strip depreciated interface from builds. - Modified context manager and context proxy to work with FImGuiDelegatesContainer.
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
|
|
|
|
#include "ImGuiPrivatePCH.h"
|
|
|
|
#include "ImGuiDelegatesContainer.h"
|
|
|
|
#include "Utilities/WorldContextIndex.h"
|
|
|
|
|
|
FImGuiDelegatesContainer FImGuiDelegatesContainer::DefaultInstance;
|
|
|
|
FImGuiDelegatesContainer* FImGuiDelegatesContainer::InstancePtr = &FImGuiDelegatesContainer::DefaultInstance;
|
|
|
|
void FImGuiDelegatesContainer::MoveContainer(FImGuiDelegatesContainer& Dst)
|
|
{
|
|
// Only move data if pointer points to default instance, otherwise our data has already been moved and we only
|
|
// keep pointer to a more recent version.
|
|
if (InstancePtr == &DefaultInstance)
|
|
{
|
|
Dst = MoveTemp(DefaultInstance);
|
|
DefaultInstance.Clear();
|
|
}
|
|
|
|
// Update pointer to the most recent version.
|
|
InstancePtr = &Dst;
|
|
}
|
|
|
|
FSimpleMulticastDelegate& FImGuiDelegatesContainer::OnWorldDebug(UWorld* World)
|
|
{
|
|
return OnWorldDebug(Utilities::GetWorldContextIndex(*World));
|
|
}
|
|
|
|
void FImGuiDelegatesContainer::Clear()
|
|
{
|
|
WorldDelegates.Empty();
|
|
MultiContextDelegate.Clear();
|
|
}
|