本文整理汇总了C++中TMap::FindRef方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::FindRef方法的具体用法?C++ TMap::FindRef怎么用?C++ TMap::FindRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::FindRef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildExecutionRoadmap
void FAnimGraphConnectionDrawingPolicy::BuildExecutionRoadmap()
{
UAnimBlueprint* TargetBP = CastChecked<UAnimBlueprint>(FBlueprintEditorUtils::FindBlueprintForGraphChecked(GraphObj));
UAnimBlueprintGeneratedClass* AnimBlueprintClass = (UAnimBlueprintGeneratedClass*)(*(TargetBP->GeneratedClass));
if (TargetBP->GetObjectBeingDebugged() == NULL)
{
return;
}
TMap<UProperty*, UObject*> PropertySourceMap;
AnimBlueprintClass->GetDebugData().GenerateReversePropertyMap(/*out*/ PropertySourceMap);
FAnimBlueprintDebugData& DebugInfo = AnimBlueprintClass->GetAnimBlueprintDebugData();
for (auto VisitIt = DebugInfo.UpdatedNodesThisFrame.CreateIterator(); VisitIt; ++VisitIt)
{
const FAnimBlueprintDebugData::FNodeVisit& VisitRecord = *VisitIt;
if ((VisitRecord.SourceID >= 0) && (VisitRecord.SourceID < AnimBlueprintClass->AnimNodeProperties.Num()) && (VisitRecord.TargetID >= 0) && (VisitRecord.TargetID < AnimBlueprintClass->AnimNodeProperties.Num()))
{
if (UAnimGraphNode_Base* SourceNode = Cast<UAnimGraphNode_Base>(PropertySourceMap.FindRef(AnimBlueprintClass->AnimNodeProperties[VisitRecord.SourceID])))
{
if (UAnimGraphNode_Base* TargetNode = Cast<UAnimGraphNode_Base>(PropertySourceMap.FindRef(AnimBlueprintClass->AnimNodeProperties[VisitRecord.TargetID])))
{
//@TODO: Extend the rendering code to allow using the recorded blend weight instead of faked exec times
FExecPairingMap& Predecessors = PredecessorNodes.FindOrAdd((UEdGraphNode*)SourceNode);
FTimePair& Timings = Predecessors.FindOrAdd((UEdGraphNode*)TargetNode);
Timings.PredExecTime = 0.0;
Timings.ThisExecTime = VisitRecord.Weight;
}
}
}
}
}
示例2: ReplaceObjects
void SSingleProperty::ReplaceObjects( const TMap<UObject*, UObject*>& OldToNewObjectMap )
{
if( HasValidProperty() )
{
TArray<UObject*> NewObjectList;
bool bObjectsReplaced = false;
// Scan all objects and look for objects which need to be replaced
for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
{
UObject* Replacement = OldToNewObjectMap.FindRef( Itor->Get() );
if( Replacement )
{
bObjectsReplaced = true;
NewObjectList.Add( Replacement );
}
else
{
NewObjectList.Add( Itor->Get() );
}
}
// if any objects were replaced update the observed objects
if( bObjectsReplaced )
{
SetObject( NewObjectList[0] );
}
}
}
示例3: if
AGameplayDebuggerPlayerManager& FGameplayDebuggerModule::GetPlayerManager(UWorld* World)
{
const int32 PurgeInvalidWorldsSize = 5;
if (PlayerManagers.Num() > PurgeInvalidWorldsSize)
{
for (TMap<TWeakObjectPtr<UWorld>, TWeakObjectPtr<AGameplayDebuggerPlayerManager> >::TIterator It(PlayerManagers); It; ++It)
{
if (!It.Key().IsValid())
{
It.RemoveCurrent();
}
else if (!It.Value().IsValid())
{
It.RemoveCurrent();
}
}
}
TWeakObjectPtr<AGameplayDebuggerPlayerManager> Manager = PlayerManagers.FindRef(World);
AGameplayDebuggerPlayerManager* ManagerOb = Manager.Get();
if (ManagerOb == nullptr)
{
ManagerOb = World->SpawnActor<AGameplayDebuggerPlayerManager>();
PlayerManagers.Add(World, ManagerOb);
}
check(ManagerOb);
return *ManagerOb;
}
示例4: LoadAssetRegistry
bool FChunkManifestGenerator::LoadAssetRegistry(const FString& SandboxPath, const TSet<FName>* PackagesToKeep)
{
UE_LOG(LogChunkManifestGenerator, Display, TEXT("Loading asset registry."));
// Load generated registry for each platform
check(Platforms.Num() == 1);
for (auto Platform : Platforms)
{
/*FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
FArchive* AssetRegistryReader = IFileManager::Get().CreateFileReader(*PlatformSandboxPath);*/
FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
FArrayReader FileContents;
if (FFileHelper::LoadFileToArray(FileContents, *PlatformSandboxPath) == false)
{
continue;
}
FArchive* AssetRegistryReader = &FileContents;
TMap<FName, FAssetData*> SavedAssetRegistryData;
TArray<FDependsNode*> DependencyData;
if (AssetRegistryReader)
{
AssetRegistry.LoadRegistryData(*AssetRegistryReader, SavedAssetRegistryData, DependencyData);
}
for (auto& LoadedAssetData : AssetRegistryData)
{
if (PackagesToKeep &&
PackagesToKeep->Contains(LoadedAssetData.PackageName) == false)
{
continue;
}
FAssetData* FoundAssetData = SavedAssetRegistryData.FindRef(LoadedAssetData.ObjectPath);
if ( FoundAssetData )
{
LoadedAssetData.ChunkIDs.Append(FoundAssetData->ChunkIDs);
SavedAssetRegistryData.Remove(LoadedAssetData.ObjectPath);
delete FoundAssetData;
}
}
for (const auto& SavedAsset : SavedAssetRegistryData)
{
if (PackagesToKeep && PackagesToKeep->Contains(SavedAsset.Value->PackageName))
{
AssetRegistryData.Add(*SavedAsset.Value);
}
delete SavedAsset.Value;
}
SavedAssetRegistryData.Empty();
}
return true;
}
示例5: PluralType
FTextFormatArgumentModifier_PluralForm::FTextFormatArgumentModifier_PluralForm(const ETextPluralType InPluralType, const TMap<FTextFormatString, FTextFormat>& InPluralForms, const int32 InLongestPluralFormStringLen, const bool InDoPluralFormsUseFormatArgs)
: PluralType(InPluralType)
, LongestPluralFormStringLen(InLongestPluralFormStringLen)
, bDoPluralFormsUseFormatArgs(InDoPluralFormsUseFormatArgs)
{
static const FTextFormatString ZeroString = FTextFormatString::MakeReference(TEXT("zero"));
static const FTextFormatString OneString = FTextFormatString::MakeReference(TEXT("one"));
static const FTextFormatString TwoString = FTextFormatString::MakeReference(TEXT("two"));
static const FTextFormatString FewString = FTextFormatString::MakeReference(TEXT("few"));
static const FTextFormatString ManyString = FTextFormatString::MakeReference(TEXT("many"));
static const FTextFormatString OtherString = FTextFormatString::MakeReference(TEXT("other"));
CompiledPluralForms[(int32)ETextPluralForm::Zero] = InPluralForms.FindRef(ZeroString);
CompiledPluralForms[(int32)ETextPluralForm::One] = InPluralForms.FindRef(OneString);
CompiledPluralForms[(int32)ETextPluralForm::Two] = InPluralForms.FindRef(TwoString);
CompiledPluralForms[(int32)ETextPluralForm::Few] = InPluralForms.FindRef(FewString);
CompiledPluralForms[(int32)ETextPluralForm::Many] = InPluralForms.FindRef(ManyString);
CompiledPluralForms[(int32)ETextPluralForm::Other] = InPluralForms.FindRef(OtherString);
}
示例6: PostEditUndo
void UActorComponent::PostEditUndo()
{
// Objects marked pending kill don't call PostEditChange() from UObject::PostEditUndo(),
// so they can leave an EditReregisterContexts entry around if they are deleted by an undo action.
if( IsPendingKill() )
{
// The reregister context won't bother attaching components that are 'pending kill'.
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
}
}
else
{
Owner = GetTypedOuter<AActor>();
bCanUseCachedOwner = true;
// Let the component be properly registered, after it was restored.
if (Owner)
{
Owner->AddOwnedComponent(this);
}
TArray<UObject*> Children;
GetObjectsWithOuter(this, Children);
for (UObject* Child : Children)
{
if (UActorComponent* ChildComponent = Cast<UActorComponent>(Child))
{
if (ChildComponent->Owner)
{
ChildComponent->Owner->RemoveOwnedComponent(ChildComponent);
}
ChildComponent->Owner = Owner;
if (Owner)
{
Owner->AddOwnedComponent(ChildComponent);
}
}
}
if (GetWorld())
{
GetWorld()->UpdateActorComponentEndOfFrameUpdateState(this);
}
}
Super::PostEditUndo();
}
示例7: ApplyCustomizedBlocks
void FMultiBox::ApplyCustomizedBlocks()
{
if( IsCustomizable() )
{
CustomizationData->LoadCustomizedBlocks();
// Build a map of commands to existing blocks, we'll try to use existing blocks before creating new ones
TMap< TSharedPtr<const FUICommandInfo>, TSharedPtr<const FMultiBlock> > CommandToBlockMap;
for( int32 BlockIndex = 0; BlockIndex < Blocks.Num(); ++BlockIndex )
{
TSharedPtr<const FMultiBlock> Block = Blocks[BlockIndex];
if( Block->GetAction().IsValid() )
{
CommandToBlockMap.Add( Block->GetAction(), Block );
}
}
// Rebuild the users customized box by executing the transactions the user made to get the
// box to its customized state
for( uint32 TransIndex = 0; TransIndex < CustomizationData->GetNumTransactions(); ++TransIndex )
{
const FCustomBlockTransaction& Transaction = CustomizationData->GetTransaction(TransIndex);
// Try and find the block in the default map;
TSharedPtr<const FMultiBlock> Block = CommandToBlockMap.FindRef( Transaction.Command.Pin() );
if( Transaction.TransactionType == FCustomBlockTransaction::Add )
{
if( !Block.IsValid() )
{
Block = MakeMultiBlockFromCommand( Transaction.Command.Pin(), false );
}
if( Block.IsValid() )
{
Blocks.Insert( Block.ToSharedRef(), FMath::Clamp( Transaction.BlockIndex, 0, Blocks.Num() ) );
}
}
else
{
if( Block.IsValid() )
{
Blocks.Remove( Block.ToSharedRef() );
}
}
}
}
}
示例8: PostEditUndo
void UActorComponent::PostEditUndo()
{
// Objects marked pending kill don't call PostEditChange() from UObject::PostEditUndo(),
// so they can leave an EditReregisterContexts entry around if they are deleted by an undo action.
if( IsPendingKill() )
{
// The reregister context won't bother attaching components that are 'pending kill'.
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
}
}
Super::PostEditUndo();
}
示例9: PostRemovedOldPin
void PostRemovedOldPin(FOptionalPinFromProperty& Record, int32 ArrayIndex, UProperty* Property, uint8* PropertyAddress) const override
{
check(PropertyAddress != NULL);
check(!Record.bShowPin);
if (Record.bCanToggleVisibility && (OldPins != NULL))
{
const FString OldPinName = (ArrayIndex != INDEX_NONE) ? FString::Printf(TEXT("%s_%d"), *(Record.PropertyName.ToString()), ArrayIndex) : Record.PropertyName.ToString();
if (UEdGraphPin* OldPin = OldPinMap.FindRef(OldPinName))
{
// Pin was visible but it's now hidden
// Convert DefaultValue/DefaultValueObject and push back into the struct
FBlueprintEditorUtils::ImportKismetDefaultValueToProperty(OldPin, Property, PropertyAddress, BaseNode);
}
}
}
示例10: FindExistingChunk
bool FDataScannerImpl::FindExistingChunk(const TMap<uint64, TSet<FGuid>>& ChunkLookup, TMap<FGuid, FSHAHash>& ChunkShaHashes, uint64 ChunkHash, const FRollingHash<WindowSize>& RollingHash, FGuid& OutMatchedChunk)
{
FStatsScopedTimer FindTimer(StatFindMatchTime);
bool bFoundChunkMatch = false;
if (ChunkLookup.Contains(ChunkHash))
{
FSHAHash ChunkSha;
RollingHash.GetWindowData().GetShaHash(ChunkSha);
for (FGuid& PotentialMatch : ChunkLookup.FindRef(ChunkHash))
{
// Use sha if we have it
if (ChunkShaHashes.Contains(PotentialMatch))
{
if(ChunkSha == ChunkShaHashes[PotentialMatch])
{
bFoundChunkMatch = true;
OutMatchedChunk = PotentialMatch;
break;
}
}
else
{
// Otherwise compare data
TArray<uint8> SerialBuffer;
FStatsScopedTimer DataMatchTimer(StatDataMatchTime);
FStatsCollector::Accumulate(StatChunkDataChecks, 1);
SerialBuffer.AddUninitialized(WindowSize);
RollingHash.GetWindowData().Serialize(SerialBuffer.GetData());
bool ChunkFound = false;
if (DataMatcher->CompareData(PotentialMatch, ChunkHash, SerialBuffer, ChunkFound))
{
FStatsCollector::Accumulate(StatChunkDataMatches, 1);
ChunkShaHashes.Add(PotentialMatch, ChunkSha);
bFoundChunkMatch = true;
OutMatchedChunk = PotentialMatch;
break;
}
else if(!ChunkFound)
{
FStatsCollector::Accumulate(StatMissingChunks, 1);
}
}
FStatsCollector::Accumulate(StatHashCollisions, 1);
}
}
return bFoundChunkMatch;
}
示例11: GetClassPathRootForModule
FName FNativeClassHierarchy::GetClassPathRootForModule(const FName& InModuleName, const TSet<FName>& InGameModules, const TMap<FName, FName>& InPluginModules)
{
static const FName EngineRootNodeName = "Classes_Engine";
static const FName GameRootNodeName = "Classes_Game";
// Work out which root this class should go under (anything that isn't a game or plugin module goes under engine)
FName RootNodeName = EngineRootNodeName;
if(InGameModules.Contains(InModuleName))
{
RootNodeName = GameRootNodeName;
}
else if(InPluginModules.Contains(InModuleName))
{
const FName PluginName = InPluginModules.FindRef(InModuleName);
RootNodeName = FName(*(FString(TEXT("Classes_")) + PluginName.ToString()));
}
return RootNodeName;
}
示例12: ReplaceObjects
void SDetailsView::ReplaceObjects( const TMap<UObject*, UObject*>& OldToNewObjectMap )
{
TArray< TWeakObjectPtr< UObject > > NewObjectList;
bool bObjectsReplaced = false;
TArray< FObjectPropertyNode* > ObjectNodes;
for(TSharedPtr<FComplexPropertyNode>& RootNode : RootPropertyNodes)
{
PropertyEditorHelpers::CollectObjectNodes(RootNode, ObjectNodes );
}
for( int32 ObjectNodeIndex = 0; ObjectNodeIndex < ObjectNodes.Num(); ++ObjectNodeIndex )
{
FObjectPropertyNode* CurrentNode = ObjectNodes[ObjectNodeIndex];
// Scan all objects and look for objects which need to be replaced
for ( TPropObjectIterator Itor( CurrentNode->ObjectIterator() ); Itor; ++Itor )
{
UObject* Replacement = OldToNewObjectMap.FindRef( Itor->Get() );
if( Replacement && Replacement->GetClass() == Itor->Get()->GetClass() )
{
bObjectsReplaced = true;
if( CurrentNode->IsRootNode() )
{
// Note: only root objects count for the new object list. Sub-Objects (i.e components count as needing to be replaced but they don't belong in the top level object list
NewObjectList.Add( Replacement );
}
}
else if( CurrentNode->IsRootNode() )
{
// Note: only root objects count for the new object list. Sub-Objects (i.e components count as needing to be replaced but they don't belong in the top level object list
NewObjectList.Add( Itor->Get() );
}
}
}
if( bObjectsReplaced )
{
SetObjectArrayPrivate( NewObjectList );
}
}
示例13: PostEditChangeProperty
void UActorComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
}
// The component or its outer could be pending kill when calling PostEditChange when applying a transaction.
// Don't do do a full recreate in this situation, and instead simply detach.
if( IsPendingKill() )
{
// @todo UE4 james should this call UnregsiterComponent instead to remove itself from the RegisteteredComponents array on the owner?
ExecuteUnregisterEvents();
World = NULL;
}
Super::PostEditChangeProperty(PropertyChangedEvent);
}
示例14: ConsolidatedPostEditChange
void UActorComponent::ConsolidatedPostEditChange(const FPropertyChangedEvent& PropertyChangedEvent)
{
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
AActor* MyOwner = GetOwner();
if ( MyOwner && !MyOwner->IsTemplate() && PropertyChangedEvent.ChangeType != EPropertyChangeType::Interactive )
{
MyOwner->RerunConstructionScripts();
}
}
// The component or its outer could be pending kill when calling PostEditChange when applying a transaction.
// Don't do do a full recreate in this situation, and instead simply detach.
if( IsPendingKill() )
{
// @todo UE4 james should this call UnregisterComponent instead to remove itself from the RegisteredComponents array on the owner?
ExecuteUnregisterEvents();
World = NULL;
}
}
示例15: AttachChildActors
void FActorReplacementHelper::AttachChildActors(USceneComponent* RootComponent, const TMap<UObject*, UObject*>& OldToNewInstanceMap)
{
// if we had attached children reattach them now - unless they are already attached
for (FAttachedActorInfo& Info : PendingChildAttachments)
{
// Check for a reinstanced attachment, and redirect to the new instance if found
AActor* NewAttachedActor = Cast<AActor>(OldToNewInstanceMap.FindRef(Info.AttachedActor));
if (NewAttachedActor)
{
Info.AttachedActor = NewAttachedActor;
}
// If this actor is no longer attached to anything, reattach
if (!Info.AttachedActor->IsPendingKill() && Info.AttachedActor->GetAttachParentActor() == nullptr)
{
USceneComponent* ChildRoot = Info.AttachedActor->GetRootComponent();
if (ChildRoot && ChildRoot->AttachParent != RootComponent)
{
ChildRoot->AttachTo(RootComponent, Info.AttachedToSocket, EAttachLocation::KeepWorldPosition);
ChildRoot->UpdateComponentToWorld();
}
}
}
}