本文整理汇总了C++中TMap::CreateConstIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::CreateConstIterator方法的具体用法?C++ TMap::CreateConstIterator怎么用?C++ TMap::CreateConstIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::CreateConstIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CustomizeChildren
void FCameraLensSettingsCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
// Retrieve structure's child properties
uint32 NumChildren;
StructPropertyHandle->GetNumChildren(NumChildren);
TMap<FName, TSharedPtr< IPropertyHandle > > PropertyHandles;
for (uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex)
{
TSharedRef<IPropertyHandle> ChildHandle = StructPropertyHandle->GetChildHandle(ChildIndex).ToSharedRef();
const FName PropertyName = ChildHandle->GetProperty()->GetFName();
PropertyHandles.Add(PropertyName, ChildHandle);
}
// Retrieve special case properties
MinFocalLengthHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraLensSettings, MinFocalLength));
MaxFocalLengthHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraLensSettings, MaxFocalLength));
MinFStopHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraLensSettings, MinFStop));
MaxFStopHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraLensSettings, MaxFStop));
MinFocusDistanceHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraLensSettings, MinimumFocusDistance));
for (auto Iter(PropertyHandles.CreateConstIterator()); Iter; ++Iter)
{
if (Iter.Value() == MinFocusDistanceHandle)
{
// skip showing these in the panel for now, as we don't really use them
continue;
}
IDetailPropertyRow& SettingsRow = ChildBuilder.AddChildProperty(Iter.Value().ToSharedRef());
}
}
示例2: InitSequencePlayer
void UUMGSequencePlayer::InitSequencePlayer( const UWidgetAnimation& InAnimation, UUserWidget& UserWidget )
{
Animation = &InAnimation;
UMovieScene* MovieScene = Animation->MovieScene;
// Cache the time range of the sequence to determine when we stop
TimeRange = MovieScene->GetTimeRange();
RuntimeBindings = NewObject<UMovieSceneBindings>(this);
RuntimeBindings->SetRootMovieScene( MovieScene );
UWidgetTree* WidgetTree = UserWidget.WidgetTree;
TMap<FGuid, TArray<UObject*> > GuidToRuntimeObjectMap;
// Bind to Runtime Objects
for (const FWidgetAnimationBinding& Binding : InAnimation.AnimationBindings)
{
UObject* FoundObject = Binding.FindRuntimeObject( *WidgetTree );
if( FoundObject )
{
TArray<UObject*>& Objects = GuidToRuntimeObjectMap.FindOrAdd(Binding.AnimationGuid);
Objects.Add(FoundObject);
}
}
for( auto It = GuidToRuntimeObjectMap.CreateConstIterator(); It; ++It )
{
RuntimeBindings->AddBinding( It.Key(), It.Value() );
}
}
示例3: GetTrackKeyForTime
void UFaceFXMatineeControl::GetTrackKeyForTime(float InTime, TArray<TPair<int32, const FFaceFXTrackKey*>>& OutResult, TArray<FFaceFXSkelMeshComponentId>* OutNoTracks) const
{
//build a list of all keys for all skelmesh component ids
TMap<int32, TArray<const FFaceFXTrackKey*>> SkelMeshTracks;
TMap<int32, FFaceFXSkelMeshComponentId> SkelMeshIds;
for(const FFaceFXTrackKey& Key : Keys)
{
SkelMeshTracks.FindOrAdd(Key.SkelMeshComponentId.Index).Add(&Key);
if(OutNoTracks && !SkelMeshIds.Contains(Key.SkelMeshComponentId.Index))
{
SkelMeshIds.Add(Key.SkelMeshComponentId.Index, Key.SkelMeshComponentId);
}
}
//then generate the pair results for each skelmesh component
for(auto It = SkelMeshTracks.CreateConstIterator(); It; ++It)
{
const TArray<const FFaceFXTrackKey*>& SkelMeshKeys = It.Value();
const int32 IndexMax = SkelMeshKeys.Num()-1;
int32 Index = INDEX_NONE;
for(; Index < IndexMax && SkelMeshKeys[Index+1]->Time <= InTime; ++Index);
if(Index != INDEX_NONE)
{
OutResult.Add(TPairInitializer<int32, const FFaceFXTrackKey*>(Index, SkelMeshKeys[Index]));
}
else if(OutNoTracks)
{
OutNoTracks->Add(SkelMeshIds.FindChecked(It.Key()));
}
}
}
示例4: GetAlphamapDataToMemory
void UJavascriptEditorLibrary::GetAlphamapDataToMemory(ULandscapeInfo* LandscapeInfo, ULandscapeLayerInfoObject* LayerInfo, int32 MinX, int32 MinY, int32 MaxX, int32 MaxY)
{
if (LayerInfo == nullptr)
{
return;
}
const int32 SizeX = (1 + MaxX - MinX);
const int32 SizeY = (1 + MaxY - MinY);
if (SizeX * SizeY * 1 == FArrayBufferAccessor::GetSize())
{
auto Buffer = (uint8*)FArrayBufferAccessor::GetData();
FAlphamapAccessor<false, false> Accessor(LandscapeInfo, LayerInfo);
TMap<FIntPoint, uint8> Data;
Accessor.GetData(MinX, MinY, MaxX, MaxY, Data);
FMemory::Memzero(Buffer, SizeX * SizeY);
for (auto it = Data.CreateConstIterator(); it; ++it)
{
const auto& Point = it.Key();
Buffer[Point.X + Point.Y * SizeX] = it.Value();
}
}
}
示例5: LoadModulesForProject
bool FProjectManager::LoadModulesForProject( const ELoadingPhase::Type LoadingPhase )
{
DECLARE_SCOPE_CYCLE_COUNTER(TEXT("Loading Game Modules"), STAT_GameModule, STATGROUP_LoadTime);
bool bSuccess = true;
if ( CurrentProject.IsValid() )
{
TMap<FName, EModuleLoadResult> ModuleLoadFailures;
FModuleDescriptor::LoadModulesForPhase(LoadingPhase, CurrentProject->Modules, ModuleLoadFailures);
if ( ModuleLoadFailures.Num() > 0 )
{
FText FailureMessage;
for ( auto FailureIt = ModuleLoadFailures.CreateConstIterator(); FailureIt; ++FailureIt )
{
const EModuleLoadResult FailureReason = FailureIt.Value();
if( FailureReason != EModuleLoadResult::Success )
{
const FText TextModuleName = FText::FromName(FailureIt.Key());
if ( FailureReason == EModuleLoadResult::FileNotFound )
{
FailureMessage = FText::Format( LOCTEXT("PrimaryGameModuleNotFound", "The game module '{0}' could not be found. Please ensure that this module exists and that it is compiled."), TextModuleName );
}
else if ( FailureReason == EModuleLoadResult::FileIncompatible )
{
FailureMessage = FText::Format( LOCTEXT("PrimaryGameModuleIncompatible", "The game module '{0}' does not appear to be up to date. This may happen after updating the engine. Please recompile this module and try again."), TextModuleName );
}
else if ( FailureReason == EModuleLoadResult::FailedToInitialize )
{
FailureMessage = FText::Format( LOCTEXT("PrimaryGameModuleFailedToInitialize", "The game module '{0}' could not be successfully initialized after it was loaded."), TextModuleName );
}
else if ( FailureReason == EModuleLoadResult::CouldNotBeLoadedByOS )
{
FailureMessage = FText::Format( LOCTEXT("PrimaryGameModuleCouldntBeLoaded", "The game module '{0}' could not be loaded. There may be an operating system error or the module may not be properly set up."), TextModuleName );
}
else
{
ensure(0); // If this goes off, the error handling code should be updated for the new enum values!
FailureMessage = FText::Format( LOCTEXT("PrimaryGameModuleGenericLoadFailure", "The game module '{0}' failed to load for an unspecified reason. Please report this error."), TextModuleName );
}
// Just report the first error
break;
}
}
FMessageDialog::Open(EAppMsgType::Ok, FailureMessage);
bSuccess = false;
}
}
return bSuccess;
}
示例6: FixupChildrenOrdering
void FProfilerSample::FixupChildrenOrdering( const TMap<uint32,uint32>& ChildrenOrderingIndices )
{
FIndicesArray ChildrenIndices;
for( auto It = ChildrenOrderingIndices.CreateConstIterator(); It; ++It )
{
ChildrenIndices.Add( _ChildrenIndices[It.Key()] );
}
_ChildrenIndices = ChildrenIndices;
}
示例7: JsonAttributesToUStruct
bool FJsonObjectConverter::JsonAttributesToUStruct(const TMap< FString, TSharedPtr<FJsonValue> >& JsonAttributes, const UStruct* StructDefinition, void* OutStruct, int64 CheckFlags, int64 SkipFlags)
{
if (StructDefinition == FJsonObjectWrapper::StaticStruct())
{
// Just copy it into the object
FJsonObjectWrapper* ProxyObject = (FJsonObjectWrapper *)OutStruct;
ProxyObject->JsonObject = MakeShareable(new FJsonObject());
ProxyObject->JsonObject->Values = JsonAttributes;
return true;
}
// iterate over the struct properties
for(TFieldIterator<UProperty> PropIt(StructDefinition); PropIt; ++PropIt)
{
UProperty* Property = *PropIt;
FString PropertyName = Property->GetName();
// Check to see if we should ignore this property
if (CheckFlags != 0 && !Property->HasAnyPropertyFlags(CheckFlags))
{
continue;
}
if (Property->HasAnyPropertyFlags(SkipFlags))
{
continue;
}
// find a json value matching this property name
TSharedPtr<FJsonValue> JsonValue;
for (auto It = JsonAttributes.CreateConstIterator(); It; ++It)
{
// use case insensitive search sincd FName may change caseing strangely on us
if (PropertyName.Equals(It.Key(), ESearchCase::IgnoreCase))
{
JsonValue = It.Value();
break;
}
}
if (!JsonValue.IsValid() || JsonValue->IsNull())
{
// we allow values to not be found since this mirrors the typical UObject mantra that all the fields are optional when deserializing
continue;
}
void* Value = Property->ContainerPtrToValuePtr<uint8>(OutStruct);
if (!JsonValueToUProperty(JsonValue, Property, Value, CheckFlags, SkipFlags))
{
UE_LOG(LogJson, Error, TEXT("JsonObjectToUStruct - Unable to parse %s.%s from JSON"), *StructDefinition->GetName(), *PropertyName);
return false;
}
}
return true;
}
示例8: UpdateFileStateCache
bool FProvider::UpdateFileStateCache(
const TMap<FString, TArray<FFileRevisionRef> >& InFileRevisionsMap
)
{
for (auto It(InFileRevisionsMap.CreateConstIterator()); It; ++It)
{
FFileStateRef FileState = GetFileStateFromCache(It.Key());
FileState->SetHistory(It.Value());
FileState->SetTimeStamp(FDateTime::Now());
}
return InFileRevisionsMap.Num() > 0;
}
示例9: UpdateCachedLocalizationStates
static bool UpdateCachedLocalizationStates(const TMap<FLocalizationServiceTranslationIdentifier, TSharedRef<FOneSkyLocalizationServiceState, ESPMode::ThreadSafe>, FDefaultSetAllocator, FLocalizationServiceTranslationIdentifierKeyFuncs<TSharedRef<FOneSkyLocalizationServiceState, ESPMode::ThreadSafe>>>& InResults)
{
FOneSkyLocalizationServiceModule& OneSkyLocalizationService = FOneSkyLocalizationServiceModule::Get();
for (auto It = InResults.CreateConstIterator(); It; ++It)
{
TSharedRef<FOneSkyLocalizationServiceState, ESPMode::ThreadSafe> State = OneSkyLocalizationService.GetProvider().GetStateInternal(It.Key());
State->SetState(It.Value()->GetState());
State->SetTranslation(It.Value()->GetTranslationString());
State->TimeStamp = FDateTime::Now();
}
return InResults.Num() > 0;
}
示例10: GatherMods
float FGAEffectModifiersContainer::GatherMods(const FGameplayTagContainer& TagsIn, const TMap<FGAGameEffectHandle, TArray<FGAGameEffectModifier>>& Data)
{
//possible optimization when needed - create separate thread.
float ModifierVal = 0;
float Add = 0;
float Multiply = 1;
float Subtract = 0;
float Divide = 1;
float PercentageAdd = 0;
float PercentageSubtract = 0;
for (auto It = Data.CreateConstIterator(); It; ++It)
{
for (const FGAGameEffectModifier& Test : It->Value)
{
if (TagsIn.MatchesAll(Test.RequiredTags, false))
{
switch (Test.ModType)
{
case EGAAttributeMod::Add:
Add += Test.Value;
break;
case EGAAttributeMod::Multiply:
Multiply += Test.Value;
break;
case EGAAttributeMod::Subtract:
Subtract += Test.Value;
break;
case EGAAttributeMod::Divide:
Divide += Test.Value;
break;
case EGAAttributeMod::PercentageAdd:
PercentageAdd += Test.Value;
break;
case EGAAttributeMod::PercentageSubtract:
PercentageSubtract += Test.Value;
break;
default:
break;
}
}
}
}
ModifierVal = ((Add - Subtract) * Multiply) / Divide;
ModifierVal = ModifierVal + (ModifierVal * PercentageAdd);
ModifierVal = ModifierVal - (ModifierVal * PercentageSubtract);
SCOPE_CYCLE_COUNTER(STAT_GatherModifiers);
return ModifierVal;
}
示例11: SaveRestoreFile
void PackageAutoSaverJson::SaveRestoreFile(const bool bRestoreEnabled, const TMap< TWeakObjectPtr<UPackage>, FString >& DirtyPackages)
{
TSharedPtr<FJsonObject> RootObject = MakeShareable(new FJsonObject);
RootObject->SetBoolField(TagRestoreEnabled, bRestoreEnabled);
TArray< TSharedPtr<FJsonValue> > PackagesThatCanBeRestored;
// Only bother populating the list of packages if the restore is enabled
if(bRestoreEnabled)
{
PackagesThatCanBeRestored.Reserve(DirtyPackages.Num());
// Build up the array of package names with auto-saves that can be restored
for(auto It = DirtyPackages.CreateConstIterator(); It; ++It)
{
const TWeakObjectPtr<UPackage>& Package = It.Key();
const FString& AutoSavePath = It.Value();
UPackage* const PackagePtr = Package.Get();
if(PackagePtr && !AutoSavePath.IsEmpty())
{
const FString& PackagePathName = PackagePtr->GetPathName();
TSharedPtr<FJsonObject> EntryObject = MakeShareable(new FJsonObject);
EntryObject->SetStringField(TagPackagePathName, PackagePathName);
EntryObject->SetStringField(TagAutoSavePath, AutoSavePath);
TSharedPtr<FJsonValue> EntryValue = MakeShareable(new FJsonValueObject(EntryObject));
PackagesThatCanBeRestored.Add(EntryValue);
}
}
}
RootObject->SetArrayField(TagPackages, PackagesThatCanBeRestored);
const FString Filename = GetRestoreFilename(true);
FArchive* const FileAr = IFileManager::Get().CreateFileWriter(*Filename, FILEWRITE_EvenIfReadOnly);
if(FileAr)
{
TSharedRef<FStringWriter> Writer = FStringWriterFactory::Create(FileAr);
FJsonSerializer::Serialize(RootObject.ToSharedRef(), Writer);
FileAr->Close();
}
}
示例12: ReceivedConfigureSpawner
void ANetworkController::ReceivedConfigureSpawner(TMap<FName, msgpack_object*> data) {
const EDirection Direction = (EDirection)data[DIRECTION]->via.i64;
const TArray<int64> Lanes = Unpack<TArray<int64>>(data[LANES]);
const float MinWait = data[MIN_WAIT]->via.f64;
const float MaxWait = data[MAX_WAIT]->via.f64;
const TMap<FName, int64> VehicleTypes = Unpack<TMap<FName, int64>>(data[VEHICLE_TYPES]);
for (TActorIterator<ACVehicleSpawner> ObjIt(GetWorld()); ObjIt; ++ObjIt) {
ACVehicleSpawner* Spawner = *ObjIt;
if (!Lanes.Contains(Spawner->Lane)) {
continue;
}
if (!(Spawner->Direction == Direction)) {
continue;
}
Spawner->Active = true;
Spawner->MaxTimeWait = MaxWait;
Spawner->MinTimeWait = MinWait;
Spawner->VehicleTypes.Empty();
for (auto Iter = VehicleTypes.CreateConstIterator(); Iter; ++Iter) {
EVehicleType VehicleType = EVehicleType::VT_Car;
if (Iter.Key() == CAR) {
VehicleType = EVehicleType::VT_Car;
}
else if (Iter.Key() == SEDAN) {
VehicleType = EVehicleType::VT_Sedan;
}
else if (Iter.Key() == BUS) {
VehicleType = EVehicleType::VT_Bus;
}
else if (Iter.Key() == EMERGENCY) {
VehicleType = EVehicleType::VT_Emergency;
}
else {
check(false);
}
Spawner->VehicleTypes.Add(FVehicleTypeStruct(VehicleType, Iter.Value()));
}
Spawner->TurnBucket();
}
}
示例13: CanAttachComponentsTo
// Determine whether or not scene components in the new object set can be attached to the given scene root component
bool CanAttachComponentsTo(USceneComponent* InRootComponent)
{
check(InRootComponent);
// For each component in the set, check against the given root component and break if we fail to validate
bool bCanAttachToRoot = true;
for (auto NewComponentIt = NewObjectMap.CreateConstIterator(); NewComponentIt && bCanAttachToRoot; ++NewComponentIt)
{
// If this is a scene component, and it does not already have a parent within the set
USceneComponent* SceneComponent = Cast<USceneComponent>(NewComponentIt->Value);
if (SceneComponent != NULL && !ParentMap.Contains(SceneComponent->GetFName()))
{
// Determine if we are allowed to attach the scene component to the given root component
bCanAttachToRoot = InRootComponent->CanAttachAsChild(SceneComponent, NAME_None)
&& SceneComponent->Mobility >= InRootComponent->Mobility
&& ( !InRootComponent->IsEditorOnly() || SceneComponent->IsEditorOnly() );
}
}
return bCanAttachToRoot;
}
示例14: GetHeightmapDataToMemory
void UJavascriptEditorLibrary::GetHeightmapDataToMemory(ULandscapeInfo* LandscapeInfo, int32 MinX, int32 MinY, int32 MaxX, int32 MaxY)
{
const int32 SizeX = (1 + MaxX - MinX);
const int32 SizeY = (1 + MaxY - MinY);
if (SizeX * SizeY * 2 == FArrayBufferAccessor::GetSize())
{
auto Buffer = (uint16*)FArrayBufferAccessor::GetData();
FHeightmapAccessor<false> Accessor(LandscapeInfo);
TMap<FIntPoint, uint16> Data;
Accessor.GetData(MinX, MinY, MaxX, MaxY, Data);
FMemory::Memzero(Buffer, SizeX * SizeY * 2);
for (auto it = Data.CreateConstIterator(); it; ++it)
{
const auto& Point = it.Key();
Buffer[Point.X + Point.Y * SizeX] = it.Value();
}
}
}
示例15: CustomizeChildren
void FCameraFilmbackSettingsCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
// Retrieve structure's child properties
uint32 NumChildren;
StructPropertyHandle->GetNumChildren( NumChildren );
TMap<FName, TSharedPtr< IPropertyHandle > > PropertyHandles;
for( uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex )
{
TSharedRef<IPropertyHandle> ChildHandle = StructPropertyHandle->GetChildHandle( ChildIndex ).ToSharedRef();
const FName PropertyName = ChildHandle->GetProperty()->GetFName();
PropertyHandles.Add(PropertyName, ChildHandle);
}
// Retrieve special case properties
SensorWidthHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraFilmbackSettings, SensorWidth));
SensorHeightHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraFilmbackSettings, SensorHeight));
for( auto Iter(PropertyHandles.CreateConstIterator()); Iter; ++Iter )
{
IDetailPropertyRow& SettingsRow = ChildBuilder.AddChildProperty(Iter.Value().ToSharedRef());
}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:23,代码来源:CameraFilmbackSettingsCustomization.cpp