Files
UnrealEngineUWP/Engine/Source/Runtime/InteractiveToolsFramework/Private/ContextObjectStore.cpp
michael balzer 2b10993563 Move InteractiveToolsFramework and GeometryFramework out of Experimental
#jira UETOOL-3823
#rb brooke.hubert
#preflight 6109d1e9b4288d0001acb7ef

[CL 17055606 by michael balzer in ue5-main branch]
2021-08-04 13:58:55 -04:00

45 lines
894 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ContextObjectStore.h"
UObject* UContextObjectStore::FindContextByClass(UClass* InClass) const
{
for (UObject* ContextObject : ContextObjects)
{
if (ContextObject && ContextObject->IsA(InClass))
{
return ContextObject;
}
}
return nullptr;
}
bool UContextObjectStore::AddContextObject(UObject* InContextObject)
{
if (InContextObject)
{
return ContextObjects.AddUnique(InContextObject) != INDEX_NONE;
}
return false;
}
bool UContextObjectStore::RemoveContextObject(UObject* InContextObject)
{
return ContextObjects.RemoveSingle(InContextObject) != 0;
}
bool UContextObjectStore::RemoveContextObjectsOfType(const UClass* InClass)
{
return (ContextObjects.RemoveAll([InClass](UObject* InObject)
{
return InObject->IsA(InClass);
}) > 0);
}
void UContextObjectStore::Shutdown()
{
ContextObjects.Empty();
}