当前位置: 首页>>代码示例>>C++>>正文


C++ TArray::RemoveAtSwap方法代码示例

本文整理汇总了C++中TArray::RemoveAtSwap方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::RemoveAtSwap方法的具体用法?C++ TArray::RemoveAtSwap怎么用?C++ TArray::RemoveAtSwap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TArray的用法示例。


在下文中一共展示了TArray::RemoveAtSwap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PruneIsolatedNodes

/** Prunes any nodes that weren't visited from the graph, printing out a warning */
void FGraphCompilerContext::PruneIsolatedNodes(const TArray<UEdGraphNode*>& RootSet, TArray<UEdGraphNode*>& GraphNodes)
{
	FEdGraphUtilities::FNodeVisitor Visitor;

	for (TArray<UEdGraphNode*>::TConstIterator It(RootSet); It; ++It)
	{
		UEdGraphNode* RootNode = *It;
		Visitor.TraverseNodes(RootNode);
	}

	for (int32 NodeIndex = 0; NodeIndex < GraphNodes.Num(); ++NodeIndex)
	{
		UEdGraphNode* Node = GraphNodes[NodeIndex];
		if (!Visitor.VisitedNodes.Contains(Node))
		{
			if (!CanIgnoreNode(Node))
			{
				// Disabled this warning, because having orphaned chains is standard workflow for LDs
				//MessageLog.Warning(TEXT("Node @@ will never be executed and is being pruned"), Node);
			}

			if (!ShouldForceKeepNode(Node))
			{
				Node->BreakAllNodeLinks();
				GraphNodes.RemoveAtSwap(NodeIndex);
				--NodeIndex;
			}
		}
	}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:31,代码来源:EdGraphCompiler.cpp

示例2: FilterSubscriptions

void FMessageRouter::FilterSubscriptions( TArray<IMessageSubscriptionPtr>& Subscriptions, const IMessageContextRef& Context, TArray<IReceiveMessagesPtr>& OutRecipients )
{
	EMessageScope MessageScope = Context->GetScope();

	for (int32 SubscriptionIndex = 0; SubscriptionIndex < Subscriptions.Num(); ++SubscriptionIndex)
	{
		const IMessageSubscriptionPtr& Subscription = Subscriptions[SubscriptionIndex];

		if (Subscription->IsEnabled() && Subscription->GetScopeRange().Contains(MessageScope))
		{
			IReceiveMessagesPtr Subscriber = Subscription->GetSubscriber().Pin();

			if (Subscriber.IsValid())
			{
				if (MessageScope == EMessageScope::Thread)
				{
					ENamedThreads::Type RecipientThread = Subscriber->GetRecipientThread();
					ENamedThreads::Type SenderThread = Context->GetSenderThread();

					if (RecipientThread != SenderThread)
					{
						continue;
					}
				}

				OutRecipients.AddUnique(Subscriber);
			}
			else
			{
				Subscriptions.RemoveAtSwap(SubscriptionIndex);
				--SubscriptionIndex;
			}
		}
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:35,代码来源:MessageRouter.cpp

示例3: BuildDependencyMapAndCompile

	static void BuildDependencyMapAndCompile(const TArray<UUserDefinedStruct*>& ChangedStructs, FCompilerResultsLog& MessageLog)
	{
		struct FDependencyMapEntry
		{
			UUserDefinedStruct* Struct;
			TSet<UUserDefinedStruct*> StructuresToWaitFor;

			FDependencyMapEntry() : Struct(NULL) {}

			void Initialize(UUserDefinedStruct* ChangedStruct, const TArray<UUserDefinedStruct*>& AllChangedStructs) 
			{ 
				Struct = ChangedStruct;
				check(Struct);

				auto Schema = GetDefault<UEdGraphSchema_K2>();
				for (auto& VarDesc : FStructureEditorUtils::GetVarDesc(Struct))
				{
					auto StructType = Cast<UUserDefinedStruct>(VarDesc.SubCategoryObject.Get());
					if (StructType && (VarDesc.Category == Schema->PC_Struct) && AllChangedStructs.Contains(StructType))
					{
						StructuresToWaitFor.Add(StructType);
					}
				}
			}
		};

		TArray<FDependencyMapEntry> DependencyMap;
		for (auto Iter = ChangedStructs.CreateConstIterator(); Iter; ++Iter)
		{
			DependencyMap.Add(FDependencyMapEntry());
			DependencyMap.Last().Initialize(*Iter, ChangedStructs);
		}

		while (DependencyMap.Num())
		{
			int32 StructureToCompileIndex = INDEX_NONE;
			for (int32 EntryIndex = 0; EntryIndex < DependencyMap.Num(); ++EntryIndex)
			{
				if(0 == DependencyMap[EntryIndex].StructuresToWaitFor.Num())
				{
					StructureToCompileIndex = EntryIndex;
					break;
				}
			}
			check(INDEX_NONE != StructureToCompileIndex);
			UUserDefinedStruct* Struct = DependencyMap[StructureToCompileIndex].Struct;
			check(Struct);

			FUserDefinedStructureCompilerInner::CleanAndSanitizeStruct(Struct);
			FUserDefinedStructureCompilerInner::InnerCompileStruct(Struct, GetDefault<UEdGraphSchema_K2>(), MessageLog);

			DependencyMap.RemoveAtSwap(StructureToCompileIndex);

			for (auto EntryIter = DependencyMap.CreateIterator(); EntryIter; ++EntryIter)
			{
				(*EntryIter).StructuresToWaitFor.Remove(Struct);
			}
		}
	}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:59,代码来源:UserDefinedStructureCompilerUtils.cpp

示例4: UniqueIdToRemoveMatch

static inline void RemoveIdFromMuteList(TArray< TSharedRef<const FUniqueNetId> >& MuteList, const TSharedPtr<const FUniqueNetId>& UniqueIdToRemove)
{
	FUniqueNetIdMatcher UniqueIdToRemoveMatch(*UniqueIdToRemove);
	int32 RemoveIndex = MuteList.IndexOfByPredicate(UniqueIdToRemoveMatch);
	if (RemoveIndex != INDEX_NONE)
	{
		MuteList.RemoveAtSwap(RemoveIndex);
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:9,代码来源:PlayerMuteList.cpp

示例5: RemoveTargetAggregation

void FGAActiveEffectContainer::RemoveTargetAggregation(TSharedPtr<FGAActiveDuration> EffectIn)
{
	TArray<FGAEffectHandle>* handles;
	handles = MyEffects.Find(EffectIn->EffectName);

	for (auto It = handles->CreateIterator(); It; ++It)
	{
		if (*It == EffectIn->MyHandle)
		{
			handles->RemoveAtSwap(It.GetIndex());
		}
	}
}
开发者ID:DaedalusProspect,项目名称:ActionRPGGame,代码行数:13,代码来源:GAEffects.cpp

示例6: GetSelectedInstances

void FSessionManager::GetSelectedInstances( TArray<ISessionInstanceInfoPtr>& OutInstances) const
{
	if (SelectedSession.IsValid())
	{
		SelectedSession->GetInstances(OutInstances);

		for (int32 Index = OutInstances.Num() - 1; Index >= 0 ; --Index)
		{
			if (DeselectedInstances.Contains(OutInstances[Index]))
			{
				OutInstances.RemoveAtSwap(Index);
			}
		}
	}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:15,代码来源:SessionManager.cpp

示例7: RemoveModsWithActiveHandle

void FAggregator::RemoveModsWithActiveHandle(TArray<FAggregatorMod>& InMods, FActiveGameplayEffectHandle ActiveHandle)
{
	check(ActiveHandle.IsValid());

	for(int32 idx=InMods.Num()-1; idx >= 0; --idx)
	{
		if (InMods[idx].ActiveHandle == ActiveHandle)
		{
			if (InMods[idx].IsPredicted)
			{
				NumPredictiveMods--;
			}

			InMods.RemoveAtSwap(idx, 1, false);
		}
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:17,代码来源:GameplayEffectAggregator.cpp

示例8: DeleteOcclusionQueriesForCurrentContext

void DeleteOcclusionQueriesForCurrentContext(EGLContext Context)
{
	if (!ReleasedQueriesGuard)
	{
		ReleasedQueriesGuard = new FCriticalSection;
	}

	{
		FScopeLock Lock(ReleasedQueriesGuard);
		for (int32 Index = 0; Index < ReleasedQueries.Num(); ++Index)
		{
			if (ReleasedQueries[Index].Context == Context)
			{
				FOpenGL::DeleteQueries(1, &ReleasedQueries[Index].Query);
				ReleasedQueries.RemoveAtSwap(Index);
				--Index;
			}
		}
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:20,代码来源:AndroidES31OpenGL.cpp

示例9: PlatformGetNewRenderQuery

void PlatformGetNewRenderQuery( GLuint* OutQuery, uint64* OutQueryContext )
{
	if( !ReleasedQueriesGuard )
	{
		ReleasedQueriesGuard = new FCriticalSection;
	}

	{
		FScopeLock Lock(ReleasedQueriesGuard);

#ifdef UE_BUILD_DEBUG
		check( OutQuery && OutQueryContext );
#endif

		HGLRC Context = GetCurrentContext();
		check( Context );

		GLuint NewQuery = 0;

		// Check for possible query reuse
		const int32 ArraySize = ReleasedQueries.Num();
		for( int32 Index = 0; Index < ArraySize; ++Index )
		{
			if( ReleasedQueries[Index].Context == Context )
			{
				NewQuery = ReleasedQueries[Index].Query;
				ReleasedQueries.RemoveAtSwap(Index);
				break;
			}
		}

		if( !NewQuery )
		{
			FOpenGL::GenQueries( 1, &NewQuery );
		}

		*OutQuery = NewQuery;
		*OutQueryContext = (uint64)Context;
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:40,代码来源:OpenGLWindows.cpp

示例10: MergeInFunctionNodes


//.........这里部分代码省略.........
		}

		FString GetCallstack()const
		{
			FString Ret;
			const FFunctionContext* Curr = this;
			while (Curr)
			{
				if (Curr->Script)
				{
					Ret.Append(*(Curr->Script->GetPathName()));
				}
				else
				{
					Ret.Append(TEXT("Unknown"));
				}

				Ret.Append(TEXT("\n"));

				Curr = Curr->Parent;
			}
			return Ret;
		}
	};

	//A pool of contexts on the stack to avoid loads of needless, small heap allocations.
	TArray<FFunctionContext, TInlineAllocator<512>> ContextPool;
	ContextPool.Reserve(512);

	FFunctionContext RootContext;
	FFunctionContext* CurrentContext = &RootContext;
	CurrentContext->FunctionGraph = SourceGraph;
	CurrentContext->Script = Script;

	//Depth first traversal of all function calls.
	while (CurrentContext)
	{
		//Find any sub functions and process this function call.
		if (!CurrentContext->bProcessed)
		{
			CurrentContext->bProcessed = true;

			//Find any sub functions and check for re-entrance.
			if (CurrentContext->FunctionGraph)
			{
				for (UEdGraphNode* Node : CurrentContext->FunctionGraph->Nodes)
				{
					UNiagaraNodeFunctionCall* FuncNode = Cast<UNiagaraNodeFunctionCall>(Node);
					if (FuncNode)
					{
						int32 NewIdx = ContextPool.AddZeroed();
						FFunctionContext* SubFuncContext = &ContextPool[NewIdx];
						CurrentContext->SubFunctionCalls.Push(SubFuncContext);
						SubFuncContext->Parent = CurrentContext;
						SubFuncContext->Function = FuncNode;
						SubFuncContext->PoolIdx = NewIdx;
						SubFuncContext->Script = FuncNode->FunctionScript;

						if (SubFuncContext->CheckForReentrance())
						{
							FString Callstack = SubFuncContext->GetCallstack();
							MessageLog.Error(TEXT("Reentrant function call!\n%s"), *Callstack);
							return false;
						}

						//Copy the function graph as we'll be modifying it as we merge in with the main graph.
						UNiagaraScriptSource* FuncSource = CastChecked<UNiagaraScriptSource>(FuncNode->FunctionScript->Source);
						check(FuncSource);
						SubFuncContext->FunctionGraph = CastChecked<UNiagaraGraph>(FEdGraphUtilities::CloneGraph(FuncSource->NodeGraph, NULL, &MessageLog));
					}
				}
			}

			//Merge this function into the main graph now.
			if (CurrentContext->Function && CurrentContext->FunctionGraph)
			{
				MergeFunctionIntoMainGraph(CurrentContext->Function, CurrentContext->FunctionGraph);
			}
		}

		if (CurrentContext->SubFunctionCalls.Num() > 0)
		{
			//Move to the next sub function.
			CurrentContext = CurrentContext->SubFunctionCalls.Pop();
		}
		else
		{
			//Done processing this function so remove it and move back to the parent.
			if (CurrentContext->PoolIdx != INDEX_NONE)
			{
				CurrentContext->FunctionGraph->MarkPendingKill();

				ContextPool.RemoveAtSwap(CurrentContext->PoolIdx);
			}
			CurrentContext = CurrentContext->Parent;
		}
	}

	return true;
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:101,代码来源:NiagaraCompiler.cpp

示例11: GetSamplesFromBlendInput

bool UBlendSpaceBase::GetSamplesFromBlendInput(const FVector &BlendInput, TArray<FBlendSampleData> & OutSampleDataList) const
{
	TArray<FGridBlendSample, TInlineAllocator<4> >& RawGridSamples = FBlendSpaceScratchData::Get().RawGridSamples;
	check(!RawGridSamples.Num()); // this must be called non-recursively
	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(int32 Ind = 0; Ind < GridElement.MAX_VERTICES; ++Ind)
		{
			const int32 SampleDataIndex = GridElement.Indices[Ind];		
			if(SampleDataIndex != INDEX_NONE)
			{
				int32 Index = OutSampleDataList.AddUnique(SampleDataIndex);
				OutSampleDataList[Index].AddWeight(GridElement.Weights[Ind]*GridWeight);
				OutSampleDataList[Index].Animation = SampleData[SampleDataIndex].Animation;
			}
		}
	}

	// go through merge down to first sample 
	for (int32 Index1 = 0; Index1 < OutSampleDataList.Num(); ++Index1)
	{
		for (int32 Index2 = Index1 + 1; Index2 < OutSampleDataList.Num(); ++Index2)
		{
			// if they have sample sample, remove the Index2, and get out
			if (OutSampleDataList[Index1].Animation == OutSampleDataList[Index2].Animation)
			{
				// add weight
				OutSampleDataList[Index1].AddWeight(OutSampleDataList[Index2].GetWeight());
				// as for time or previous time will be the master one(Index1)
				OutSampleDataList.RemoveAtSwap(Index2, 1, false);
				--Index2;
			}
		}
	}

	/** 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);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:75,代码来源:BlendSpaceBase.cpp

示例12: CreateExecutionSchedule

/**
 * Performs a topological sort on the graph of nodes passed in (which is expected to form a DAG), scheduling them.
 * If there are cycles or unconnected nodes present in the graph, an error will be output for each node that failed to be scheduled.
 */
void FGraphCompilerContext::CreateExecutionSchedule(const TArray<UEdGraphNode*>& GraphNodes, /*out*/ TArray<UEdGraphNode*>& LinearExecutionSchedule) const
{
	TArray<UEdGraphNode*> NodesWithNoEdges;
	TMap<UEdGraphNode*, int32> NumIncomingEdges;
	int32 TotalGraphEdgesLeft = 0;

	// Build a list of nodes with no antecedents and update the initial incoming edge counts for every node
	for (int32 NodeIndex = 0; NodeIndex < GraphNodes.Num(); ++NodeIndex)
	{
		UEdGraphNode* Node = GraphNodes[NodeIndex];

		const int32 NumEdges = CountIncomingEdges(Node);
		NumIncomingEdges.Add(Node, NumEdges);
		TotalGraphEdgesLeft += NumEdges;
			
		if (NumEdges == 0)
		{
			NodesWithNoEdges.Add(Node);
		}
	}

	// While there are nodes with no unscheduled inputs, schedule them and queue up any that are newly scheduleable
	while (NodesWithNoEdges.Num() > 0)
	{
		// Schedule a node
		UEdGraphNode* Node = NodesWithNoEdges[0];
		NodesWithNoEdges.RemoveAtSwap(0);
		LinearExecutionSchedule.Add(Node);

		// Decrement edge counts for things that depend on this node, and queue up any that hit 0 incoming edges
		for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex)
		{
			UEdGraphPin* OutPin = Node->Pins[PinIndex];
			if ((OutPin->Direction == EGPD_Output) && PinIsImportantForDependancies(OutPin))
			{
				for (int32 LinkIndex = 0; LinkIndex < OutPin->LinkedTo.Num(); ++LinkIndex)
				{
					UEdGraphPin* LinkedToPin = OutPin->LinkedTo[LinkIndex];
					if( !LinkedToPin )
					{
						// If something went wrong in serialization and we have a bad connection, skip this.
						continue;
					}

					UEdGraphNode* WasDependentNode = OutPin->LinkedTo[LinkIndex]->GetOwningNodeUnchecked();
					int32* pNumEdgesLeft = WasDependentNode ? NumIncomingEdges.Find(WasDependentNode) : NULL;

					// Remove the edge between these two nodes, since node is scheduled
					if (pNumEdgesLeft)
					{
						int32& NumEdgesLeft = *pNumEdgesLeft;

						if (NumEdgesLeft <= 0)
						{
							MessageLog.Error(TEXT("Internal compiler error inside CreateExecutionSchedule (site 1); there is an issue with node/pin manipulation that was performed in this graph, please contact the Blueprints team!"));
							LinearExecutionSchedule.Empty();
							return;
						}
						NumEdgesLeft--;
						TotalGraphEdgesLeft--;

						// Was I the last link on that node?
						if (NumEdgesLeft == 0)
						{
							NodesWithNoEdges.Add(WasDependentNode);
						}
					}
					else
					{
						MessageLog.Error(TEXT("Internal compiler error inside CreateExecutionSchedule (site 2); there is an issue with node/pin manipulation that was performed in this graph, please contact the Blueprints team!"));
						LinearExecutionSchedule.Empty();
						return;
					}
				}
			}
		}
	}

	// At this point, any remaining edges are either within an unrelated subgraph (unconnected island) or indicate loops that break the DAG constraint
	// Before this is called, any unconnected graphs should have been cut free so we can just error
	if (TotalGraphEdgesLeft > 0)
	{
		// Run thru and print out any nodes that couldn't be scheduled due to loops
		for (TMap<UEdGraphNode*, int32>::TIterator It(NumIncomingEdges); It; ++It)
		{
			//@TODO: Probably want to determine the actual pin that caused the cycle, instead of just printing out the node
			if (It.Value() > 0)
			{
				MessageLog.Error(TEXT("Dependency cycle detected, preventing node @@ from being scheduled"), It.Key());
			}
		}
	}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:97,代码来源:EdGraphCompiler.cpp

示例13: BuildAudioFlowRoadmap

void FSoundCueGraphConnectionDrawingPolicy::BuildAudioFlowRoadmap()
{
	UAudioComponent* PreviewAudioComponent = GEditor->GetPreviewAudioComponent();
	FAudioDevice* AudioDevice = PreviewAudioComponent ? PreviewAudioComponent->GetAudioDevice() : nullptr;

	if (AudioDevice)
	{
		USoundCueGraph* SoundCueGraph = CastChecked<USoundCueGraph>(GraphObj);
		USoundCue* SoundCue = SoundCueGraph->GetSoundCue();


		if (PreviewAudioComponent && PreviewAudioComponent->IsPlaying() && PreviewAudioComponent->Sound == SoundCue)
		{
			TArray<FWaveInstance*> WaveInstances;
			const int32 FirstActiveIndex = AudioDevice->GetSortedActiveWaveInstances(WaveInstances, ESortedActiveWaveGetType::QueryOnly);

			// Run through the active instances and cull out anything that isn't related to this graph
			if (FirstActiveIndex > 0)
			{
				WaveInstances.RemoveAt(0, FirstActiveIndex + 1);
			}

			for (int32 WaveIndex = WaveInstances.Num() - 1; WaveIndex >= 0 ; --WaveIndex)
			{
				UAudioComponent* WaveInstanceAudioComponent = WaveInstances[WaveIndex]->ActiveSound->AudioComponent.Get();
				if (WaveInstanceAudioComponent != PreviewAudioComponent)
				{
					WaveInstances.RemoveAtSwap(WaveIndex);
				}
			}

			for (int32 WaveIndex = 0; WaveIndex < WaveInstances.Num(); ++WaveIndex)
			{
				TArray<USoundNode*> PathToWaveInstance;
				if (SoundCue->FindPathToNode(WaveInstances[WaveIndex]->WaveInstanceHash, PathToWaveInstance))
				{
					TArray<USoundCueGraphNode_Root*> RootNode;
					TArray<UEdGraphNode*> GraphNodes;
					SoundCueGraph->GetNodesOfClass<USoundCueGraphNode_Root>(RootNode);
					check(RootNode.Num() == 1);
					GraphNodes.Add(RootNode[0]);

					TArray<double> NodeTimes;
					NodeTimes.Add(FApp::GetCurrentTime()); // Time for the root node

					for (int32 i = 0; i < PathToWaveInstance.Num(); ++i)
					{
						const double ObservationTime = FApp::GetCurrentTime() + 1.f;

						NodeTimes.Add(ObservationTime);
						GraphNodes.Add(PathToWaveInstance[i]->GraphNode);
					}

					// Record the unique node->node pairings, keeping only the most recent times for each pairing
					for (int32 i = GraphNodes.Num() - 1; i >= 1; --i)
					{
						UEdGraphNode* CurNode = GraphNodes[i];
						double CurNodeTime = NodeTimes[i];
						UEdGraphNode* NextNode = GraphNodes[i-1];
						double NextNodeTime = NodeTimes[i-1];

						FExecPairingMap& Predecessors = PredecessorNodes.FindOrAdd(NextNode);

						// Update the timings if this is a more recent pairing
						FTimePair& Timings = Predecessors.FindOrAdd(CurNode);
						if (Timings.ThisExecTime < NextNodeTime)
						{
							Timings.PredExecTime = CurNodeTime;
							Timings.ThisExecTime = NextNodeTime;
						}
					}
				}
			}
		}
	}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:76,代码来源:SoundCueGraphConnectionDrawingPolicy.cpp

示例14: BuildDependencyMapAndCompile

	static void BuildDependencyMapAndCompile(TArray<UBlueprintGeneratedStruct*>& ChangedStructs, FCompilerResultsLog& MessageLog)
	{
		struct FFindStructureDescriptionPred
		{
			const UBlueprintGeneratedStruct* const Struct;
			FFindStructureDescriptionPred(const UBlueprintGeneratedStruct* InStruct) : Struct(InStruct) { check(Struct); }
			bool operator()(const FBPStructureDescription& Desc) { return (Desc.CompiledStruct == Struct); }
		};

		struct FDependencyMapEntry
		{
			UBlueprintGeneratedStruct* Struct;
			TSet<UBlueprintGeneratedStruct*> StructuresToWaitFor;

			FDependencyMapEntry() : Struct(NULL) {}

			void Initialize(UBlueprintGeneratedStruct* ChangedStruct, TArray<UBlueprintGeneratedStruct*>& AllChangedStructs) 
			{ 
				Struct = ChangedStruct;
				check(Struct && Struct->StructGeneratedBy);
				FBPStructureDescription* StructureDescription = Struct->StructGeneratedBy->UserDefinedStructures.FindByPredicate(FFindStructureDescriptionPred(Struct));
				check(StructureDescription);

				auto Schema = GetDefault<UEdGraphSchema_K2>();
				for (auto FieldIter = StructureDescription->Fields.CreateIterator(); FieldIter; ++FieldIter)
				{
					FEdGraphPinType FieldType = (*FieldIter).VarType;
					auto StructType = Cast<UBlueprintGeneratedStruct>(FieldType.PinSubCategoryObject.Get());
					if (StructType && (FieldType.PinCategory == Schema->PC_Struct) && AllChangedStructs.Contains(StructType))
					{
						StructuresToWaitFor.Add(StructType);
					}
				}
			}
		};

		TArray<FDependencyMapEntry> DependencyMap;
		for (auto Iter = ChangedStructs.CreateIterator(); Iter; ++Iter)
		{
			DependencyMap.Add(FDependencyMapEntry());
			DependencyMap.Last().Initialize(*Iter, ChangedStructs);
		}

		while (DependencyMap.Num())
		{
			int32 StructureToCompileIndex = INDEX_NONE;
			for (int32 EntryIndex = 0; EntryIndex < DependencyMap.Num(); ++EntryIndex)
			{
				if(0 == DependencyMap[EntryIndex].StructuresToWaitFor.Num())
				{
					StructureToCompileIndex = EntryIndex;
					break;
				}
			}
			check(INDEX_NONE != StructureToCompileIndex);
			UBlueprintGeneratedStruct* Struct = DependencyMap[StructureToCompileIndex].Struct;
			check(Struct->StructGeneratedBy);
			FBPStructureDescription* StructureDescription = Struct->StructGeneratedBy->UserDefinedStructures.FindByPredicate(FFindStructureDescriptionPred(Struct));
			check(StructureDescription);

			FUserDefinedStructureCompilerInner::CleanAndSanitizeStruct(Struct);
			FUserDefinedStructureCompilerInner::InnerCompileStruct(*StructureDescription, GetDefault<UEdGraphSchema_K2>(), MessageLog);

			DependencyMap.RemoveAtSwap(StructureToCompileIndex);

			for (auto EntryIter = DependencyMap.CreateIterator(); EntryIter; ++EntryIter)
			{
				(*EntryIter).StructuresToWaitFor.Remove(Struct);
			}
		}
	}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:71,代码来源:UserDefinedStructureCompilerUtils.cpp

示例15: UpdateHitBoxCandidates

void AHUD::UpdateHitBoxCandidates( TArray<FVector2D> InContactPoints )
{
	HitBoxHits.Reset();
	for (FHUDHitBox& HitBox : HitBoxMap)
	{
		bool bAdded = false;
		for (int32 ContactPointIndex = InContactPoints.Num() - 1; ContactPointIndex >= 0; --ContactPointIndex)
		{
			if (HitBox.Contains(InContactPoints[ContactPointIndex]))
			{
				if (!bAdded)
				{
					HitBoxHits.Add(&HitBox);
					bAdded = true;
				}
				if (HitBox.ConsumesInput())
				{
					InContactPoints.RemoveAtSwap(ContactPointIndex);
				}
				else
				{
					break;
				}
			}
		}
		if (InContactPoints.Num() == 0)
		{
			break;
		}
	}

	TSet<FName> NotOverHitBoxes = HitBoxesOver;
	TArray<FName> NewlyOverHitBoxes;

	// Now figure out which boxes we are over and deal with begin/end cursor over messages 
	for (FHUDHitBox* HitBox : HitBoxHits)
	{
		const FName HitBoxName = HitBox->GetName();
		if (HitBoxesOver.Contains(HitBoxName))
		{
			NotOverHitBoxes.Remove(HitBoxName);
		}
		else
		{
			NewlyOverHitBoxes.AddUnique(HitBoxName);
		}
	}

	// Dispatch the end cursor over messages
	for (const FName HitBoxName : NotOverHitBoxes)
	{
		NotifyHitBoxEndCursorOver(HitBoxName);
		HitBoxesOver.Remove(HitBoxName);
	}

	// Dispatch the newly over hitbox messages
	for (const FName HitBoxName : NewlyOverHitBoxes)
	{
		NotifyHitBoxBeginCursorOver(HitBoxName);
		HitBoxesOver.Add(HitBoxName);
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:62,代码来源:HUD.cpp


注:本文中的TArray::RemoveAtSwap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。