本文整理汇总了C++中TArray::CreateConstIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::CreateConstIterator方法的具体用法?C++ TArray::CreateConstIterator怎么用?C++ TArray::CreateConstIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::CreateConstIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CollectAnimationNotifies
void USkeleton::CollectAnimationNotifies()
{
// need to verify if these pose is used by anybody else
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
// @Todo : remove it when we know the asset registry is updated
// meanwhile if you remove this, this will miss the links
//AnimationNotifies.Empty();
TArray<FAssetData> AssetList;
AssetRegistryModule.Get().GetAssetsByClass(UAnimSequenceBase::StaticClass()->GetFName(), AssetList, true);
#if WITH_EDITOR
// do not clear AnimationNotifies. We can't remove old ones yet.
FString CurrentSkeletonName = FAssetData(this).GetExportTextName();
for (auto Iter = AssetList.CreateConstIterator(); Iter; ++Iter)
{
const FAssetData& Asset = *Iter;
const FString* SkeletonValue = Asset.TagsAndValues.Find(TEXT("Skeleton"));
if (SkeletonValue && *SkeletonValue == CurrentSkeletonName)
{
if (const FString* Value = Asset.TagsAndValues.Find(USkeleton::AnimNotifyTag))
{
TArray<FString> NotifyList;
Value->ParseIntoArray(&NotifyList, &AnimNotifyTagDelimiter, true);
for (auto NotifyIter = NotifyList.CreateConstIterator(); NotifyIter; ++NotifyIter)
{
FString NotifyName = *NotifyIter;
AddNewAnimationNotify(FName(*NotifyName));
}
}
}
}
#endif
}
示例2: AddActorsToLayers
bool FLayers::AddActorsToLayers( const TArray< TWeakObjectPtr< AActor > >& Actors, const TArray< FName >& LayerNames )
{
bool bChangesOccurred = false;
if ( LayerNames.Num() > 0 )
{
Editor->GetSelectedActors()->BeginBatchSelectOperation();
for( auto ActorIt = Actors.CreateConstIterator(); ActorIt; ++ActorIt )
{
const TWeakObjectPtr< AActor > Actor = *ActorIt;
if ( !IsActorValidForLayer( Actor ) )
{
continue;
}
bool bActorWasModified = false;
for( auto LayerNameIt = LayerNames.CreateConstIterator(); LayerNameIt; ++LayerNameIt )
{
const FName& LayerName = *LayerNameIt;
if( !Actor->Layers.Contains( LayerName ) )
{
if( !bActorWasModified )
{
Actor->Modify();
bActorWasModified = true;
}
TWeakObjectPtr< ULayer > Layer = EnsureLayerExists( LayerName );
Actor->Layers.Add( LayerName );
Layer->Modify();
AddActorToStats( Layer, Actor);
}
} //END Iteration over Layers
if( bActorWasModified )
{
// update per-view visibility info
UpdateActorAllViewsVisibility(Actor);
// update general actor visibility
bool bActorModified = false;
bool bActorSelectionChanged = false;
const bool bActorNotifySelectionChange = true;
const bool bActorRedrawViewports = false;
UpdateActorVisibility( Actor, bActorSelectionChanged, bActorModified, bActorNotifySelectionChange, bActorRedrawViewports );
bChangesOccurred = true;
}
} //END Iteration over Actors
Editor->GetSelectedActors()->EndBatchSelectOperation();
}
return bChangesOccurred;
}
示例3:
void UK2Node_MacroInstance::ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins)
{
Super::ReallocatePinsDuringReconstruction(OldPins);
const UEdGraphSchema_K2* const Schema = GetDefault<UEdGraphSchema_K2>();
// determine if all wildcard pins are unlinked.
// if they are, we should revert them all back to wildcard status
bool bAllWildcardsAreUnlinked = true;
for (auto PinIt = Pins.CreateConstIterator(); PinIt; PinIt++)
{
// for each of the wildcard pins...
UEdGraphPin* const Pin = *PinIt;
if ( Pin->PinType.PinCategory == Schema->PC_Wildcard )
{
// find it in the old pins array (where it might not be a wildcard)
// and see if it's unlinked
for (auto OldPinIt = OldPins.CreateConstIterator(); OldPinIt; OldPinIt++)
{
UEdGraphPin const* const OldPin = *OldPinIt;
if (OldPin->PinName == Pin->PinName)
{
if (OldPin->LinkedTo.Num() > 0)
{
bAllWildcardsAreUnlinked = false;
break;
}
}
}
}
}
if (bAllWildcardsAreUnlinked == false)
{
// Copy pin types from old pins for wildcard pins
for (auto PinIt = Pins.CreateConstIterator(); PinIt; PinIt++)
{
UEdGraphPin* const Pin = *PinIt;
if ( Pin->PinType.PinCategory == Schema->PC_Wildcard )
{
// find it in the old pins and copy the type
for (auto OldPinIt = OldPins.CreateConstIterator(); OldPinIt; OldPinIt++)
{
UEdGraphPin const* const OldPin = *OldPinIt;
if (OldPin->PinName == Pin->PinName)
{
Pin->PinType = OldPin->PinType;
}
}
}
}
}
else
{
// no type
ResolvedWildcardType.ResetToDefaults();
}
}
示例4: RemoveActorsFromLayers
bool FLayers::RemoveActorsFromLayers( const TArray< TWeakObjectPtr< AActor > >& Actors, const TArray< FName >& LayerNames, const bool bUpdateStats )
{
Editor->GetSelectedActors()->BeginBatchSelectOperation();
bool bChangesOccurred = false;
for( auto ActorIt = Actors.CreateConstIterator(); ActorIt; ++ActorIt )
{
const TWeakObjectPtr< AActor > Actor = *ActorIt;
if ( !IsActorValidForLayer( Actor ) )
{
continue;
}
bool ActorWasModified = false;
for( auto LayerNameIt = LayerNames.CreateConstIterator(); LayerNameIt; ++LayerNameIt )
{
const FName& LayerName = *LayerNameIt;
if( Actor->Layers.Contains( LayerName ) )
{
if( !ActorWasModified )
{
Actor->Modify();
ActorWasModified = true;
}
Actor->Layers.Remove( LayerName );
TWeakObjectPtr< ULayer > Layer;
if( bUpdateStats && TryGetLayer( LayerName, Layer ))
{
Layer->Modify();
RemoveActorFromStats( Layer, Actor);
}
}
} //END Iteration over Layers
if( ActorWasModified )
{
// update per-view visibility info
UpdateActorAllViewsVisibility(Actor);
// update general actor visibility
bool bActorModified = false;
bool bActorSelectionChanged = false;
const bool bActorNotifySelectionChange = true;
const bool bActorRedrawViewports = false;
UpdateActorVisibility( Actor, bActorSelectionChanged, bActorModified, bActorNotifySelectionChange, bActorRedrawViewports );
bChangesOccurred = true;
}
} //END Iteration over Actors
Editor->GetSelectedActors()->EndBatchSelectOperation();
return bChangesOccurred;
}
示例5: ExecuteSCCOpenForAdd
void FPathContextMenu::ExecuteSCCOpenForAdd()
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// Get a list of package names in the selected paths
TArray<FString> PackageNames;
GetPackageNamesInSelectedPaths(PackageNames);
TArray<FString> PackagesToAdd;
TArray<UPackage*> PackagesToSave;
for ( auto PackageIt = PackageNames.CreateConstIterator(); PackageIt; ++PackageIt )
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(*PackageIt), EStateCacheUsage::Use);
if ( SourceControlState.IsValid() && !SourceControlState->IsSourceControlled() )
{
PackagesToAdd.Add(*PackageIt);
// Make sure the file actually exists on disk before adding it
FString Filename;
if ( !FPackageName::DoesPackageExist(*PackageIt, NULL, &Filename) )
{
UPackage* Package = FindPackage(NULL, **PackageIt);
if ( Package )
{
PackagesToSave.Add(Package);
}
}
}
}
if ( PackagesToAdd.Num() > 0 )
{
// If any of the packages are new, save them now
if ( PackagesToSave.Num() > 0 )
{
const bool bCheckDirty = false;
const bool bPromptToSave = false;
TArray<UPackage*> FailedPackages;
const FEditorFileUtils::EPromptReturnCode Return = FEditorFileUtils::PromptForCheckoutAndSave(PackagesToSave, bCheckDirty, bPromptToSave, &FailedPackages);
if(FailedPackages.Num() > 0)
{
// don't try and add files that failed to save - remove them from the list
for(auto FailedPackageIt = FailedPackages.CreateConstIterator(); FailedPackageIt; FailedPackageIt++)
{
PackagesToAdd.Remove((*FailedPackageIt)->GetName());
}
}
}
if ( PackagesToAdd.Num() > 0 )
{
SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), SourceControlHelpers::PackageFilenames(PackagesToAdd));
}
}
}
示例6: CheckOutReferencingPackages
bool FAssetFixUpRedirectors::CheckOutReferencingPackages(TArray<FRedirectorRefs>& RedirectorsToFix, TArray<UPackage*>& InOutReferencingPackagesToSave) const
{
// Prompt to check out all successfully loaded packages
bool bUserAcceptedCheckout = true;
if ( InOutReferencingPackagesToSave.Num() > 0 )
{
if ( ISourceControlModule::Get().IsEnabled() )
{
TArray<UPackage*> PackagesCheckedOutOrMadeWritable;
TArray<UPackage*> PackagesNotNeedingCheckout;
bUserAcceptedCheckout = FEditorFileUtils::PromptToCheckoutPackages( false, InOutReferencingPackagesToSave, &PackagesCheckedOutOrMadeWritable, &PackagesNotNeedingCheckout );
if ( bUserAcceptedCheckout )
{
TArray<UPackage*> PackagesThatCouldNotBeCheckedOut = InOutReferencingPackagesToSave;
for ( auto PackageIt = PackagesCheckedOutOrMadeWritable.CreateConstIterator(); PackageIt; ++PackageIt )
{
PackagesThatCouldNotBeCheckedOut.Remove(*PackageIt);
}
for ( auto PackageIt = PackagesNotNeedingCheckout.CreateConstIterator(); PackageIt; ++PackageIt )
{
PackagesThatCouldNotBeCheckedOut.Remove(*PackageIt);
}
for ( auto PackageIt = PackagesThatCouldNotBeCheckedOut.CreateConstIterator(); PackageIt; ++PackageIt )
{
const FName NonCheckedOutPackageName = (*PackageIt)->GetFName();
for ( auto RedirectorRefsIt = RedirectorsToFix.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
{
FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
if ( RedirectorRefs.ReferencingPackageNames.Contains(NonCheckedOutPackageName) )
{
// We did not check out at least one of the packages we needed to. This redirector can not be fixed up.
RedirectorRefs.FailureReason = FText::Format(LOCTEXT("RedirectorFixupFailed_NotCheckedOut", "Referencing package {0} was not checked out"), FText::FromName(NonCheckedOutPackageName));
RedirectorRefs.bRedirectorValidForFixup = false;
}
}
InOutReferencingPackagesToSave.Remove(*PackageIt);
}
}
}
}
return bUserAcceptedCheckout;
}
示例7: GetFileRevisions
bool FPerforceSourceControlLabel::GetFileRevisions( const TArray<FString>& InFiles, TArray< TSharedRef<ISourceControlRevision, ESPMode::ThreadSafe> >& OutRevisions ) const
{
bool bCommandOK = false;
FPerforceSourceControlModule& PerforceSourceControl = FModuleManager::LoadModuleChecked<FPerforceSourceControlModule>("PerforceSourceControl");
FScopedPerforceConnection ScopedConnection(EConcurrency::Synchronous, PerforceSourceControl.AccessSettings().GetConnectionInfo());
if(ScopedConnection.IsValid())
{
FPerforceConnection& Connection = ScopedConnection.GetConnection();
FP4RecordSet Records;
TArray<FString> Parameters;
TArray<FText> ErrorMessages;
for(auto Iter(InFiles.CreateConstIterator()); Iter; Iter++)
{
Parameters.Add(*Iter + TEXT("@") + Name);
}
bool bConnectionDropped = false;
bCommandOK = Connection.RunCommand(TEXT("files"), Parameters, Records, ErrorMessages, FOnIsCancelled(), bConnectionDropped);
if(bCommandOK)
{
ParseFilesResults(Records, OutRevisions, Connection.ClientRoot);
}
else
{
// output errors if any
for (int32 ErrorIndex = 0; ErrorIndex < ErrorMessages.Num(); ++ErrorIndex)
{
FMessageLog("SourceControl").Error(ErrorMessages[ErrorIndex]);
}
}
}
return bCommandOK;
}
示例8:
bool UK2Node_Select::CanChangePinType(UEdGraphPin* Pin) const
{
// If this is the index pin, only allow type switching if nothing is linked to the pin
if (Pin == GetIndexPin())
{
if (Pin->LinkedTo.Num() > 0)
{
return false;
}
}
// Else it's one of the wildcard pins that share their type, so make sure none of them have a link
else
{
if (GetReturnValuePin()->LinkedTo.Num() > 0)
{
return false;
}
else
{
TArray<UEdGraphPin*> OptionPins;
GetOptionPins(OptionPins);
for (auto It = OptionPins.CreateConstIterator(); It; It++)
{
UEdGraphPin* OptionPin = (*It);
if (OptionPin && OptionPin->LinkedTo.Num() > 0)
{
return false;
}
}
}
}
return true;
}
示例9: UpdatePackageStatus
bool FAssetFixUpRedirectors::UpdatePackageStatus(const TArray<FRedirectorRefs>& RedirectorsToFix) const
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
if ( ISourceControlModule::Get().IsEnabled() )
{
// Update the source control server availability to make sure we can do the rename operation
SourceControlProvider.Login();
if ( !SourceControlProvider.IsAvailable() )
{
// We have failed to update source control even though it is enabled. This is critical and we can not continue
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "SourceControl_ServerUnresponsive", "Source Control is unresponsive. Please check your connection and try again.") );
return false;
}
TArray<UPackage*> PackagesToAddToSCCUpdate;
for ( auto RedirectorRefsIt = RedirectorsToFix.CreateConstIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
{
const FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
PackagesToAddToSCCUpdate.Add(RedirectorRefs.Redirector->GetOutermost());
}
SourceControlProvider.Execute(ISourceControlOperation::Create<FUpdateStatus>(), PackagesToAddToSCCUpdate);
}
return true;
}
示例10: OpenAssetEditor
void FAssetTypeActions_EditorUtilityBlueprint::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
{
EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;
for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
{
if (UEditorUtilityBlueprint* Blueprint = Cast<UEditorUtilityBlueprint>(*ObjIt))
{
if (Blueprint->GeneratedClass->IsChildOf(UGlobalEditorUtilityBase::StaticClass()))
{
const UGlobalEditorUtilityBase* CDO = Blueprint->GeneratedClass->GetDefaultObject<UGlobalEditorUtilityBase>();
if (CDO->bAutoRunDefaultAction)
{
// This is an instant-run blueprint, just execute it
UGlobalEditorUtilityBase* Instance = NewObject<UGlobalEditorUtilityBase>(GetTransientPackage(), Blueprint->GeneratedClass);
Instance->ExecuteDefaultAction();
}
else
{
// This one needs settings or has multiple actions to execute, so invoke the blutility dialog
TSharedRef<FGlobalBlutilityDialog> NewBlutilityDialog(new FGlobalBlutilityDialog());
NewBlutilityDialog->InitBlutilityDialog(Mode, EditWithinLevelEditor, Blueprint);
}
}
else
{
// Edit actor blutilities
FBlueprintEditorModule& BlueprintEditorModule = FModuleManager::LoadModuleChecked<FBlueprintEditorModule>( "Kismet" );
TSharedRef<IBlueprintEditor> NewBlueprintEditor = BlueprintEditorModule.CreateBlueprintEditor(Mode, EditWithinLevelEditor, Blueprint, false);
}
}
}
}
示例11: CollectTestsByClass
/**
* Generates a list of assets from the ENGINE and the GAME by a specific type.
* This is to be used by the GetTest() function.
*/
void FEditorAutomationTestUtilities::CollectTestsByClass(UClass * Class, TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands)
{
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
TArray<FAssetData> ObjectList;
AssetRegistryModule.Get().GetAssetsByClass(Class->GetFName(), ObjectList);
for (TObjectIterator<UClass> AllClassesIt; AllClassesIt; ++AllClassesIt)
{
UClass* ClassList = *AllClassesIt;
FName ClassName = ClassList->GetFName();
}
for (auto ObjIter = ObjectList.CreateConstIterator(); ObjIter; ++ObjIter)
{
const FAssetData& Asset = *ObjIter;
FString Filename = Asset.ObjectPath.ToString();
//convert to full paths
Filename = FPackageName::LongPackageNameToFilename(Filename);
if (FAutomationTestFramework::GetInstance().ShouldTestContent(Filename))
{
FString BeautifiedFilename = Asset.AssetName.ToString();
OutBeautifiedNames.Add(BeautifiedFilename);
OutTestCommands.Add(Asset.ObjectPath.ToString());
}
}
}
示例12: DrawSnappingHelpers
virtual void DrawSnappingHelpers(const FSceneView* View, FPrimitiveDrawInterface* PDI)
{
for (auto PolicyIt = PolicyList.CreateConstIterator(); PolicyIt; ++PolicyIt)
{
(*PolicyIt)->DrawSnappingHelpers(View, PDI);
}
}
示例13: SnapRotatorToGrid
virtual void SnapRotatorToGrid(FRotator& Rotation) override
{
for (auto PolicyIt = PolicyList.CreateConstIterator(); PolicyIt; ++PolicyIt)
{
(*PolicyIt)->SnapRotatorToGrid(Rotation);
}
}
示例14: RefreshLightmapItems
void FLightmapCustomNodeBuilder::RefreshLightmapItems()
{
LightmapItems.Empty();
FWorldContext& Context = GEditor->GetEditorWorldContext();
UWorld* World = Context.World();
if ( World )
{
TArray<UTexture2D*> LightMapsAndShadowMaps;
World->GetLightMapsAndShadowMaps(World->GetCurrentLevel(), LightMapsAndShadowMaps);
for ( auto ObjIt = LightMapsAndShadowMaps.CreateConstIterator(); ObjIt; ++ObjIt )
{
UTexture2D* CurrentObject = *ObjIt;
if (CurrentObject)
{
FAssetData AssetData = FAssetData(CurrentObject);
const uint32 ThumbnailResolution = 64;
TSharedPtr<FAssetThumbnail> LightMapThumbnail = MakeShareable( new FAssetThumbnail( AssetData, ThumbnailResolution, ThumbnailResolution, ThumbnailPool ) );
TSharedPtr<FLightmapItem> NewItem = MakeShareable( new FLightmapItem(CurrentObject->GetPathName(), LightMapThumbnail) );
LightmapItems.Add(NewItem);
}
}
}
if ( LightmapListView.IsValid() )
{
LightmapListView->RequestListRefresh();
}
}
示例15: LoadGameplayTagTables
void UGameplayTagsManager::LoadGameplayTagTables(TArray<FString>& TagTableNames)
{
if (GameplayTagTables.Num() == 0 && TagTableNames.Num() > 0)
{
for (auto It(TagTableNames.CreateConstIterator()); It; ++It)
{
const FString& FileName = *It;
UDataTable* TagTable = LoadObject<UDataTable>(NULL, *FileName, NULL, LOAD_None, NULL);
// Handle case where the module is dynamically-loaded within a LoadPackage stack, which would otherwise
// result in the tag table not having its RowStruct serialized in time. Without the RowStruct, the tags manager
// will not be initialized correctly.
if (TagTable && IsLoading())
{
FLinkerLoad* TagLinker = TagTable->GetLinker();
if (TagLinker)
{
TagTable->GetLinker()->Preload(TagTable);
}
}
GameplayTagTables.Add(TagTable);
}
}
#if WITH_EDITOR
// Hook into notifications for object re-imports so that the gameplay tag tree can be reconstructed if the table changes
if (GIsEditor && GameplayTagTables.Num() > 0 && !RegisteredObjectReimport)
{
RegisteredObjectReimport = true;
FEditorDelegates::OnAssetPostImport.AddUObject(this, &UGameplayTagsManager::OnObjectReimported);
}
#endif
}