本文整理汇总了C++中TArray::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Reset方法的具体用法?C++ TArray::Reset怎么用?C++ TArray::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyDecorators
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();
}
}
}
示例2: GetSamplesFromBlendInput
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);
}
示例3: DrawHexagonalGridLines
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;
}
}
}
}
示例4: CreateGridMeshTriangles
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);
}
}
}
}
}
示例5: BuildScoreClampingTypeValues
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));
}
}
}
示例6: CollectPropertyData
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);
}
}
}
示例7: SubmitAndFreeContextContainer
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;
}
示例8: BuildTagTranslationTable
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);
}
// ----------------------------------------------------------------------------------------------
}
示例9: OnExit
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);
}
}
}
示例10: BuildTagTranslationTable_Forward
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);
}
}
示例11: TryInlineChunkData
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;
}
示例12: DescribeSelfToVisLog
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
}
示例13: GetAssetTypes
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());
}
示例14: GetAllDevices
void FIOSTargetPlatform::GetAllDevices( TArray<ITargetDevicePtr>& OutDevices ) const
{
OutDevices.Reset();
for (auto Iter = Devices.CreateConstIterator(); Iter; ++Iter)
{
OutDevices.Add(Iter.Value());
}
}
示例15: GetOuterClass
UAssetImportData* FAssetImportDataCustomization::GetOuterClass() const
{
static TArray<UObject*> OuterObjects;
OuterObjects.Reset();
PropertyHandle->GetOuterObjects(OuterObjects);
return OuterObjects.Num() ? Cast<UAssetImportData>(OuterObjects[0]) : nullptr;
}