UnrealImGui/Source/ImGui/Private/ImGuiDelegatesContainer.cpp
Sebastian 4a9d66889b Added ImGui early debug events:
- Added to FImGuiDelegates interface early debug delegates called during world tick start.
- Delegates are called in fixed order: multi-context early debug, world early debug (called during world tick start), world debug, multi-context debug (called during world post actor tick or if not available, during world tick start).
- Removed from build script configuration of debug delegates.
2019-04-14 12:16:15 +01:00

40 lines
1.1 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;
}
int32 FImGuiDelegatesContainer::GetContextIndex(UWorld* World)
{
return Utilities::GetWorldContextIndex(*World);
}
void FImGuiDelegatesContainer::Clear()
{
WorldEarlyDebugDelegates.Empty();
WorldDebugDelegates.Empty();
MultiContextEarlyDebugDelegate.Clear();
MultiContextDebugDelegate.Clear();
}