UnrealImGui/Source/ImGui/Private/ImGuiDelegatesContainer.cpp
Sebastian d4ffe9443f Enforced IWYU-style PCH model:
- 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.
2020-06-25 10:52:46 +01:00

38 lines
1.0 KiB
C++

// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
#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;
}
int32 FImGuiDelegatesContainer::GetContextIndex(UWorld* World)
{
return Utilities::GetWorldContextIndex(*World);
}
void FImGuiDelegatesContainer::Clear()
{
WorldEarlyDebugDelegates.Empty();
WorldDebugDelegates.Empty();
MultiContextEarlyDebugDelegate.Clear();
MultiContextDebugDelegate.Clear();
}