本文整理汇总了C++中TSet::Array方法的典型用法代码示例。如果您正苦于以下问题:C++ TSet::Array方法的具体用法?C++ TSet::Array怎么用?C++ TSet::Array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSet
的用法示例。
在下文中一共展示了TSet::Array方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEnumForByteTrack
UEnum* GetEnumForByteTrack(TSharedPtr<ISequencer> Sequencer, const FGuid& OwnerObjectHandle, FName PropertyName, UMovieSceneByteTrack* ByteTrack)
{
UObject* RuntimeObject = Sequencer->GetFocusedMovieSceneSequence()->FindObject(OwnerObjectHandle);
TSet<UEnum*> PropertyEnums;
if (RuntimeObject != nullptr)
{
UProperty* Property = RuntimeObject->GetClass()->FindPropertyByName(PropertyName);
if (Property != nullptr)
{
UByteProperty* ByteProperty = Cast<UByteProperty>(Property);
if (ByteProperty != nullptr && ByteProperty->Enum != nullptr)
{
PropertyEnums.Add(ByteProperty->Enum);
}
}
}
UEnum* TrackEnum;
if (PropertyEnums.Num() == 1)
{
TrackEnum = PropertyEnums.Array()[0];
}
else
{
TrackEnum = nullptr;
}
return TrackEnum;
}
示例2: DiscoverFilesToSearch
void FAssetDataGatherer::DiscoverFilesToSearch()
{
if( PathsToSearch.Num() > 0 )
{
TArray<FString> DiscoveredFilesToSearch;
TSet<FString> LocalDiscoveredPathsSet;
TArray<FString> CopyOfPathsToSearch;
{
FScopeLock CritSectionLock(&WorkerThreadCriticalSection);
CopyOfPathsToSearch = PathsToSearch;
// Remove all of the existing paths from the list, since we'll process them all below. New paths may be
// added to the original list on a different thread as we go along, but those new paths won't be processed
// during this call of DisoverFilesToSearch(). But we'll get them on the next call!
PathsToSearch.Empty();
bIsDiscoveringFiles = true;
}
// Iterate over any paths that we have remaining to scan
for ( int32 PathIdx=0; PathIdx < CopyOfPathsToSearch.Num(); ++PathIdx )
{
const FString& Path = CopyOfPathsToSearch[PathIdx];
// Convert the package path to a filename with no extension (directory)
const FString FilePath = FPackageName::LongPackageNameToFilename(Path);
// Gather the package files in that directory and subdirectories
TArray<FString> Filenames;
FPackageName::FindPackagesInDirectory(Filenames, FilePath);
for (int32 FilenameIdx = 0; FilenameIdx < Filenames.Num(); FilenameIdx++)
{
FString Filename(Filenames[FilenameIdx]);
if ( IsValidPackageFileToRead(Filename) )
{
// Add the path to this asset into the list of discovered paths
const FString LongPackageName = FPackageName::FilenameToLongPackageName(Filename);
LocalDiscoveredPathsSet.Add( FPackageName::GetLongPackagePath(LongPackageName) );
DiscoveredFilesToSearch.Add(Filename);
}
}
}
// Turn the set into an array here before the critical section below
TArray<FString> LocalDiscoveredPathsArray = LocalDiscoveredPathsSet.Array();
{
// Place all the discovered files into the files to search list
FScopeLock CritSectionLock(&WorkerThreadCriticalSection);
FilesToSearch.Append(DiscoveredFilesToSearch);
DiscoveredPaths.Append(LocalDiscoveredPathsArray);
bIsDiscoveringFiles = false;
}
}
}
示例3: Main
int32 UGenerateDistillFileSetsCommandlet::Main( const FString& InParams )
{
// Parse command line.
TArray<FString> Tokens;
TArray<FString> Switches;
UCommandlet::ParseCommandLine(*InParams, Tokens, Switches);
TArray<FString> MapList;
for ( int32 MapIdx = 0; MapIdx < Tokens.Num(); ++MapIdx )
{
const FString& Map = Tokens[MapIdx];
if ( FPackageName::IsShortPackageName(Map) )
{
FString LongPackageName;
if ( FPackageName::SearchForPackageOnDisk(Map, &LongPackageName) )
{
MapList.Add(LongPackageName);
}
else
{
UE_LOG(LogGenerateDistillFileSetsCommandlet, Error, TEXT("Unable to find package for map %s."), *Map);
return 1;
}
}
else
{
MapList.Add(Map);
}
}
if ( MapList.Num() <= 0 )
{
// No map tokens were supplied on the command line, so assume all maps
TArray<FString> AllPackageFilenames;
FEditorFileUtils::FindAllPackageFiles(AllPackageFilenames);
for (int32 PackageIndex = 0; PackageIndex < AllPackageFilenames.Num(); PackageIndex++)
{
const FString& Filename = AllPackageFilenames[PackageIndex];
if (FPaths::GetExtension(Filename, true) == FPackageName::GetMapPackageExtension() )
{
FString LongPackageName;
if ( FPackageName::TryConvertFilenameToLongPackageName(Filename, LongPackageName) )
{
// Warn about maps in "NoShip" or "TestMaps" folders. Those should have been filtered out during the Distill process!
if( !Filename.Contains( "/NoShip/") && !Filename.Contains( "/TestMaps/"))
{
// @todo plugins add support for plugins?
if ( LongPackageName.StartsWith(TEXT("/Game")) )
{
UE_LOG(LogGenerateDistillFileSetsCommandlet, Display, TEXT( "Discovered map package %s..." ), *LongPackageName );
MapList.Add(LongPackageName);
}
}
else
{
UE_LOG(LogGenerateDistillFileSetsCommandlet, Display, TEXT("Skipping map package %s in TestMaps or NoShip folder"), *Filename);
}
}
else
{
UE_LOG(LogGenerateDistillFileSetsCommandlet, Warning, TEXT("Failed to determine package name for map file %s."), *Filename);
}
}
}
}
const FString TemplateFileSwitch = TEXT("Template=");
const FString OutputFileSwitch = TEXT("Output=");
const FString TemplateFolderSwitch = TEXT("TemplateFolder=");
const FString OutputFolderSwitch = TEXT("OutputFolder=");
FString TemplateFilename;
FString OutputFilename;
FString TemplateFolder;
FString OutputFolder;
for (int32 SwitchIdx = 0; SwitchIdx < Switches.Num(); ++SwitchIdx)
{
const FString& Switch = Switches[SwitchIdx];
if ( Switch.StartsWith(TemplateFileSwitch) )
{
Switch.Split(TEXT("="), NULL, &TemplateFilename);
TemplateFilename = TemplateFilename.TrimQuotes();
}
else if ( Switch.StartsWith(OutputFileSwitch) )
{
Switch.Split(TEXT("="), NULL, &OutputFilename);
OutputFilename = OutputFilename.TrimQuotes();
}
else if ( Switch.StartsWith(TemplateFolderSwitch) )
{
Switch.Split(TEXT("="), NULL, &TemplateFolder);
TemplateFolder = TemplateFolder.TrimQuotes();
FPaths::NormalizeFilename(TemplateFolder);
if ( !TemplateFolder.EndsWith(TEXT("/")) )
{
TemplateFolder += TEXT("/");
}
UE_LOG(LogGenerateDistillFileSetsCommandlet, Display, TEXT("Using template folder: "), *TemplateFolder);
}
//.........这里部分代码省略.........
示例4: DeleteSelectedItems
void FSpriteGeometryEditingHelper::DeleteSelectedItems()
{
// Determine which vertices or entire shapes should be deleted
TSet<FShapeVertexPair> CompositeIndicesSet;
TSet<int32> ShapesToDeleteSet;
if (IsEditingGeometry())
{
FSpriteGeometryCollection& Geometry = GetGeometryChecked();
for (TSharedPtr<FSelectedItem> SelectionIt : GetSelectionSet())
{
if (const FSpriteSelectedVertex* SelectedVertex = SelectionIt->CastTo<const FSpriteSelectedVertex>(FSelectionTypes::Vertex))
{
CompositeIndicesSet.Add(FShapeVertexPair(SelectedVertex->ShapeIndex, SelectedVertex->VertexIndex));
if (SelectedVertex->IsA(FSelectionTypes::Edge)) // add the "next" point for the edge
{
const int32 NextIndex = (SelectedVertex->VertexIndex + 1) % Geometry.Shapes[SelectedVertex->ShapeIndex].Vertices.Num();
CompositeIndicesSet.Add(FShapeVertexPair(SelectedVertex->ShapeIndex, NextIndex));
}
}
else if (const FSpriteSelectedShape* SelectedShape = SelectionIt->CastTo<const FSpriteSelectedShape>(FSelectionTypes::GeometryShape))
{
ShapesToDeleteSet.Add(SelectedShape->ShapeIndex);
}
}
}
// See if anything else can be deleted
bool bCanDeleteNonGeometry = false;
for (const TSharedPtr<FSelectedItem> SelectedItem : GetSelectionSet())
{
if (SelectedItem->CanBeDeleted())
{
bCanDeleteNonGeometry = true;
break;
}
}
// Now delete the stuff that was selected in the correct order so that indices aren't messed up
const bool bDeletingGeometry = (CompositeIndicesSet.Num() > 0) || (ShapesToDeleteSet.Num() > 0);
if (bDeletingGeometry || bCanDeleteNonGeometry)
{
EditorContext->BeginTransaction(LOCTEXT("DeleteSelectionTransaction", "Delete Selection"));
EditorContext->MarkTransactionAsDirty();
if (bDeletingGeometry)
{
FSpriteGeometryCollection& Geometry = GetGeometryChecked();
// Delete the selected vertices first, as they may cause entire shapes to need to be deleted (sort so we delete from the back first)
TArray<FShapeVertexPair> CompositeIndices = CompositeIndicesSet.Array();
CompositeIndices.Sort([](const FShapeVertexPair& A, const FShapeVertexPair& B) { return (A.VertexIndex > B.VertexIndex); });
for (const FShapeVertexPair& Composite : CompositeIndices)
{
const int32 ShapeIndex = Composite.ShapeIndex;
const int32 VertexIndex = Composite.VertexIndex;
if (DeleteVertexInPolygonInternal(Geometry, ShapeIndex, VertexIndex))
{
ShapesToDeleteSet.Add(ShapeIndex);
}
}
// Delete the selected shapes (plus any shapes that became empty due to selected vertices)
if (ShapesToDeleteSet.Num() > 0)
{
// Sort so we delete from the back first
TArray<int32> ShapesToDeleteIndicies = ShapesToDeleteSet.Array();
ShapesToDeleteIndicies.Sort([](const int32& A, const int32& B) { return (A > B); });
for (const int32 ShapeToDeleteIndex : ShapesToDeleteIndicies)
{
Geometry.Shapes.RemoveAt(ShapeToDeleteIndex);
}
}
Geometry.GeometryType = ESpritePolygonMode::FullyCustom;
}
// Delete everything else
if (bCanDeleteNonGeometry)
{
for (TSharedPtr<FSelectedItem> SelectedItem : GetSelectionSet())
{
if (SelectedItem->CanBeDeleted())
{
SelectedItem->DeleteThisItem();
}
}
}
EditorContext->EndTransaction();
}
ClearSelectionSet();
ResetAddPolygonMode();
}
示例5: Run
uint32 FAssetDataDiscovery::Run()
{
double DiscoverStartTime = FPlatformTime::Seconds();
int32 NumDiscoveredFiles = 0;
FString LocalFilenamePathToPrioritize;
TSet<FString> LocalDiscoveredPathsSet;
TArray<FString> LocalDiscoveredDirectories;
TArray<FDiscoveredPackageFile> LocalPriorityFilesToSearch;
TArray<FDiscoveredPackageFile> LocalNonPriorityFilesToSearch;
// This set contains the folders that we should hide by default unless they contain assets
TSet<FString> PathsToHideIfEmpty;
PathsToHideIfEmpty.Add(TEXT("/Game/Collections"));
auto FlushLocalResultsIfRequired = [&]()
{
if (LocalPriorityFilesToSearch.Num() > 0 || LocalNonPriorityFilesToSearch.Num() > 0 || LocalDiscoveredPathsSet.Num() > 0)
{
TArray<FString> LocalDiscoveredPathsArray = LocalDiscoveredPathsSet.Array();
{
FScopeLock CritSectionLock(&WorkerThreadCriticalSection);
// Place all the discovered files into the files to search list
DiscoveredPaths.Append(MoveTemp(LocalDiscoveredPathsArray));
PriorityDiscoveredFiles.Append(MoveTemp(LocalPriorityFilesToSearch));
NonPriorityDiscoveredFiles.Append(MoveTemp(LocalNonPriorityFilesToSearch));
}
}
LocalDiscoveredPathsSet.Reset();
LocalPriorityFilesToSearch.Reset();
LocalNonPriorityFilesToSearch.Reset();
};
auto IsPriorityFile = [&](const FString& InPackageFilename) -> bool
{
return !bIsSynchronous && !LocalFilenamePathToPrioritize.IsEmpty() && InPackageFilename.StartsWith(LocalFilenamePathToPrioritize);
};
auto OnIterateDirectoryItem = [&](const TCHAR* InPackageFilename, const FFileStatData& InPackageStatData) -> bool
{
if (StopTaskCounter.GetValue() != 0)
{
// Requested to stop - break out of the directory iteration
return false;
}
const FString PackageFilenameStr = InPackageFilename;
if (InPackageStatData.bIsDirectory)
{
LocalDiscoveredDirectories.Add(PackageFilenameStr / TEXT(""));
FString PackagePath;
if (FPackageName::TryConvertFilenameToLongPackageName(PackageFilenameStr, PackagePath) && !PathsToHideIfEmpty.Contains(PackagePath))
{
LocalDiscoveredPathsSet.Add(PackagePath);
}
}
else if (FPackageName::IsPackageFilename(PackageFilenameStr))
{
if (IsValidPackageFileToRead(PackageFilenameStr))
{
const FString LongPackageNameStr = FPackageName::FilenameToLongPackageName(PackageFilenameStr);
if (IsPriorityFile(PackageFilenameStr))
{
LocalPriorityFilesToSearch.Add(FDiscoveredPackageFile(PackageFilenameStr, InPackageStatData.ModificationTime));
}
else
{
LocalNonPriorityFilesToSearch.Add(FDiscoveredPackageFile(PackageFilenameStr, InPackageStatData.ModificationTime));
}
LocalDiscoveredPathsSet.Add(FPackageName::GetLongPackagePath(LongPackageNameStr));
++NumDiscoveredFiles;
// Flush the data if we've processed enough
if (!bIsSynchronous && (LocalPriorityFilesToSearch.Num() + LocalNonPriorityFilesToSearch.Num()) >= AssetDataGathererConstants::MaxFilesToDiscoverBeforeFlush)
{
FlushLocalResultsIfRequired();
}
}
}
return true;
};
bool bIsIdle = true;
while (StopTaskCounter.GetValue() == 0)
{
FString LocalDirectoryToSearch;
//.........这里部分代码省略.........
示例6: SubmitPackagesForAutomatedBuild
/**
* Helper method to submit packages to source control as part of the automated build process
*
* @param InPkgsToSubmit Set of packages which should be submitted to source control
* @param BuildSettings Build settings used during the automated build
*/
void FEditorBuildUtils::SubmitPackagesForAutomatedBuild( const TSet<UPackage*>& InPkgsToSubmit, const FEditorAutomatedBuildSettings& BuildSettings )
{
TArray<FString> LevelsToAdd;
TArray<FString> LevelsToSubmit;
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// first update the status of the packages
SourceControlProvider.Execute(ISourceControlOperation::Create<FUpdateStatus>(), SourceControlHelpers::PackageFilenames(InPkgsToSubmit.Array()));
// Iterate over the set of packages to submit, determining if they need to be checked in or
// added to the depot for the first time
for ( TSet<UPackage*>::TConstIterator PkgIter( InPkgsToSubmit ); PkgIter; ++PkgIter )
{
const UPackage* CurPkg = *PkgIter;
const FString PkgName = CurPkg->GetName();
const FString PkgFileName = SourceControlHelpers::PackageFilename(CurPkg);
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(CurPkg, EStateCacheUsage::ForceUpdate);
if(SourceControlState.IsValid())
{
if ( SourceControlState->IsCheckedOut() || SourceControlState->IsAdded() )
{
LevelsToSubmit.Add( PkgFileName );
}
else if ( BuildSettings.bAutoAddNewFiles && !SourceControlState->IsSourceControlled() && !SourceControlState->IsIgnored() )
{
LevelsToSubmit.Add( PkgFileName );
LevelsToAdd.Add( PkgFileName );
}
}
}
// Then, if we've also opted to check in any packages, iterate over that list as well
if(BuildSettings.bCheckInPackages)
{
TArray<FString> PackageNames = BuildSettings.PackagesToCheckIn;
for ( TArray<FString>::TConstIterator PkgIterName(PackageNames); PkgIterName; PkgIterName++ )
{
const FString& PkgName = *PkgIterName;
const FString PkgFileName = SourceControlHelpers::PackageFilename(PkgName);
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(PkgFileName, EStateCacheUsage::ForceUpdate);
if(SourceControlState.IsValid())
{
if ( SourceControlState->IsCheckedOut() || SourceControlState->IsAdded() )
{
LevelsToSubmit.Add( PkgFileName );
}
else if ( !SourceControlState->IsSourceControlled() && !SourceControlState->IsIgnored() )
{
// note we add the files we need to add to the submit list as well
LevelsToSubmit.Add( PkgFileName );
LevelsToAdd.Add( PkgFileName );
}
}
}
}
// first add files that need to be added
SourceControlProvider.Execute( ISourceControlOperation::Create<FMarkForAdd>(), LevelsToAdd, EConcurrency::Synchronous );
// Now check in all the changes, including the files we added above
TSharedRef<FCheckIn, ESPMode::ThreadSafe> CheckInOperation = StaticCastSharedRef<FCheckIn>(ISourceControlOperation::Create<FCheckIn>());
CheckInOperation->SetDescription(NSLOCTEXT("UnrealEd", "AutomatedBuild_AutomaticSubmission", "[Automatic Submission]"));
SourceControlProvider.Execute( CheckInOperation, LevelsToSubmit, EConcurrency::Synchronous );
}