本文整理汇总了C++中UObject::GetAssetRegistryTags方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::GetAssetRegistryTags方法的具体用法?C++ UObject::GetAssetRegistryTags怎么用?C++ UObject::GetAssetRegistryTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UObject
的用法示例。
在下文中一共展示了UObject::GetAssetRegistryTags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SortList
void FAssetViewSortManager::SortList(TArray<TSharedPtr<FAssetViewItem>>& AssetItems, const FName& MajorityAssetType) const
{
//double SortListStartTime = FPlatformTime::Seconds();
TArray<TUniquePtr<FCompareFAssetItemBase>> SortMethod;
for (int32 PriorityIdx = 0; PriorityIdx < EColumnSortPriority::Max; PriorityIdx++)
{
const bool bAscending(SortMode[PriorityIdx] == EColumnSortMode::Ascending);
const FName& Tag(SortColumnId[PriorityIdx]);
if (Tag == NAME_None)
{
break;
}
if (Tag == NameColumnId)
{
SortMethod.Add(MakeUnique<FCompareFAssetItemByName>(bAscending, Tag));
}
else if (Tag == ClassColumnId)
{
SortMethod.Add(MakeUnique<FCompareFAssetItemByClass>(bAscending, Tag));
}
else if (Tag == PathColumnId)
{
SortMethod.Add(MakeUnique<FCompareFAssetItemByPath>(bAscending, Tag));
}
else
{
// Since this SortData.Tag is not one of preset columns, sort by asset registry tag
UObject::FAssetRegistryTag::ETagType TagType = UObject::FAssetRegistryTag::TT_Alphabetical;
if (MajorityAssetType != NAME_None)
{
UClass* Class = FindObject<UClass>(ANY_PACKAGE, *MajorityAssetType.ToString());
if (Class)
{
UObject* CDO = Class->GetDefaultObject();
if (CDO)
{
TArray<UObject::FAssetRegistryTag> TagList;
CDO->GetAssetRegistryTags(TagList);
for (auto TagIt = TagList.CreateConstIterator(); TagIt; ++TagIt)
{
if (TagIt->Name == Tag)
{
TagType = TagIt->Type;
break;
}
}
}
}
}
if (TagType == UObject::FAssetRegistryTag::TT_Numerical)
{
// The property is a Num2er, compare using atof
SortMethod.Add(MakeUnique<FCompareFAssetItemByTagNumerical>(bAscending, Tag));
}
else if (TagType == UObject::FAssetRegistryTag::TT_Dimensional)
{
// The property is a series of Num2ers representing dimensions, compare by using atof for each Num2er, delimited by an "x"
SortMethod.Add(MakeUnique<FCompareFAssetItemByTagDimensional>(bAscending, Tag));
}
else
{
// Unknown or alphabetical, sort alphabetically either way
SortMethod.Add(MakeUnique<FCompareFAssetItemByTag>(bAscending, Tag));
}
}
}
// Sort the list...
if (SortMethod.Num() > 0)
{
TUniquePtr<FCompareFAssetItemBase> PrimarySortMethod = MoveTemp(SortMethod[EColumnSortPriority::Primary]);
check(PrimarySortMethod);
SortMethod.RemoveAt(0);
// Move all the comparisons to the primary sort method
PrimarySortMethod->SetNextComparisons(SortMethod);
AssetItems.Sort(*(PrimarySortMethod.Get()));
// Move the comparisons back for ease of cleanup
SortMethod = MoveTemp(PrimarySortMethod->GetNextComparisons());
SortMethod.Insert(MoveTemp(PrimarySortMethod), 0);
}
// Cleanup the methods we no longer need.
for (int32 PriorityIdx = 0; PriorityIdx < SortMethod.Num(); PriorityIdx++)
{
SortMethod[PriorityIdx].Reset();
}
SortMethod.Empty();
//UE_LOG(LogContentBrowser, Warning/*VeryVerbose*/, TEXT("FAssetViewSortManager Sort Time: %0.4f seconds."), FPlatformTime::Seconds() - SortListStartTime);
}