96 lines
2.6 KiB
C++
96 lines
2.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AssetRegistry/AssetRegistryHelpers.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "AssetRegistry/IAssetRegistry.h"
|
|
#include "AssetRegistry.h"
|
|
|
|
TScriptInterface<IAssetRegistry> UAssetRegistryHelpers::GetAssetRegistry()
|
|
{
|
|
return &UAssetRegistryImpl::Get();
|
|
}
|
|
|
|
FAssetData UAssetRegistryHelpers::CreateAssetData(const UObject* InAsset, bool bAllowBlueprintClass /*= false*/)
|
|
{
|
|
if (InAsset && InAsset->IsAsset())
|
|
{
|
|
return FAssetData(InAsset, bAllowBlueprintClass);
|
|
}
|
|
else
|
|
{
|
|
return FAssetData();
|
|
}
|
|
}
|
|
|
|
bool UAssetRegistryHelpers::IsValid(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.IsValid();
|
|
}
|
|
|
|
bool UAssetRegistryHelpers::IsUAsset(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.IsUAsset();
|
|
}
|
|
|
|
FString UAssetRegistryHelpers::GetFullName(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.GetFullName();
|
|
}
|
|
|
|
bool UAssetRegistryHelpers::IsRedirector(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.IsRedirector();
|
|
}
|
|
|
|
FSoftObjectPath UAssetRegistryHelpers::ToSoftObjectPath(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.ToSoftObjectPath();
|
|
}
|
|
|
|
UClass* UAssetRegistryHelpers::GetClass(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.GetClass();
|
|
}
|
|
|
|
UObject* UAssetRegistryHelpers::GetAsset(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.GetAsset();
|
|
}
|
|
|
|
bool UAssetRegistryHelpers::IsAssetLoaded(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.IsAssetLoaded();
|
|
}
|
|
|
|
FString UAssetRegistryHelpers::GetExportTextName(const FAssetData& InAssetData)
|
|
{
|
|
return InAssetData.GetExportTextName();
|
|
}
|
|
|
|
bool UAssetRegistryHelpers::GetTagValue(const FAssetData& InAssetData, const FName& InTagName, FString& OutTagValue)
|
|
{
|
|
return InAssetData.GetTagValue(InTagName, OutTagValue);
|
|
}
|
|
|
|
FARFilter UAssetRegistryHelpers::SetFilterTagsAndValues(const FARFilter& InFilter, const TArray<FTagAndValue>& InTagsAndValues)
|
|
{
|
|
FARFilter FilterCopy = InFilter;
|
|
for (const FTagAndValue& TagAndValue: InTagsAndValues)
|
|
{
|
|
FilterCopy.TagsAndValues.Add(TagAndValue.Tag, TagAndValue.Value);
|
|
}
|
|
|
|
return FilterCopy;
|
|
}
|
|
|
|
UAssetRegistryHelpers::FTemporaryCachingModeScope::FTemporaryCachingModeScope(bool InTempCachingMode)
|
|
{
|
|
PreviousCachingMode = UAssetRegistryHelpers::GetAssetRegistry()->GetTemporaryCachingMode();
|
|
UAssetRegistryHelpers::GetAssetRegistry()->SetTemporaryCachingMode(InTempCachingMode);
|
|
}
|
|
|
|
UAssetRegistryHelpers::FTemporaryCachingModeScope::~FTemporaryCachingModeScope()
|
|
{
|
|
UAssetRegistryHelpers::GetAssetRegistry()->SetTemporaryCachingMode(PreviousCachingMode);
|
|
}
|