// SelectAll(): // Selects all items and their children void LWItemHierarchy::SelectAll() { if( type != LWI_SCENE ) SetIsSelected( true ); for( unsigned long i=0; i < children.NumElements(); i++ ) { children[i]->SetIsSelected( true ); children[i]->SelectChildren( true ); } }
// SelectSelectedsChildren(): // Selects the children of the currently selected items. // If recursive is true, the children's children will // also be selected. Internal only; does NOT affect Layout void LWItemHierarchy::SelectSelectedsChildren( bool recursive ) { if( parent != NULL ) { if( parent->GetType() != LWI_SCENE ) { if( parent->GetIsSelected() ) SetIsSelected( true ); } } if( recursive ) { for( unsigned long i=0; i < children.NumElements(); i++ ) children[i]->SelectSelectedsChildren( recursive ); } }
// SelectSelectedsBones(): // Selects the bones of the currently selected items. // If recursive is true, the bones's children will // also be selected. Internal only; does NOT affect Layout void LWItemHierarchy::SelectSelectedsBones( bool recursive ) { if( type == LWI_BONE ) { if( parent != NULL ) { if( (parent->GetType() != LWI_BONE) || recursive ) { // Only select child bones if recursive is on if( parent->GetIsSelected() ) SetIsSelected( true ); } } } if( recursive ) { for( unsigned long i=0; i < children.NumElements(); i++ ) children[i]->SelectSelectedsBones( recursive ); } }
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(); }