2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
struct FSourcesData
|
|
|
|
|
{
|
|
|
|
|
TArray<FName> PackagePaths;
|
|
|
|
|
TArray<FCollectionNameType> Collections;
|
|
|
|
|
|
|
|
|
|
bool IsEmpty() const
|
|
|
|
|
{
|
|
|
|
|
return PackagePaths.Num() == 0 && Collections.Num() == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FARFilter MakeFilter(bool bRecurse, bool bUsingFolders) const
|
|
|
|
|
{
|
|
|
|
|
FARFilter Filter;
|
|
|
|
|
|
|
|
|
|
// Package Paths
|
|
|
|
|
Filter.PackagePaths = PackagePaths;
|
|
|
|
|
Filter.bRecursivePaths = bRecurse || !bUsingFolders;
|
|
|
|
|
|
|
|
|
|
// Collections
|
|
|
|
|
TArray<FName> ObjectPathsFromCollections;
|
2015-06-01 10:04:42 -04:00
|
|
|
if ( Collections.Num() && FCollectionManagerModule::IsModuleAvailable() )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// Collection manager module should already be loaded since it may cause a hitch on the first search
|
2015-06-01 10:04:42 -04:00
|
|
|
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-06-19 07:33:02 -04:00
|
|
|
// Include objects from child collections if we're recursing
|
|
|
|
|
const ECollectionRecursionFlags::Flags CollectionRecursionMode = (Filter.bRecursivePaths) ? ECollectionRecursionFlags::SelfAndChildren : ECollectionRecursionFlags::Self;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
for ( int32 CollectionIdx = 0; CollectionIdx < Collections.Num(); ++CollectionIdx )
|
|
|
|
|
{
|
|
|
|
|
// Find the collection
|
|
|
|
|
const FCollectionNameType& CollectionNameType = Collections[CollectionIdx];
|
2015-06-19 07:33:02 -04:00
|
|
|
CollectionManagerModule.Get().GetObjectsInCollection(CollectionNameType.Name, CollectionNameType.Type, ObjectPathsFromCollections, CollectionRecursionMode);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Filter.ObjectPaths = ObjectPathsFromCollections;
|
|
|
|
|
|
|
|
|
|
return Filter;
|
|
|
|
|
}
|
|
|
|
|
};
|