void VerifyDecorators(UBehaviorTreeGraphNode* GraphNode) { TArray<UBTDecorator*> DecoratorInstances; TArray<FBTDecoratorLogic> DecoratorOperations; for (int32 i = 0; i < GraphNode->Decorators.Num(); i++) { UBehaviorTreeGraphNode* MyNode = GraphNode->Decorators[i]; if (MyNode == NULL) { continue; } DecoratorInstances.Reset(); DecoratorOperations.Reset(); UBehaviorTreeGraphNode_Decorator* MyDecoratorNode = Cast<UBehaviorTreeGraphNode_Decorator>(MyNode); UBehaviorTreeGraphNode_CompositeDecorator* MyCompositeNode = Cast<UBehaviorTreeGraphNode_CompositeDecorator>(MyNode); if (MyDecoratorNode) { MyDecoratorNode->CollectDecoratorData(DecoratorInstances, DecoratorOperations); } else if (MyCompositeNode) { MyCompositeNode->CollectDecoratorData(DecoratorInstances, DecoratorOperations); } MyNode->bHasObserverError = false; for (int32 SubIdx = 0; SubIdx < DecoratorInstances.Num(); SubIdx++) { MyNode->bHasObserverError = MyNode->bHasObserverError || !DecoratorInstances[SubIdx]->IsFlowAbortModeValid(); } } }
bool UBlendSpaceBase::GetSamplesFromBlendInput(const FVector &BlendInput, TArray<FBlendSampleData> & OutSampleDataList) const { static TArray<FGridBlendSample, TInlineAllocator<4> > RawGridSamples; check(IsInGameThread() && !RawGridSamples.Num()); // this must be called non-recursively from the gamethread GetRawSamplesFromBlendInput(BlendInput, RawGridSamples); OutSampleDataList.Reset(); OutSampleDataList.Reserve(RawGridSamples.Num() * FEditorElement::MAX_VERTICES); // consolidate all samples for (int32 SampleNum=0; SampleNum<RawGridSamples.Num(); ++SampleNum) { FGridBlendSample& GridSample = RawGridSamples[SampleNum]; float GridWeight = GridSample.BlendWeight; FEditorElement& GridElement = GridSample.GridElement; for(int Ind = 0; Ind < GridElement.MAX_VERTICES; ++Ind) { if(GridElement.Indices[Ind] != INDEX_NONE) { int32 Index = OutSampleDataList.AddUnique(GridElement.Indices[Ind]); OutSampleDataList[Index].AddWeight(GridElement.Weights[Ind]*GridWeight); } } } /** Used to sort by Weight. */ struct FCompareFBlendSampleData { FORCEINLINE bool operator()( const FBlendSampleData& A, const FBlendSampleData& B ) const { return B.TotalWeight < A.TotalWeight; } }; OutSampleDataList.Sort( FCompareFBlendSampleData() ); // remove noisy ones int32 TotalSample = OutSampleDataList.Num(); float TotalWeight = 0.f; for (int32 I=0; I<TotalSample; ++I) { if (OutSampleDataList[I].TotalWeight < ZERO_ANIMWEIGHT_THRESH) { // cut anything in front of this OutSampleDataList.RemoveAt(I, TotalSample-I, false); // we won't shrink here, that might screw up alloc optimization at a higher level, if not this is temp anyway break; } TotalWeight += OutSampleDataList[I].TotalWeight; } for (int32 I=0; I<OutSampleDataList.Num(); ++I) { // normalize to all weights OutSampleDataList[I].TotalWeight /= TotalWeight; } RawGridSamples.Reset(); return (OutSampleDataList.Num()!=0); }
void FPaperTileMapRenderSceneProxy::DrawHexagonalGridLines(FPrimitiveDrawInterface* PDI, const FLinearColor& Color, int32 LayerIndex) const { //@TODO: This isn't very efficient const FMatrix& LocalToWorldMat = GetLocalToWorld(); const uint8 DPG = SDPG_Foreground;//GetDepthPriorityGroup(View); TArray<FVector> Poly; Poly.Empty(6); for (int32 Y = 0; Y < TileMap->MapHeight; ++Y) { for (int32 X = 0; X < TileMap->MapWidth; ++X) { Poly.Reset(); TileMap->GetTilePolygon(X, Y, LayerIndex, Poly); FVector LastVertexWS = LocalToWorldMat.TransformPosition(Poly[5]); for (int32 VI = 0; VI < Poly.Num(); ++VI) { FVector ThisVertexWS = LocalToWorldMat.TransformPosition(Poly[VI]); PDI->DrawLine(LastVertexWS, ThisVertexWS, Color, DPG, 0.0f, WireDepthBias); LastVertexWS = ThisVertexWS; } } } }
void URuntimeMeshLibrary::CreateGridMeshTriangles(int32 NumX, int32 NumY, bool bWinding, TArray<int32>& Triangles) { Triangles.Reset(); if (NumX >= 2 && NumY >= 2) { // Build Quads for (int XIdx = 0; XIdx < NumX - 1; XIdx++) { for (int YIdx = 0; YIdx < NumY - 1; YIdx++) { const int32 I0 = (XIdx + 0)*NumY + (YIdx + 0); const int32 I1 = (XIdx + 1)*NumY + (YIdx + 0); const int32 I2 = (XIdx + 1)*NumY + (YIdx + 1); const int32 I3 = (XIdx + 0)*NumY + (YIdx + 1); if (bWinding) { ConvertQuadToTriangles(Triangles, I0, I1, I2, I3); } else { ConvertQuadToTriangles(Triangles, I0, I3, I2, I1); } } } } }
void FEnvQueryTestDetails::BuildScoreClampingTypeValues(bool bBuildMinValues, TArray<FTextIntPair>& ClampTypeValues) const { UEnum* ScoringNormalizationEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EEnvQueryTestClamping")); check(ScoringNormalizationEnum); ClampTypeValues.Reset(); ClampTypeValues.Add(FTextIntPair(ScoringNormalizationEnum->GetEnumText(EEnvQueryTestClamping::None), EEnvQueryTestClamping::None)); ClampTypeValues.Add(FTextIntPair(ScoringNormalizationEnum->GetEnumText(EEnvQueryTestClamping::SpecifiedValue), EEnvQueryTestClamping::SpecifiedValue)); if (IsFiltering()) { bool bSupportFilterThreshold = false; if (bBuildMinValues) { if (UsesFilterMin()) { bSupportFilterThreshold = true; } } else if (UsesFilterMax()) { bSupportFilterThreshold = true; } if (bSupportFilterThreshold) { ClampTypeValues.Add(FTextIntPair(ScoringNormalizationEnum->GetEnumText(EEnvQueryTestClamping::FilterThreshold), EEnvQueryTestClamping::FilterThreshold)); } } }
void CollectPropertyData(const UObject* Ob, const UClass* StopAtClass, TArray<UProperty*>& PropertyData) { UE_LOG(LogBehaviorTree, Verbose, TEXT("Looking for runtime properties of class: %s"), *GetNameSafe(Ob->GetClass())); PropertyData.Reset(); for (UProperty* TestProperty = Ob->GetClass()->PropertyLink; TestProperty; TestProperty = TestProperty->PropertyLinkNext) { // stop when reaching base class if (TestProperty->GetOuter() == StopAtClass) { break; } // skip properties without any setup data if (TestProperty->HasAnyPropertyFlags(CPF_Transient) || TestProperty->HasAnyPropertyFlags(CPF_DisableEditOnInstance) == false) { continue; } // serialize only simple types if (CanUsePropertyType(TestProperty)) { UE_LOG(LogBehaviorTree, Verbose, TEXT("> name: '%s'"), *GetNameSafe(TestProperty)); PropertyData.Add(TestProperty); } } }
virtual void SubmitAndFreeContextContainer(int32 Index, int32 Num) override { if (Index == 0) { check((IsInRenderingThread() || IsInRHIThread())); OwningDevice->GetDefaultCommandContext().FlushCommands(); } // Add the current lists for execution (now or possibly later) for (int32 i = 0; i < CommandLists.Num(); ++i) { OwningDevice->PendingCommandLists.Add(CommandLists[i]); OwningDevice->PendingCommandListsTotalWorkCommands += CommandLists[i].GetCurrentOwningContext()->numClears + CommandLists[i].GetCurrentOwningContext()->numCopies + CommandLists[i].GetCurrentOwningContext()->numDraws; } CommandLists.Reset(); // Submission occurs when a batch is finished const bool FinalCommandListInBatch = Index == (Num - 1); if (FinalCommandListInBatch && OwningDevice->PendingCommandLists.Num() > 0) { #if SUPPORTS_MEMORY_RESIDENCY OwningDevice->GetOwningRHI()->GetResourceResidencyManager().MakeResident(); #endif OwningDevice->GetCommandListManager().ExecuteCommandLists(OwningDevice->PendingCommandLists); OwningDevice->PendingCommandLists.Reset(); OwningDevice->PendingCommandListsTotalWorkCommands = 0; } delete this; }
void FGameplayCueTranslationManager::BuildTagTranslationTable() { #if WITH_EDITOR SCOPE_LOG_TIME_IN_SECONDS(*FString::Printf(TEXT("FGameplayCueTranslatorManager::BuildTagTranslationTables")), nullptr) #endif TagManager = &IGameplayTagsModule::Get().GetGameplayTagsManager(); check(TagManager); FGameplayTagContainer AllGameplayCueTags = TagManager->RequestGameplayTagChildren(UGameplayCueSet::BaseGameplayCueTag()); ResetTranslationLUT(); RefreshNameSwaps(); // ---------------------------------------------------------------------------------------------- // Find what tags may be derived from swap rules. Note how we work backwards. // If we worked forward, by expanding out all possible tags and then seeing if they exist, // this would take much much longer! TArray<FName> SplitNames; SplitNames.Reserve(10); // All gameplaycue tags for (const FGameplayTag& Tag : AllGameplayCueTags) { SplitNames.Reset(); TagManager->SplitGameplayTagFName(Tag, SplitNames); BuildTagTranslationTable_r(Tag.GetTagName(), SplitNames); } // ---------------------------------------------------------------------------------------------- }
void FAssetEditorManager::OnExit() { SaveOpenAssetEditors(true); TGuardValue<bool> GuardOnShutdown(bSavingOnShutdown, true); CloseAllAssetEditors(); // Don't attempt to report usage stats if analytics isn't available if (FEngineAnalytics::IsAvailable()) { TArray<FAnalyticsEventAttribute> EditorUsageAttribs; EditorUsageAttribs.Empty(2); for (auto Iter = EditorUsageAnalytics.CreateConstIterator(); Iter; ++Iter) { const FAssetEditorAnalyticInfo& Data = Iter.Value(); EditorUsageAttribs.Reset(); EditorUsageAttribs.Emplace(TEXT("TotalDuration.Seconds"), FString::Printf(TEXT("%.1f"), Data.SumDuration.GetTotalSeconds())); EditorUsageAttribs.Emplace(TEXT("OpenedInstances.Count"), FString::Printf(TEXT("%d"), Data.NumTimesOpened)); const FString EventName = FString::Printf(TEXT("Editor.Usage.%s"), *Iter.Key().ToString()); FEngineAnalytics::GetProvider().RecordEvent(EventName, EditorUsageAttribs); } } }
void FGameplayCueTranslationManager::BuildTagTranslationTable_Forward() { #if WITH_EDITOR SCOPE_LOG_TIME_IN_SECONDS(*FString::Printf(TEXT("FGameplayCueTranslatorManager::BuildTagTranslationTable_Forward")), nullptr) #endif // Build the normal TranslationLUT first. This is only done to make sure that UsedTranslators are filled in, giving "real" tags higher priority. // Example: // 1) GC.Rampage.Enraged // 2) GC.Rampage.Elemental.Enraged // // 2 is am override for 1, but comes first alphabetically. In the _Forward method, 2 would be handled first and expanded again to GC.Rampage.Elemental.Elemental.Enraged. // rule recursion wouldn't have been hit yet because 2 actually exists and would be encountered before 1. // // Since BuildTagTranslationTable_Forward is only called by the editor and BuildTagTranslationTable is already fast, this is the simplest way to avoid the above example. // _Forward() could be made more complicated to test for this itself, but doesn't seem like a good trade off for how it would complicate the function. BuildTagTranslationTable(); TArray<FName> SplitNames; SplitNames.Reserve(10); FGameplayTagContainer AllGameplayCueTags = TagManager->RequestGameplayTagChildren(UGameplayCueSet::BaseGameplayCueTag()); // Each GameplayCueTag for (const FGameplayTag& Tag : AllGameplayCueTags) { SplitNames.Reset(); TagManager->SplitGameplayTagFName(Tag, SplitNames); BuildTagTranslationTable_Forward_r(Tag.GetTagName(), SplitNames); } }
bool FStreamedAudioPlatformData::TryInlineChunkData() { TArray<uint32> AsyncHandles; TArray<uint8> TempData; FDerivedDataCacheInterface& DDC = GetDerivedDataCacheRef(); BeginLoadDerivedChunks(Chunks, 0, AsyncHandles); for (int32 ChunkIndex = 0; ChunkIndex < Chunks.Num(); ++ChunkIndex) { FStreamedAudioChunk& Chunk = Chunks[ChunkIndex]; if (Chunk.DerivedDataKey.IsEmpty() == false) { uint32 AsyncHandle = AsyncHandles[ChunkIndex]; DDC.WaitAsynchronousCompletion(AsyncHandle); if (DDC.GetAsynchronousResults(AsyncHandle, TempData)) { int32 ChunkSize = 0; FMemoryReader Ar(TempData, /*bIsPersistent=*/ true); Ar << ChunkSize; Chunk.BulkData.Lock(LOCK_READ_WRITE); void* ChunkData = Chunk.BulkData.Realloc(ChunkSize); Ar.Serialize(ChunkData, ChunkSize); Chunk.BulkData.Unlock(); Chunk.DerivedDataKey.Empty(); } else { return false; } TempData.Reset(); } } return true; }
void FNavMeshPath::DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const { if (IsStringPulled()) { // draw path points only for string pulled paths Super::DescribeSelfToVisLog(Snapshot); } // draw corridor #if WITH_RECAST FVisualLogShapeElement CorridorPoly(EVisualLoggerShapeElement::Polygon); CorridorPoly.SetColor(FColorList::Cyan); CorridorPoly.Category = LogNavigation.GetCategoryName(); CorridorPoly.Points.Reserve(PathCorridor.Num() * 6); const FVector CorridorOffset = NavigationDebugDrawing::PathOffset * 1.25f; int32 NumAreaMark = 1; ARecastNavMesh* NavMesh = Cast<ARecastNavMesh>(GetNavigationDataUsed()); NavMesh->BeginBatchQuery(); TArray<FVector> Verts; for (int32 Idx = 0; Idx < PathCorridor.Num(); Idx++) { Verts.Reset(); NavMesh->GetPolyVerts(PathCorridor[Idx], Verts); CorridorPoly.Points.Reset(); CorridorPoly.Points.Append(Verts); Snapshot->ElementsToDraw.Add(CorridorPoly); const uint8 AreaID = NavMesh->GetPolyAreaID(PathCorridor[Idx]); const UClass* AreaClass = NavMesh->GetAreaClass(AreaID); if (AreaClass && AreaClass != UNavigationSystem::GetDefaultWalkableArea()) { FVector CenterPt = FVector::ZeroVector; for (int32 VIdx = 0; VIdx < Verts.Num(); VIdx++) { CenterPt += Verts[VIdx]; } CenterPt /= Verts.Num(); FVisualLogShapeElement AreaMarkElem(EVisualLoggerShapeElement::Segment); AreaMarkElem.SetColor(FColorList::Orange); AreaMarkElem.Category = LogNavigation.GetCategoryName(); AreaMarkElem.Thicknes = 2; AreaMarkElem.Description = AreaClass->GetName(); AreaMarkElem.Points.Add(CenterPt + CorridorOffset); AreaMarkElem.Points.Add(CenterPt + CorridorOffset + FVector(0,0,100.0f + NumAreaMark * 50.0f)); Snapshot->ElementsToDraw.Add(AreaMarkElem); NumAreaMark = (NumAreaMark + 1) % 5; } } NavMesh->FinishBatchQuery(); //Snapshot->ElementsToDraw.Add(CorridorElem); #endif }
void FPersonaAssetFamily::GetAssetTypes(TArray<UClass*>& OutAssetTypes) const { OutAssetTypes.Reset(); OutAssetTypes.Add(USkeleton::StaticClass()); OutAssetTypes.Add(USkeletalMesh::StaticClass()); OutAssetTypes.Add(UAnimationAsset::StaticClass()); OutAssetTypes.Add(UAnimBlueprint::StaticClass()); }
void FIOSTargetPlatform::GetAllDevices( TArray<ITargetDevicePtr>& OutDevices ) const { OutDevices.Reset(); for (auto Iter = Devices.CreateConstIterator(); Iter; ++Iter) { OutDevices.Add(Iter.Value()); } }
UAssetImportData* FAssetImportDataCustomization::GetOuterClass() const { static TArray<UObject*> OuterObjects; OuterObjects.Reset(); PropertyHandle->GetOuterObjects(OuterObjects); return OuterObjects.Num() ? Cast<UAssetImportData>(OuterObjects[0]) : nullptr; }
void FHTML5TargetPlatform::GetAllDevices( TArray<ITargetDevicePtr>& OutDevices ) const { FScopeLock Lock( &DevicesCriticalSection ); OutDevices.Reset(); for( auto Iter = Devices.CreateConstIterator(); Iter; ++Iter ) { OutDevices.Add( Iter.Value() ); } }
/** * Starts the FPS chart data capture * * @param Label Label for this run */ void UEngine::StartFPSChart( const FString& Label ) { GFPSChartLabel = Label; for( int32 BucketIndex=0; BucketIndex<ARRAY_COUNT(GFPSChart); BucketIndex++ ) { GFPSChart[BucketIndex].Count = 0; GFPSChart[BucketIndex].CummulativeTime = 0; } GFPSChartStartTime = FPlatformTime::Seconds(); for( int32 BucketIndex = 0; BucketIndex < ARRAY_COUNT( GHitchChart ); ++BucketIndex ) { GHitchChart[ BucketIndex ].HitchCount = 0; GHitchChart[ BucketIndex ].GameThreadBoundHitchCount = 0; GHitchChart[ BucketIndex ].RenderThreadBoundHitchCount = 0; GHitchChart[ BucketIndex ].GPUBoundHitchCount = 0; } // Pre-allocate 10 minutes worth of frames at 30 Hz. int32 NumFrames = 10 * 60 * 30; GRenderThreadFrameTimes.Reset(NumFrames); GGPUFrameTimes.Reset(NumFrames); GGameThreadFrameTimes.Reset(NumFrames); GFrameTimes.Reset(NumFrames); GTotalGPUTime = 0; GGPUFrameTime = 0; GNumFramesBound_GameThread = 0; GNumFramesBound_RenderThread = 0; GNumFramesBound_GPU = 0; GTotalFramesBoundTime_GameThread = 0; GTotalFramesBoundTime_RenderThread = 0; GTotalFramesBoundTime_GPU = 0; GEnableDataCapture = true; GCaptureStartTime = FDateTime::Now().ToString(); }
TOptional<ECurrentState> FAutoReimportManager::ProcessAdditions(const FTimeLimit& TimeLimit) { // Override the global feedback context while we do this to avoid popping up dialogs TGuardValue<FFeedbackContext*> ScopedContextOverride(GWarn, FeedbackContextOverride.Get()); TGuardValue<bool> ScopedAssetChangesGuard(bGuardAssetChanges, true); FeedbackContextOverride->GetContent()->SetMainText(GetProgressText()); TMap<FString, TArray<UFactory*>> Factories; TArray<FString> FactoryExtensions; FactoryExtensions.Reserve(16); // Get the list of valid factories for (TObjectIterator<UClass> It ; It ; ++It) { UClass* CurrentClass = (*It); if (CurrentClass->IsChildOf(UFactory::StaticClass()) && !(CurrentClass->HasAnyClassFlags(CLASS_Abstract))) { UFactory* Factory = Cast<UFactory>(CurrentClass->GetDefaultObject()); if (Factory->bEditorImport && Factory->ImportPriority >= 0) { FactoryExtensions.Reset(); Factory->GetSupportedFileExtensions(FactoryExtensions); for (const auto& Ext : FactoryExtensions) { auto& Array = Factories.FindOrAdd(Ext); Array.Add(Factory); } } } } for (auto& Pair : Factories) { Pair.Value.Sort([](const UFactory& A, const UFactory& B) { return A.ImportPriority > B.ImportPriority; }); } const IAssetRegistry& Registry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry").Get(); for (auto& Monitor : DirectoryMonitors) { Monitor.ProcessAdditions(Registry, TimeLimit, PackagesToSave, Factories, *FeedbackContextOverride); yield TOptional<ECurrentState>(); } return ECurrentState::ProcessModifications; }
void UGatherTextFromAssetsCommandlet::ProcessPackages( const TArray< UPackage* >& PackagesToProcess ) { TArray<FGatherableTextData> GatherableTextDataArray; for(const UPackage* const Package : PackagesToProcess) { GatherableTextDataArray.Reset(); // Gathers from the given package FPropertyLocalizationDataGatherer(GatherableTextDataArray, Package); ProcessGatherableTextDataArray(Package->FileName.ToString(), GatherableTextDataArray); } }
void UGameplayTasksComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { SCOPE_CYCLE_COUNTER(STAT_TickGameplayTasks); Super::TickComponent(DeltaTime, TickType, ThisTickFunction); // Because we have no control over what a task may do when it ticks, we must be careful. // Ticking a task may kill the task right here. It could also potentially kill another task // which was waiting on the original task to do something. Since when a tasks is killed, it removes // itself from the TickingTask list, we will make a copy of the tasks we want to service before ticking any int32 NumTickingTasks = TickingTasks.Num(); int32 NumActuallyTicked = 0; switch (NumTickingTasks) { case 0: break; case 1: if (TickingTasks[0]) { TickingTasks[0]->TickTask(DeltaTime); NumActuallyTicked++; } break; default: { static TArray<UGameplayTask*> LocalTickingTasks; LocalTickingTasks.Reset(); LocalTickingTasks.Append(TickingTasks); for (UGameplayTask* TickingTask : LocalTickingTasks) { if (TickingTask) { TickingTask->TickTask(DeltaTime); NumActuallyTicked++; } } } break; }; // Stop ticking if no more active tasks if (NumActuallyTicked == 0) { TickingTasks.SetNum(0, false); UpdateShouldTick(); } }
FRectangleSortHelper(TArray<FIntRect>& InOutSprites) { // Sort by Y, then by X (top left corner), descending order (so we can use it as a stack from the top row down) TArray<FIntRect> SpritesLeft = InOutSprites; SpritesLeft.Sort([](const FIntRect& A, const FIntRect& B) { return (A.Min.Y == B.Min.Y) ? (A.Min.X > B.Min.X) : (A.Min.Y > B.Min.Y); }); InOutSprites.Reset(); // Start pulling sprites out, the first one in each row will dominate remaining ones and cause them to get labeled TArray<FIntRect> DominatedSprites; DominatedSprites.Empty(SpritesLeft.Num()); while (SpritesLeft.Num()) { FIntRect DominatingSprite = SpritesLeft.Pop(); DominatedSprites.Add(DominatingSprite); // Find the sprites that are dominated (intersect the infinite horizontal band described by the dominating sprite) for (int32 Index = 0; Index < SpritesLeft.Num();) { const FIntRect& CurElement = SpritesLeft[Index]; if ((CurElement.Min.Y <= DominatingSprite.Max.Y) && (CurElement.Max.Y >= DominatingSprite.Min.Y)) { DominatedSprites.Add(CurElement); SpritesLeft.RemoveAt(Index, /*Count=*/ 1, /*bAllowShrinking=*/ false); } else { ++Index; } } // Sort the sprites in the band by X and add them to the result DominatedSprites.Sort([](const FIntRect& A, const FIntRect& B) { return (A.Min.X < B.Min.X); }); InOutSprites.Append(DominatedSprites); DominatedSprites.Reset(); } }
void FSequencerActorBindingManager::GetRuntimeObjects( const TSharedRef<FMovieSceneInstance>& MovieSceneInstance, const FGuid& ObjectGuid, TArray<UObject*>& OutRuntimeObjects ) const { UObject* FoundSpawnedObject = FindPuppetObjectForSpawnableGuid( MovieSceneInstance, ObjectGuid ); if( FoundSpawnedObject ) { // Spawnable OutRuntimeObjects.Reset(); OutRuntimeObjects.Add( FoundSpawnedObject ); } else if( PlayMovieSceneNode.IsValid() ) { // Possessable OutRuntimeObjects = PlayMovieSceneNode->FindBoundObjects( ObjectGuid ); } }
ETextDirection ComputeTextDirection(const FString& InString, TArray<FTextDirectionInfo>& OutTextDirectionInfo) { OutTextDirectionInfo.Reset(); if (!InString.IsEmpty()) { FTextDirectionInfo TextDirectionInfo; TextDirectionInfo.StartIndex = 0; TextDirectionInfo.Length = InString.Len(); TextDirectionInfo.TextDirection = ETextDirection::LeftToRight; OutTextDirectionInfo.Add(MoveTemp(TextDirectionInfo)); } return ETextDirection::LeftToRight; }
FArchive& FVisualLoggerHelpers::Serialize(FArchive& Ar, TArray<FVisualLogDevice::FVisualLogEntryItem>& RecordedLogs) { Ar.UsingCustomVersion(EVisualLoggerVersion::GUID); if (Ar.IsLoading()) { TArray<FVisualLogDevice::FVisualLogEntryItem> CurrentFrame; while (Ar.AtEnd() == false) { int32 FrameTag = VISUAL_LOGGER_MAGIC_NUMBER; Ar << FrameTag; if (FrameTag != DEPRECATED_VISUAL_LOGGER_MAGIC_NUMBER && FrameTag != VISUAL_LOGGER_MAGIC_NUMBER) { break; } if (FrameTag == DEPRECATED_VISUAL_LOGGER_MAGIC_NUMBER) { Ar.SetCustomVersion(EVisualLoggerVersion::GUID, EVisualLoggerVersion::Initial, TEXT("VisualLogger")); } else { int32 ArchiveVer = -1; Ar << ArchiveVer; check(ArchiveVer >= EVisualLoggerVersion::Initial); Ar.SetCustomVersion(EVisualLoggerVersion::GUID, ArchiveVer, TEXT("VisualLogger")); } Ar << CurrentFrame; RecordedLogs.Append(CurrentFrame); CurrentFrame.Reset(); } } else { int32 FrameTag = VISUAL_LOGGER_MAGIC_NUMBER; Ar << FrameTag; int32 ArchiveVer = Ar.CustomVer(EVisualLoggerVersion::GUID); Ar << ArchiveVer; Ar << RecordedLogs; } int32 CustomVer = Ar.CustomVer(EVisualLoggerVersion::GUID); return Ar; }
FAssetImportInfo* FAssetImportDataCustomization::GetEditStruct() const { static TArray<FAssetImportInfo*> AssetImportInfo; AssetImportInfo.Reset(); if(PropertyHandle->IsValidHandle()) { PropertyHandle->AccessRawData(reinterpret_cast<TArray<void*>&>(AssetImportInfo)); } if (AssetImportInfo.Num() == 1) { return AssetImportInfo[0]; } return nullptr; }
void AHUD::GetHitBoxesAtCoordinates(FVector2D InHitLocation, TArray<const FHUDHitBox*>& OutHitBoxes) const { OutHitBoxes.Reset(); if (HitBoxMap.Num() > 0) { InHitLocation -= GetCoordinateOffset(); for (const FHUDHitBox& HitBox : HitBoxMap) { if (HitBox.Contains(InHitLocation)) { OutHitBoxes.Add(&HitBox); } } } }
bool FHttpServiceTracker::Tick(float DeltaTime) { // flush events at the specified interval. if (FPlatformTime::Seconds() > NextFlushTime) { if (AnalyticsProvider.IsValid()) { TArray<FAnalyticsEventAttribute> Attrs; Attrs.Reserve(10); // one event per endpoint. for (const auto& MetricsMapPair : EndpointMetricsMap) { Attrs.Reset(); Attrs.Emplace(TEXT("DomainName"), MetricsMapPair.Value.LastAnalyticsName); Attrs.Emplace(TEXT("FailCount"), MetricsMapPair.Value.FailCount); Attrs.Emplace(TEXT("SuccessCount"), MetricsMapPair.Value.SuccessCount); // We may have had no successful requests, so these values would be undefined. if (MetricsMapPair.Value.SuccessCount > 0) { Attrs.Emplace(TEXT("DownloadBytesSuccessTotal"), MetricsMapPair.Value.DownloadBytesSuccessTotal); Attrs.Emplace(TEXT("ElapsedTimeSuccessTotal"), MetricsMapPair.Value.ElapsedTimeSuccessTotal); Attrs.Emplace(TEXT("ElapsedTimeSuccessMin"), MetricsMapPair.Value.ElapsedTimeSuccessMin); Attrs.Emplace(TEXT("ElapsedTimeSuccessMax"), MetricsMapPair.Value.ElapsedTimeSuccessMax); } if (MetricsMapPair.Value.FailCount > 0) { Attrs.Emplace(TEXT("DownloadBytesFailTotal"), MetricsMapPair.Value.DownloadBytesFailTotal); Attrs.Emplace(TEXT("ElapsedTimeFailTotal"), MetricsMapPair.Value.ElapsedTimeFailTotal); Attrs.Emplace(TEXT("ElapsedTimeFailMin"), MetricsMapPair.Value.ElapsedTimeFailMin); Attrs.Emplace(TEXT("ElapsedTimeFailMax"), MetricsMapPair.Value.ElapsedTimeFailMax); } // one attribute per response code. for (const auto& ResponseCodeMapPair : MetricsMapPair.Value.ResponseCodes) { Attrs.Emplace(FString(TEXT("Code-")) + LexicalConversion::ToString(ResponseCodeMapPair.Key), ResponseCodeMapPair.Value); } AnalyticsProvider->RecordEvent(MetricsMapPair.Key.ToString(), Attrs); } // force an immediate flush always. We already summarized. AnalyticsProvider->FlushEvents(); } EndpointMetricsMap.Reset(); NextFlushTime += FlushIntervalSec; } return true; }
bool UTransBuffer::IsObjectInTransationBuffer( const UObject* Object ) const { TArray<UObject*> TransactionObjects; for( const FTransaction& Transaction : UndoBuffer ) { Transaction.GetTransactionObjects(TransactionObjects); if( TransactionObjects.Contains(Object) ) { return true; } TransactionObjects.Reset(); } return false; }
bool UAirBlueprintLib::CompressUsingImageWrapper(const TArray<uint8>& uncompressed, const int32 width, const int32 height, TArray<uint8>& compressed) { bool bSucceeded = false; compressed.Reset(); if (uncompressed.Num() > 0) { IImageWrapperModule* ImageWrapperModule = UAirBlueprintLib::getImageWrapperModule(); TSharedPtr<IImageWrapper> ImageWrapper = ImageWrapperModule->CreateImageWrapper(EImageFormat::PNG); if (ImageWrapper.IsValid() && ImageWrapper->SetRaw(&uncompressed[0], uncompressed.Num(), width, height, ERGBFormat::RGBA, 8)) { compressed = ImageWrapper->GetCompressed(); bSucceeded = true; } } return bSucceeded; }
static void PopulateLODGroupMenu(class FMenuBuilder& MenuBuilder) { TArray<FName> LODGroupNames; LODGroupNames.Reset(); UStaticMesh::GetLODGroups(LODGroupNames); for (int32 LODGroupIndex = 0; LODGroupIndex < LODGroupNames.Num(); ++LODGroupIndex) { FUIAction CreateLODGroupAction(FExecuteAction::CreateStatic(&ApplyLODGroup, LODGroupIndex)); MenuBuilder.AddMenuEntry( FText::FromName(LODGroupNames[LODGroupIndex]), LOCTEXT("LODGroupTypeTooltip", "Click to assign current LOD Group to selected actors"), FSlateIcon(), CreateLODGroupAction ); } }