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


C++ TMap::Find方法代码示例

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


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

示例1: CustomizeDetails

void FFoliageTypePaintingCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailLayoutBuilder)
{
    // Hide categories we are not going to customize
    FFoliageTypeCustomizationHelpers::HideFoliageCategory(DetailLayoutBuilder, "Procedural");
    FFoliageTypeCustomizationHelpers::HideFoliageCategory(DetailLayoutBuilder, "Reapply");

    // Show all the properties with a reapply condition or that depend on another variable to be relevant
    TMap<const FName, IDetailPropertyRow*> PropertyRowsByName;
    ShowFoliagePropertiesForCategory(DetailLayoutBuilder, "Painting", PropertyRowsByName);
    ShowFoliagePropertiesForCategory(DetailLayoutBuilder, "Placement", PropertyRowsByName);
    ShowFoliagePropertiesForCategory(DetailLayoutBuilder, "InstanceSettings", PropertyRowsByName);

    // Density adjustment factor should only be visible when reapplying
    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, DensityAdjustmentFactor)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetReapplyModeVisibility)),
            TAttribute<bool>());

    // Set the scale visibility attribute for each axis
    Scaling = DetailLayoutBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UFoliageType, Scaling));
    ReapplyScaling = DetailLayoutBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UFoliageType, ReapplyScaling));
    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, ScaleX)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetScaleVisibility, EAxis::X)),
            TAttribute<bool>());

    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, ScaleY)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetScaleVisibility, EAxis::Y)),
            TAttribute<bool>());

    FFoliageTypeCustomizationHelpers::ModifyFoliagePropertyRow(*PropertyRowsByName.Find(GET_MEMBER_NAME_CHECKED(UFoliageType, ScaleZ)),
            TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FFoliageTypePaintingCustomization::GetScaleVisibility, EAxis::Z)),
            TAttribute<bool>());
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:32,代码来源:FoliageTypePaintingCustomization.cpp

示例2: ReplaceReferredAnimations

void UBlendSpaceBase::ReplaceReferredAnimations(const TMap<UAnimationAsset*, UAnimationAsset*>& ReplacementMap)
{
	Super::ReplaceReferredAnimations(ReplacementMap);

	TArray<FBlendSample> NewSamples;
	for (auto Iter = SampleData.CreateIterator(); Iter; ++Iter)
	{
		FBlendSample& Sample = (*Iter);
		UAnimSequence* Anim = Sample.Animation;

		if ( Anim )
		{
			UAnimSequence* const* ReplacementAsset = (UAnimSequence*const*)ReplacementMap.Find(Anim);
			if(ReplacementAsset)
			{
				Sample.Animation = *ReplacementAsset;
				Sample.Animation->ReplaceReferredAnimations(ReplacementMap);
				NewSamples.Add(Sample);
			}
		}
	}

	if (PreviewBasePose)
	{
		UAnimSequence* const* ReplacementAsset = (UAnimSequence*const*)ReplacementMap.Find(PreviewBasePose);
		if(ReplacementAsset)
		{
			PreviewBasePose = *ReplacementAsset;
			PreviewBasePose->ReplaceReferredAnimations(ReplacementMap);
		}
	}
	
	SampleData = NewSamples;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:34,代码来源:BlendSpaceBase.cpp

示例3: FindNetServiceFunctionById

UFunction* FindNetServiceFunctionById(int16 RPCId)
{
	UFunction** Function = RPCFunctionMap.Find(RPCId);
	if (!Function)
	{
		for (TObjectIterator<UClass> ClassIt; ClassIt; ++ClassIt)
		{
			UClass* Class = *ClassIt;
			if (Class->IsChildOf(AActor::StaticClass())
				&& !(Class->HasAnyClassFlags(CLASS_Abstract | CLASS_Deprecated)))
			{
				for (TFieldIterator<UFunction> FuncIt(Class); FuncIt; ++FuncIt) 
				{
					UFunction* CurFunc = *FuncIt;
					if (CurFunc->RPCId > 0)
					{
						RPCFunctionMap.Add(CurFunc->RPCId, CurFunc);
					}
				}
			}
		}
		
		Function = RPCFunctionMap.Find(RPCId);
	}

	return *Function;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:27,代码来源:OnlineMsgSteam.cpp

示例4: SetupSuppress

	/** 
	 * Called twice typically. Once when a log category is constructed, and then once after we have processed the command line.
	 * The second call is needed to make sure the default is set correctly when it is changed on the command line or config file.
	 **/
	void SetupSuppress(FLogCategoryBase* Destination, FName NameFName)
	{
		// now maybe this was set at boot, in which case we override what it had
		uint8* Boot = BootAssociations.Find(NameFName);
		if (Boot)
		{
			Destination->DefaultVerbosity = *Boot;
			Destination->ResetFromDefault();
		}
		else
		{
			// see if we had a boot global override
			static FName NAME_BootGlobal(TEXT("BootGlobal"));
			Boot = BootAssociations.Find(NAME_BootGlobal);
			if (Boot)
			{
				Destination->DefaultVerbosity = *Boot;
				Destination->ResetFromDefault();
			}
		}
		// store off the last non-zero one for toggle
		checkSlow(!(Destination->Verbosity & ELogVerbosity::BreakOnLog)); // this bit is factored out of this variable, always
		if (Destination->Verbosity)
		{
			// currently on, store this in the pending and clear it
			ToggleAssociations.Add(NameFName, Destination->Verbosity);
		}
	}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:32,代码来源:OutputDevices.cpp

示例5: LoadHeaderPairs

bool FCollection::LoadHeaderPairs(const TMap<FString,FString>& InHeaderPairs)
{
	// These pairs will appeared at the top of the file being loaded
	// First find all the known pairs
	const FString* Version = InHeaderPairs.Find(TEXT("FileVersion"));
	if ( !Version )
	{
		// FileVersion is required
		return false;
	}

	const FString* Type = InHeaderPairs.Find(TEXT("Type"));
	if ( !Type )
	{
		// Type is required
		return false;
	}

	FileVersion = FCString::Atoi(**Version);

	if ( *Type == TEXT("Dynamic") )
	{
		// @todo Set this file up to be dynamic
	}

	return FileVersion > 0;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:27,代码来源:Collection.cpp

示例6: CreatePool

	/**
	 * Create a pool to hold a given function's message buffers
	 * Creates the message prototype and holds it in the never released head of the list
	 * 
	 * @return head of a new linked list for the given function
	 */
	PoolMapping* CreatePool(class UFunction* OwnerFunc)
	{
		TWeakObjectPtr<UFunction> FuncPtr(OwnerFunc);
		PoolMapping* FuncPool = Pool.Find(FuncPtr);
		check(!FuncPool);

		PoolMapping NewPool;
		NewPool.Prototype.OwnerFunc = OwnerFunc;
		NewPool.Prototype.Msg = const_cast<google::protobuf::Message*>(CreateRPCPrototype(OwnerFunc)); 
		Pool.Add(OwnerFunc, NewPool);
		return Pool.Find(OwnerFunc);
	}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:18,代码来源:OnlineMsgSteam.cpp

示例7: SortTriangles_MergeContiguous

void SortTriangles_MergeContiguous( int32 NumTriangles, int32 NumVertices, const FSoftSkinVertex* Vertices, uint32* Indices )
{
	// Build the list of triangle sets
	TArray<uint32> TriSet;
	GetConnectedTriangleSets( NumTriangles, Indices, TriSet );

	// Mapping from triangle set number to the array of indices that make up the contiguous strip.
	TMap<uint32, TArray<uint32> > Strips;

	int32 Index=0;
	for( int32 s=0;s<TriSet.Num();s++ )
	{
		// Store the indices for this triangle in the appropriate contiguous set.
		TArray<uint32>* ThisStrip = Strips.Find(TriSet[s]);
		if( !ThisStrip )
		{
			ThisStrip = &Strips.Add(TriSet[s],TArray<uint32>());
		}

		// Add the three indices for this triangle.
		ThisStrip->Add(Indices[Index++]);
		ThisStrip->Add(Indices[Index++]);
		ThisStrip->Add(Indices[Index++]);
	}

	// Export the indices in the same order.
	Index = 0;
	int32 PrevSet = INDEX_NONE;
	for( int32 s=0;s<TriSet.Num();s++ )
	{
		// The first time we see a triangle in a new set, export all the indices from that set.
		if( TriSet[s] != PrevSet )
		{
			TArray<uint32>* ThisStrip = Strips.Find(TriSet[s]);
			check(ThisStrip);

			if( ThisStrip->Num() > 0 )
			{
				check(Index < NumTriangles*3);
				FMemory::Memcpy( &Indices[Index], &(*ThisStrip)[0], ThisStrip->Num() * sizeof(uint32) );
				Index += ThisStrip->Num();

				// We want to export the whole strip contiguously, so we empty it so we don't export the
				// indices again when we see the same TriSet later.
				ThisStrip->Empty();
			}
		}
		PrevSet = TriSet[s];
	}
	check(Index == NumTriangles*3);
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:51,代码来源:SkeletalMeshSorting.cpp

示例8: ExpandFrontierTowardsTarget

// DEPRECATED
void ADEPRECATED_VolumeAdaptiveBuilder::ExpandFrontierTowardsTarget(UDoNNavigationVolumeComponent* current, UDoNNavigationVolumeComponent* neighbor, DoNNavigation::PriorityQueue<UDoNNavigationVolumeComponent*> &frontier, TMap<UDoNNavigationVolumeComponent*, FVector> &entryPointMap, bool &goalFound, UDoNNavigationVolumeComponent* start, UDoNNavigationVolumeComponent* goal, FVector origin, FVector destination, TMap<UDoNNavigationVolumeComponent*, int>& VolumeVsCostMap, bool DrawDebug, TMap<UDoNNavigationVolumeComponent*, TArray<UDoNNavigationVolumeComponent*>> &PathVolumeSolutionMap)
{		
	if (DrawDebug)
	{		
		DisplayDebugVolume(current, FColor::Red);
		DisplayDebugVolume(neighbor, FColor::Blue);
	}
	float SegmentDist = 0;
	FVector nextEntryPoint;

	TArray<UDoNNavigationVolumeComponent*> PathSolutionSoFar = PathVolumeSolutionMap.FindOrAdd(current);
	
	nextEntryPoint = NavEntryPointsForTraversal(*entryPointMap.Find(current), current, neighbor, SegmentDist, DrawDebug);

	entryPointMap.Add(neighbor, nextEntryPoint);

	if (nextEntryPoint == *entryPointMap.Find(current)) // i.e. no traversal solution exists
	{
		if (DrawDebug)
		{
			DisplayDebugVolume(current, FColor::Red);
			DisplayDebugVolume(neighbor, FColor::Blue);
		}

		UE_LOG(LogTemp, Log, TEXT("Skipping neighbor due to lack of traversal solution"));
		return;
	}

	//int new_cost = *VolumeVsCostMap.Find(current) + graph.cost(current, next);
	int new_cost = *VolumeVsCostMap.Find(current) + SegmentDist;

	if (!VolumeVsCostMap.Contains(neighbor) || new_cost < *VolumeVsCostMap.Find(neighbor))
	{	
		PathSolutionSoFar.Add(neighbor);
		PathVolumeSolutionMap.Add(neighbor, PathSolutionSoFar);
		VolumeVsCostMap.Add(neighbor, new_cost);

		float heuristic = FVector::Dist(nextEntryPoint, destination);
		int priority = new_cost + heuristic;

		if (DrawDebug)
		{
			DrawDebugLine(GetWorld(), nextEntryPoint, destination, FColor::Red, true, -1.f, 0, 10.f);
			FString priorityText = FString::Printf(TEXT("Priority: %d"), priority);
			UE_LOG(LogTemp, Log, TEXT("%s"), *priorityText);
		}			

		frontier.put(neighbor, priority);		
	}
}
开发者ID:Helical-Games,项目名称:DonAINavigation,代码行数:51,代码来源:DEPRECATED_VolumeAdaptiveBuilder.cpp

示例9: Browse

	bool Browse(HWND hWnd)
	{
		// Get the currently bound engine directory for the project
		const FString *RootDir = Installations.Find(Identifier);
		FString EngineRootDir = (RootDir != NULL)? *RootDir : FString();

		// Browse for a new directory
		FString NewEngineRootDir;
		if (!FDesktopPlatformModule::Get()->OpenDirectoryDialog(hWnd, TEXT("Select the Unreal Engine installation to use for this project"), EngineRootDir, NewEngineRootDir))
		{
			return false;
		}

		// Check it's a valid directory
		if (!FPlatformInstallation::NormalizeEngineRootDir(NewEngineRootDir))
		{
			FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, TEXT("The selected directory is not a valid engine installation."), TEXT("Error"));
			return false;
		}

		// Check that it's a registered engine directory
		FString NewIdentifier;
		if (!FDesktopPlatformModule::Get()->GetEngineIdentifierFromRootDir(NewEngineRootDir, NewIdentifier))
		{
			FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, TEXT("Couldn't register engine installation."), TEXT("Error"));
			return false;
		}

		// Update the identifier and return
		Identifier = NewIdentifier;
		return true;
	}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:32,代码来源:WindowsPlatformInstallation.cpp

示例10: RHICreateVertexDeclaration

FVertexDeclarationRHIRef FOpenGLDynamicRHI::RHICreateVertexDeclaration(const FVertexDeclarationElementList& Elements)
{
	// Construct a key from the elements.
	FOpenGLVertexDeclarationKey Key(Elements);

	// Check for a cached vertex declaration.
	FVertexDeclarationRHIRef* VertexDeclarationRefPtr = GOpenGLVertexDeclarationCache.Find(Key);
	if (VertexDeclarationRefPtr == NULL)
	{
		// Create and add to the cache if it doesn't exist.
		VertexDeclarationRefPtr = &GOpenGLVertexDeclarationCache.Add(Key,new FOpenGLVertexDeclaration(Key.VertexElements));
		
		check(VertexDeclarationRefPtr);
		check(IsValidRef(*VertexDeclarationRefPtr));
		FShaderCache::LogVertexDeclaration(Elements, *VertexDeclarationRefPtr);
	}

	// The cached declaration must match the input declaration!
	check(VertexDeclarationRefPtr);
	check(IsValidRef(*VertexDeclarationRefPtr));
	FOpenGLVertexDeclaration* OpenGLVertexDeclaration = (FOpenGLVertexDeclaration*)VertexDeclarationRefPtr->GetReference();
	checkSlow(OpenGLVertexDeclaration->VertexElements == Key.VertexElements);

	return *VertexDeclarationRefPtr;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:25,代码来源:OpenGLVertexDeclaration.cpp

示例11: AddStateWeight

void AddStateWeight(TMap<int32, float>& StateWeightMap, int32 StateIndex, float Weight)
{
	if (!StateWeightMap.Find(StateIndex))
	{
		StateWeightMap.Add(StateIndex) = Weight;
	}
}
开发者ID:mysheng8,项目名称:UnrealEngine,代码行数:7,代码来源:AnimNode_StateMachine.cpp

示例12: GetActiveWeight

bool SAnimCurveListRow::GetActiveWeight(float& OutWeight) const
{
	bool bFoundActive = false;

	// If anim viewer
	TSharedPtr<SAnimCurveViewer> AnimCurveViewer = AnimCurveViewerPtr.Pin();
	if (AnimCurveViewer.IsValid())
	{
		// If anim instance
		UAnimInstance* AnimInstance = PreviewScenePtr.Pin()->GetPreviewMeshComponent()->GetAnimInstance();
		if (AnimInstance)
		{
			// See if curve is in active set, attribute curve should have everything
			TMap<FName, float> CurveList;
			AnimInstance->GetAnimationCurveList(EAnimCurveType::AttributeCurve, CurveList);

			float* CurrentValue = CurveList.Find(Item->SmartName.DisplayName);
			if (CurrentValue)
			{
				OutWeight = *CurrentValue;
				// Remember we found it
				bFoundActive = true;
			}
		}
	}

	return bFoundActive;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:28,代码来源:SAnimCurveViewer.cpp

示例13: GatherStatsEventNode

/** Recursively generates a histogram of nodes and stores their timing in TimingResult. */
static void GatherStatsEventNode(FGPUProfilerEventNode* Node, int32 Depth, TMap<FString, FGPUProfilerEventNodeStats>& EventHistogram)
{
	if (Node->NumDraws > 0 || Node->Children.Num() > 0)
	{
		Node->TimingResult = Node->GetTiming() * 1000.0f;

		FGPUProfilerEventNodeStats* FoundHistogramBucket = EventHistogram.Find(Node->Name);
		if (FoundHistogramBucket)
		{
			FoundHistogramBucket->NumDraws += Node->NumDraws;
			FoundHistogramBucket->NumPrimitives += Node->NumPrimitives;
			FoundHistogramBucket->NumVertices += Node->NumVertices;
			FoundHistogramBucket->TimingResult += Node->TimingResult;
			FoundHistogramBucket->NumEvents++;
		}
		else
		{
			FGPUProfilerEventNodeStats NewNodeStats;
			NewNodeStats.NumDraws = Node->NumDraws;
			NewNodeStats.NumPrimitives = Node->NumPrimitives;
			NewNodeStats.NumVertices = Node->NumVertices;
			NewNodeStats.TimingResult = Node->TimingResult;
			NewNodeStats.NumEvents = 1;
			EventHistogram.Add(Node->Name, NewNodeStats);
		}

		for (int32 ChildIndex = 0; ChildIndex < Node->Children.Num(); ChildIndex++)
		{
			// Traverse children
			GatherStatsEventNode(Node->Children[ChildIndex], Depth + 1, EventHistogram);
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:34,代码来源:GPUProfiler.cpp

示例14: PlatformNameStr

FBlueprintNativeCodeGenManifest& FBlueprintNativeCodeGenModule::GetManifest(const TCHAR* PlatformName)
{
	FString PlatformNameStr(PlatformName);
	TUniquePtr<FBlueprintNativeCodeGenManifest>* Result = Manifests.Find(PlatformNameStr);
	check(Result->IsValid());
	return **Result;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:7,代码来源:BlueprintNativeCodeGenModule.cpp

示例15: GetNewIndexForOldVertIndex

int32 URuntimeMeshLibrary::GetNewIndexForOldVertIndex(const FPositionVertexBuffer* PosBuffer, const FStaticMeshVertexBuffer* VertBuffer, const FColorVertexBuffer* ColorBuffer,
	TMap<int32, int32>& MeshToSectionVertMap, int32 VertexIndex, int32 NumUVChannels, TFunction<int32(FVector Position, FVector TangentX, FVector TangentY, FVector TangentZ)> VertexCreator,
	TFunction<void(int32 VertexIndex, int32 UVIndex, FVector2D UV)> UVSetter, TFunction<void(int32 VertexIndex, FColor Color)> ColorSetter)
{
	int32* FoundIndex = MeshToSectionVertMap.Find(VertexIndex);
	if (FoundIndex != nullptr)
	{
		return *FoundIndex;
	}
	else
	{
		int32 NewVertexIndex = VertexCreator(
			PosBuffer->VertexPosition(VertexIndex),
			VertBuffer->VertexTangentX(VertexIndex),
			VertBuffer->VertexTangentY(VertexIndex),
			VertBuffer->VertexTangentZ(VertexIndex));

		if (ColorBuffer && ColorBuffer->GetNumVertices() > (uint32)NewVertexIndex)
		{
			ColorSetter(NewVertexIndex, ColorBuffer->VertexColor(VertexIndex));
		}

		int32 NumTexCoordsToCopy = FMath::Min(NumUVChannels, (int32)VertBuffer->GetNumTexCoords());
		for (int32 Index = 0; Index < NumTexCoordsToCopy; Index++)
		{
			UVSetter(NewVertexIndex, Index, VertBuffer->GetVertexUV(VertexIndex, Index));
		}

		MeshToSectionVertMap.Add(VertexIndex, NewVertexIndex);
		return NewVertexIndex;
	}
}
开发者ID:Koderz,项目名称:UE4RuntimeMeshComponent,代码行数:32,代码来源:RuntimeMeshLibrary.cpp


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