本文整理汇总了C++中TSharedPtr::CanFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::CanFilter方法的具体用法?C++ TSharedPtr::CanFilter怎么用?C++ TSharedPtr::CanFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::CanFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Populate
void SLargeAssetTypeTreeWidget::Populate(const TArray<FString>& InSelectedAssetTypeClassNames)
{
AssetCategories.Empty();
TMap<EAssetTypeCategories::Type, FLargeAssetTypeTreeItemPtr> CategoryMap;
AddCategoriesToCategoryMap(CategoryMap);
FAssetToolsModule& AssetToolsModule =
FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools"));
TArray<FAssetTypeWeakPtr> AssetTypes;
AssetToolsModule.Get().GetAssetTypeActionsList(AssetTypes);
struct FOrderAssetTypesByNameAsc
{
// return true if A should appear before B, false otherwise
bool operator()(const FAssetTypeWeakPtr& A, const FAssetTypeWeakPtr& B) const
{
return A.Pin()->GetName().CompareTo(B.Pin()->GetName()) < 0;
}
};
AssetTypes.Sort(FOrderAssetTypesByNameAsc());
// assign all the asset types to the corresponding category tree items
for (const auto AssetTypeWeakPtr : AssetTypes)
{
TSharedPtr<IAssetType> AssetType = AssetTypeWeakPtr.Pin();
// for consistency ignore asset types that can't be filtered by in the content browser,
// usually this is because the asset type is not fully supported
if (AssetType.IsValid() && AssetType->CanFilter())
{
TArray<FLargeAssetTypeTreeItemWeakPtr> AssetTypeItems;
for (auto CategoryMapEntry : CategoryMap)
{
if (AssetType->GetCategories() & CategoryMapEntry.Key)
{
FLargeAssetTypeTreeItemPtr AssetTypeItem =
MakeShareable(
new FLargeAssetTypeTreeItem(*AssetType.Get(), CategoryMapEntry.Value)
);
AssetTypeItems.Add(AssetTypeItem);
CategoryMapEntry.Value->Children.Add(AssetTypeItem);
}
}
if (AssetTypeItems.Num() == 1)
{
auto AssetTypeItem = AssetTypeItems[0].Pin();
AssetTypeItem->SetIsSelected(
InSelectedAssetTypeClassNames.Contains(AssetTypeItem->AssetTypeClassName)
);
}
else if (AssetTypeItems.Num() > 1)
{
auto AssetTypeItem = AssetTypeItems[0].Pin();
FLargeAssetTypeTreeItem::CreateSharedState(
AssetTypeItems,
InSelectedAssetTypeClassNames.Contains(AssetTypeItem->AssetTypeClassName)
);
}
}
}
for (const auto CategoryMapEntry : CategoryMap)
{
AssetCategories.Add(CategoryMapEntry.Value);
}
TreeView->RequestTreeRefresh();
}