mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Changed context index mapping to fix issues with multi-PIE debugging in 4.25.
This commit is contained in:
parent
16056820e9
commit
db77175e66
@ -6,35 +6,26 @@
|
|||||||
|
|
||||||
|
|
||||||
// Utilities mapping worlds to indices that we use to identify ImGui contexts.
|
// Utilities mapping worlds to indices that we use to identify ImGui contexts.
|
||||||
// Editor and standalone games have context index 0 while PIE worlds have indices starting from 1 for server and 2+ for
|
|
||||||
// clients.
|
|
||||||
|
|
||||||
namespace Utilities
|
namespace Utilities
|
||||||
{
|
{
|
||||||
// Invalid context index for parameters that cannot be resolved to a valid world.
|
// Invalid context index for parameters that cannot be resolved to a valid world.
|
||||||
static constexpr int32 INVALID_CONTEXT_INDEX = -1;
|
static constexpr int32 INVALID_CONTEXT_INDEX = -10;
|
||||||
|
|
||||||
// Standalone context index.
|
// Standalone context index.
|
||||||
static constexpr int32 STANDALONE_GAME_CONTEXT_INDEX = 0;
|
static constexpr int32 STANDALONE_GAME_CONTEXT_INDEX = -2;
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
|
|
||||||
// Editor context index.
|
// Editor context index. We are lacking flexibility here, so we might need to change it somehow.
|
||||||
static constexpr int32 EDITOR_CONTEXT_INDEX = 0;
|
static constexpr int32 EDITOR_CONTEXT_INDEX = -1;
|
||||||
|
|
||||||
FORCEINLINE int32 GetWorldContextIndex(const FWorldContext& WorldContext)
|
FORCEINLINE int32 GetWorldContextIndex(const FWorldContext& WorldContext)
|
||||||
{
|
{
|
||||||
// In standalone game (WorldType = Game) we have only one context with index 0 (see GAME_CONTEXT_INDEX).
|
|
||||||
|
|
||||||
// In editor, we keep 0 for editor and use PIEInstance to index worlds. In simulation or standalone single-PIE
|
|
||||||
// sessions PIEInstance is 0, but since there is only one world we can change it without causing any conflicts.
|
|
||||||
// In single-PIE with dedicated server or multi-PIE sessions worlds have PIEInstance starting from 1 for server
|
|
||||||
// and 2+ for clients, what maps directly to our index.
|
|
||||||
|
|
||||||
switch (WorldContext.WorldType)
|
switch (WorldContext.WorldType)
|
||||||
{
|
{
|
||||||
case EWorldType::PIE:
|
case EWorldType::PIE:
|
||||||
return FMath::Max(WorldContext.PIEInstance, 1);
|
return WorldContext.PIEInstance;
|
||||||
case EWorldType::Game:
|
case EWorldType::Game:
|
||||||
return STANDALONE_GAME_CONTEXT_INDEX;
|
return STANDALONE_GAME_CONTEXT_INDEX;
|
||||||
case EWorldType::Editor:
|
case EWorldType::Editor:
|
||||||
|
Loading…
Reference in New Issue
Block a user