Files
UnrealEngineUWP/Engine/Source/Runtime/UniversalObjectLocator/Private/UniversalObjectLocatorResolveParams.cpp
andrew rodham 71231a95e7 Added the ability to provide arbitrary parameters to UOL resolution functions
Parameters must be registered with the UOL module in much the same way as fragment types.
Tidied up globals into a singleton Registry class.
Added a function to FUniversalObjectLocator that allows manual addition of fragments.

Also removed the defunct IActorLocatorFragmentResolver interface in favor of supplying these parameters externally.
Corrected Anim Instance locators being always used when trying to address skeletal mesh components.

#rb david.bromberg

[CL 29890178 by andrew rodham in ue5-main branch]
2023-11-22 12:02:21 -05:00

55 lines
1.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "UniversalObjectLocatorResolveParams.h"
#include "UniversalObjectLocatorFragmentType.h"
#include "UniversalObjectLocatorFragmentTypeHandle.h"
namespace UE::UniversalObjectLocator
{
FResolveParameterBuffer::FResolveParameterBuffer()
: Memory(nullptr)
, AllParameters(0u)
, Capacity(0u)
, Num(0u)
{
}
FResolveParameterBuffer::~FResolveParameterBuffer()
{
Destroy();
}
void FResolveParameterBuffer::Destroy()
{
check((Memory == nullptr) == (Num == 0));
if (Memory)
{
uint8 Index = 0;
uint32 RemainingParameters = AllParameters;
while (RemainingParameters != 0)
{
// Get the bit offset of the next reminaing bit
const uint8 BitIndex = static_cast<uint8>(FMath::CountTrailingZeros(RemainingParameters));
UScriptStruct* Type = FParameterTypeHandle(BitIndex).Resolve();
void* Ptr = GetHeader(Index).Resolve(Memory);
++Index;
if (ensure(Type))
{
Type->DestroyStruct(Ptr);
}
RemainingParameters = RemainingParameters & ~(1u << BitIndex);
}
if (bCanFreeMemory)
{
FMemory::Free(Memory);
}
}
}
} // namespace UE::UniversalObjectLocator