void NUTUtil::SortUnitTestClassDefList(TArray<UUnitTest*>& InUnitTestClassDefaults) { // @todo #JohnBRefactorLambda: Convert these inline sort functions to lambda's now struct FUnitTestDateSort { FORCEINLINE bool operator()(const UUnitTest& A, const UUnitTest& B) const { return (A.GetUnitTestDate() < B.GetUnitTestDate()); } }; struct FUnitTestTypeDateSort { FUnitTestTypeDateSort(TArray<FString>& InTypeOrder) : TypeOrder(InTypeOrder) { } FORCEINLINE bool operator()(const UUnitTest& A, const UUnitTest& B) const { bool bReturnVal = false; if (TypeOrder.IndexOfByKey(A.GetUnitTestType()) < TypeOrder.IndexOfByKey(B.GetUnitTestType())) { bReturnVal = true; } else if (TypeOrder.IndexOfByKey(A.GetUnitTestType()) == TypeOrder.IndexOfByKey(B.GetUnitTestType()) && A.GetUnitTestDate() < B.GetUnitTestDate()) { bReturnVal = true; } return bReturnVal; } /** The order with which the prioritize types */ TArray<FString> TypeOrder; }; // First reorder the unit test classes by date, then grab the unit test types by date, then group them by type/date TArray<FString> ListTypes; InUnitTestClassDefaults.Sort(FUnitTestDateSort()); for (int i=0; i<InUnitTestClassDefaults.Num(); i++) { ListTypes.AddUnique(InUnitTestClassDefaults[i]->GetUnitTestType()); } // Now sort again, based both on type and date InUnitTestClassDefaults.Sort(FUnitTestTypeDateSort(ListTypes)); }
void SVisualLoggerFilters::OnFiltersChanged() { TArray<FString> EnabledFilters; for (TSharedRef<SFilterWidget> CurrentFilter : Filters) { if (CurrentFilter->IsEnabled()) { EnabledFilters.AddUnique(CurrentFilter->GetFilterName().ToString()); } } FLogVisualizer::Get().GetEvents().OnFiltersChanged.Broadcast(); }
TArray<UObject*> FAssetEditorManager::GetAllEditedAssets() { TArray<UObject*> AllAssets; for (TMultiMap<UObject*, IAssetEditorInstance*>::TIterator It(OpenedAssets); It; ++It) { UObject* Asset = It.Key(); if(Asset != NULL) { AllAssets.AddUnique(Asset); } } return AllAssets; }
void UResMgr::TestAsyncLoad() { if (mAssetLoader == nullptr || mResDB == nullptr) { UE_LOG(ResLogger, Error, TEXT("--- UResMgr::TestAsyncLoad, mAssetLoader == nullptr || mResDB == nullptr")); return; } TArray<FStringAssetReference> objToLoad; for (int32 i = 0; i < mResDB->mMeshList.Num(); ++i) { objToLoad.AddUnique(mResDB->mMeshList[i].mMeshAsset.ToStringReference()); } for (int32 i = 0; i < mResDB->mParticleList.Num(); ++i) { objToLoad.AddUnique(mResDB->mParticleList[i].mParticleAsset.ToStringReference()); } //ÇëÇóÒì²½¼ÓÔØ mAssetLoader->RequestAsyncLoad(objToLoad, FStreamableDelegate::CreateUObject(this, &UResMgr::AsyncCallback)); }
/** * Get all the objects that are part of this transaction. * @param Objects [out] Receives the object list. Previous contents are cleared. */ void FTransaction::GetTransactionObjects(TArray<UObject*>& Objects) { Objects.Empty(); // Just in case. for(int32 i=0; i<Records.Num(); i++) { UObject* obj = Records[i].Object; if(obj) { Objects.AddUnique(obj); } } }
void FIndirectLightingCache::UpdateCacheAllocation( const FBoxSphereBounds& Bounds, int32 BlockSize, bool bOpaqueRelevance, FIndirectLightingCacheAllocation*& Allocation, TMap<FIntVector, FBlockUpdateInfo>& BlocksToUpdate, TArray<FIndirectLightingCacheAllocation*>& TransitionsOverTimeToUpdate) { if (Allocation && Allocation->IsValid()) { FIndirectLightingCacheBlock& Block = FindBlock(Allocation->MinTexel); // Calculate a potentially new min and size based on the current bounds FVector NewMin; FVector NewSize; CalculateBlockPositionAndSize(Bounds, Block.TexelSize, NewMin, NewSize); // If the primitive has moved enough to change its block min and size, we need to interpolate it again if (Allocation->bIsDirty || GCacheUpdateEveryFrame || !Block.Min.Equals(NewMin) || !Block.Size.Equals(NewSize)) { // Update the block and primitive allocation with the new bounds Block.Min = NewMin; Block.Size = NewSize; FVector NewScale; FVector NewAdd; FVector MinUV; FVector MaxUV; CalculateBlockScaleAndAdd(Allocation->MinTexel, Allocation->AllocationTexelSize, NewMin, NewSize, NewScale, NewAdd, MinUV, MaxUV); Allocation->SetParameters(Allocation->MinTexel, Allocation->AllocationTexelSize, NewScale, NewAdd, MinUV, MaxUV, bOpaqueRelevance); BlocksToUpdate.Add(Block.MinTexel, FBlockUpdateInfo(Block, Allocation)); } if ((Allocation->SingleSamplePosition - Allocation->TargetPosition).SizeSquared() > DELTA) { TransitionsOverTimeToUpdate.AddUnique(Allocation); } } else { delete Allocation; Allocation = CreateAllocation(BlockSize, Bounds, bOpaqueRelevance); if (Allocation->IsValid()) { // Must interpolate lighting for this new block BlocksToUpdate.Add(Allocation->MinTexel, FBlockUpdateInfo(VolumeBlocks.FindChecked(Allocation->MinTexel), Allocation)); } } }
void FMessageRouter::DispatchMessage( const IMessageContextRef& Context ) { if (Context->IsValid()) { TArray<IReceiveMessagesPtr> Recipients; // get recipients, either from the context... const TArray<FMessageAddress>& RecipientList = Context->GetRecipients(); if (RecipientList.Num() > 0) { for (int32 Index = 0; Index < RecipientList.Num(); Index++) { IReceiveMessagesPtr Recipient = ActiveRecipients.FindRef(RecipientList[Index]).Pin(); if (Recipient.IsValid()) { Recipients.AddUnique(Recipient); } else { ActiveRecipients.Remove(RecipientList[Index]); } } } // ... or from subscriptions else { FilterSubscriptions(ActiveSubscriptions.FindOrAdd(Context->GetMessageType()), Context, Recipients); FilterSubscriptions(ActiveSubscriptions.FindOrAdd(NAME_All), Context, Recipients); } // dispatch the message for (int32 RecipientIndex = 0; RecipientIndex < Recipients.Num(); RecipientIndex++) { IReceiveMessagesPtr Recipient = Recipients[RecipientIndex]; ENamedThreads::Type RecipientThread = Recipient->GetRecipientThread(); if (RecipientThread == ENamedThreads::AnyThread) { Tracer->TraceDispatchedMessage(Context, Recipient.ToSharedRef(), false); Recipient->ReceiveMessage(Context); Tracer->TraceHandledMessage(Context, Recipient.ToSharedRef()); } else { TGraphTask<FMessageDispatchTask>::CreateTask().ConstructAndDispatchWhenReady(RecipientThread, Context, Recipient, Tracer); } } } }
void UEditorEngine::polySelectZone( UModel* InModel ) { // identify the list of currently selected zones TArray<int32> iZoneList; for( int32 i = 0; i < InModel->Nodes.Num(); i++ ) { FBspNode* Node = &InModel->Nodes[i]; FBspSurf* Poly = &InModel->Surfs[ Node->iSurf ]; if( Poly->PolyFlags & PF_Selected ) { if( Node->iZone[1] != 0 ) { iZoneList.AddUnique( Node->iZone[1] ); //front zone } if( Node->iZone[0] != 0 ) { iZoneList.AddUnique( Node->iZone[0] ); //back zone } } } // select all polys that are match one of the zones identified above for( int32 i = 0; i < InModel->Nodes.Num(); i++ ) { FBspNode* Node = &InModel->Nodes[i]; for( int32 j = 0; j < iZoneList.Num(); j++ ) { if( Node->iZone[1] == iZoneList[j] || Node->iZone[0] == iZoneList[j] ) { FBspSurf* Poly = &InModel->Surfs[ Node->iSurf ]; InModel->ModifySurf( i, 0 ); Poly->PolyFlags |= PF_Selected; } } } }
FVector ASkill::GetGroundLocationBeneathPoint(FVector point) { FHitResult hit; FVector start = point; FVector end = start; end.Z -= 100000.f; //get all game characters and projectiles currently in the world so we can ignore them later TArray<AActor*> ignoredActors; for (TActorIterator<AGameCharacter> chr(GetWorld()); chr; ++chr) ignoredActors.AddUnique(*chr); for (TActorIterator<AProjectile> pro(GetWorld()); pro; ++pro) ignoredActors.AddUnique(*pro); FCollisionQueryParams collisionParams; collisionParams.AddIgnoredActors(ignoredActors); if (GetWorld()->LineTraceSingleByChannel(hit, start, end, ECC_WorldStatic, collisionParams)) return hit.ImpactPoint; else return point; }
void USoundCue::RecursiveFindAllNodes( USoundNode* Node, TArray<class USoundNode*> &OutNodes ) { if( Node ) { OutNodes.AddUnique( Node ); // Recurse. const int32 MaxChildNodes = Node->GetMaxChildNodes(); for( int32 ChildIndex = 0 ; ChildIndex < Node->ChildNodes.Num() && ChildIndex < MaxChildNodes ; ++ChildIndex ) { RecursiveFindAllNodes( Node->ChildNodes[ ChildIndex ], OutNodes ); } } }
void FObjectInstancingGraph::RetrieveObjectInstances( UObject* SearchOuter, TArray<UObject*>& out_Objects ) { if ( HasDestinationRoot() && SearchOuter != NULL && (SearchOuter == DestinationRoot || SearchOuter->IsIn(DestinationRoot)) ) { for ( TMap<UObject*,UObject*>::TIterator It(SourceToDestinationMap); It; ++It ) { UObject* InstancedObject = It.Value(); if ( InstancedObject->GetOuter() == SearchOuter ) { out_Objects.AddUnique(InstancedObject); } } } }
virtual void GetTextureFormats(const UTexture* Texture, TArray<FName>& OutFormats) const { check(Texture); // we remap some of the defaults (with PVRTC and ASTC formats) static FName FormatRemap[][2] = { // Default format: ASTC format: { { FName(TEXT("DXT1")) }, { FName(TEXT("ASTC_RGB")) } }, { { FName(TEXT("DXT5")) }, { FName(TEXT("ASTC_RGBA")) } }, { { FName(TEXT("DXT5n")) }, { FName(TEXT("ASTC_NormalAG")) } }, { { FName(TEXT("BC5")) }, { FName(TEXT("ASTC_NormalRG")) } }, { { FName(TEXT("BC6H")) }, { FName(TEXT("ASTC_RGB")) } }, { { FName(TEXT("BC7")) }, { FName(TEXT("ASTC_RGBAuto")) } }, { { FName(TEXT("AutoDXT")) }, { FName(TEXT("ASTC_RGBAuto")) } }, }; FName TextureFormatName = NAME_None; // forward rendering only needs one channel for shadow maps if (Texture->LODGroup == TEXTUREGROUP_Shadowmap) { TextureFormatName = FName(TEXT("G8")); } // if we didn't assign anything specially, then use the defaults if (TextureFormatName == NAME_None) { TextureFormatName = GetDefaultTextureFormatName(Texture, EngineSettings, false); } // perform any remapping away from defaults bool bFoundRemap = false; for (int32 RemapIndex = 0; RemapIndex < ARRAY_COUNT(FormatRemap); ++RemapIndex) { if (TextureFormatName == FormatRemap[RemapIndex][0]) { // we found a remapping bFoundRemap = true; OutFormats.AddUnique(FormatRemap[RemapIndex][1]); } } // if we didn't already remap above, add it now if (!bFoundRemap) { OutFormats.Add(TextureFormatName); } }
void ABaseCharacter::CheckAttackOverlap(){ //Overlapping actors for each box spawned will be stored here TArray<struct FOverlapResult> OutActorOverlaps; //Hit other actors only once TArray<AActor*> ProcessedActors; //The initial rotation of our box is the same as our character rotation FQuat Rotation = GetTransform().GetRotation(); FVector Start = GetTransform().GetLocation() + Rotation.Rotator().Vector() * 100.0f; FCollisionShape CollisionHitShape; FCollisionQueryParams CollisionParams; //We do not want the character to hit itself, don't store this character in the array, to ignore it's collision CollisionParams.AddIgnoredActor(this); //Set the channels that will respond to the collision FCollisionObjectQueryParams CollisionObjectTypes; CollisionObjectTypes.AddObjectTypesToQuery(ECollisionChannel::ECC_PhysicsBody); CollisionObjectTypes.AddObjectTypesToQuery(ECollisionChannel::ECC_Pawn); //CollisionObjectTypes.AddObjectTypesToQuery(ECollisionChannel::ECC_WorldStatic); // uncomment to enable bashing objects //Create the box and get the overlapping actors CollisionHitShape = FCollisionShape::MakeBox(AttackBox); GetWorld()->OverlapMulti(OutActorOverlaps, Start, Rotation, CollisionHitShape, CollisionParams, CollisionObjectTypes); AActor* ActorToProcess; //Process all hit actors for (int i = 0; i < OutActorOverlaps.Num(); ++i) { ActorToProcess = OutActorOverlaps[i].GetActor(); //We process each actor only once per Attack execution if (ActorToProcess && !ProcessedActors.Contains(ActorToProcess)) { //Add this actor to the array because we are spawning one box per tick and we don't want to hit the same actor twice during the same attack animation ProcessedActors.AddUnique(ActorToProcess); if ( dynamic_cast<APatrollingEnemyCharacter*>(ActorToProcess) ){ APatrollingEnemyCharacter* ennemy = (APatrollingEnemyCharacter*)ActorToProcess; ennemy->OnHit(this); } } } }
TArray<AFlareSpacecraft*> UFlareSpacecraftDockingSystem::GetDockedShips() { TArray<AFlareSpacecraft*> Result; for (int32 i = 0; i < DockingSlots.Num(); i++) { if (DockingSlots[i].Granted && DockingSlots[i].Occupied) { FLOGV("UFlareSpacecraftDockingSystem::GetDockedShips : found valid dock %d", i); Result.AddUnique(DockingSlots[i].Ship); } } return Result; }
TArray< UMovieScene* > FSequencer::GetMovieScenesBeingEdited() { TArray<UMovieScene* > OutMovieScenes; // Get the root movie scene OutMovieScenes.Add( RootMovieSceneInstance->GetMovieScene() ); // Get Sub-MovieScenes for( auto It = MovieSceneSectionToInstanceMap.CreateConstIterator(); It; ++It ) { OutMovieScenes.AddUnique( It.Value()->GetMovieScene() ); } return OutMovieScenes; }
void FProjectManager::GetDefaultEnabledPlugins(TArray<FString>& OutPluginNames, bool bIncludeInstalledPlugins) { // Add all the game plugins and everything marked as enabled by default TArray<FPluginStatus> PluginStatuses = IPluginManager::Get().QueryStatusForAllPlugins(); for(const FPluginStatus& PluginStatus: PluginStatuses) { if(PluginStatus.Descriptor.bEnabledByDefault || PluginStatus.LoadedFrom == EPluginLoadedFrom::GameProject) { if(bIncludeInstalledPlugins || !PluginStatus.Descriptor.bInstalled) { OutPluginNames.AddUnique(PluginStatus.Name); } } } }
void SLargeAssetTypeTreeWidget::GetSelectedAssetTypeClassNames( TArray<FString>& OutAssetTypeClassNames ) const { for (const auto AssetCategory : AssetCategories) { for (const auto AssetType : AssetCategory->Children) { if (AssetType->IsSelected()) { OutAssetTypeClassNames.AddUnique(AssetType->AssetTypeClassName); } } } }
void FShaderType::GetOutdatedTypes(TArray<FShaderType*>& OutdatedShaderTypes, TArray<const FVertexFactoryType*>& OutdatedFactoryTypes) { for(TLinkedList<FShaderType*>::TIterator It(GetTypeList()); It; It.Next()) { FShaderType* Type = *It; for(TMap<FShaderId,FShader*>::TConstIterator ShaderIt(Type->ShaderIdMap);ShaderIt;++ShaderIt) { FShader* Shader = ShaderIt.Value(); const FVertexFactoryParameterRef* VFParameterRef = Shader->GetVertexFactoryParameterRef(); const FSHAHash& SavedHash = Shader->GetHash(); const FSHAHash& CurrentHash = Type->GetSourceHash(); const bool bOutdatedShader = SavedHash != CurrentHash; const bool bOutdatedVertexFactory = VFParameterRef && VFParameterRef->GetVertexFactoryType() && VFParameterRef->GetVertexFactoryType()->GetSourceHash() != VFParameterRef->GetHash(); if (bOutdatedShader) { OutdatedShaderTypes.AddUnique(Shader->Type); } if (bOutdatedVertexFactory) { OutdatedFactoryTypes.AddUnique(VFParameterRef->GetVertexFactoryType()); } } } for (int32 TypeIndex = 0; TypeIndex < OutdatedShaderTypes.Num(); TypeIndex++) { UE_LOG(LogShaders, Warning, TEXT(" Recompiling %s"), OutdatedShaderTypes[TypeIndex]->GetName()); } for (int32 TypeIndex = 0; TypeIndex < OutdatedFactoryTypes.Num(); TypeIndex++) { UE_LOG(LogShaders, Warning, TEXT(" Recompiling %s"), OutdatedFactoryTypes[TypeIndex]->GetName()); } }
void USimpleConstructionScript::GenerateListOfExistingNames(TArray<FName>& CurrentNames) const { TArray<const USCS_Node*> ChildrenNodes = GetAllNodesConst(); const UBlueprintGeneratedClass* OwnerClass = Cast<const UBlueprintGeneratedClass>(GetOuter()); const UBlueprint* Blueprint = Cast<const UBlueprint>(OwnerClass ? OwnerClass->ClassGeneratedBy : NULL); // >>> Backwards Compatibility: VER_UE4_EDITORONLY_BLUEPRINTS if (!Blueprint) { Blueprint = Cast<UBlueprint>(GetOuter()); } // <<< End Backwards Compatibility check(Blueprint); TArray<UObject*> NativeCDOChildren; UClass* FirstNativeClass = FBlueprintEditorUtils::FindFirstNativeClass(Blueprint->ParentClass); GetObjectsWithOuter(FirstNativeClass->GetDefaultObject(), NativeCDOChildren, false); for (UObject* NativeCDOChild : NativeCDOChildren) { CurrentNames.Add(NativeCDOChild->GetFName()); } if (Blueprint->SkeletonGeneratedClass) { // First add the class variables. FBlueprintEditorUtils::GetClassVariableList(Blueprint, CurrentNames, true); // Then the function names. FBlueprintEditorUtils::GetFunctionNameList(Blueprint, CurrentNames); } // And add their names for (int32 NodeIndex = 0; NodeIndex < ChildrenNodes.Num(); ++NodeIndex) { const USCS_Node* ChildNode = ChildrenNodes[NodeIndex]; if (ChildNode) { if (ChildNode->VariableName != NAME_None) { CurrentNames.Add(ChildNode->VariableName); } } } if (GetDefaultSceneRootNode()) { CurrentNames.AddUnique(GetDefaultSceneRootNode()->GetVariableName()); } }
void FFbxImportUIDetails::CollectChildPropertiesRecursive(TSharedPtr<IPropertyHandle> Node, TArray<TSharedPtr<IPropertyHandle>>& OutProperties) { uint32 NodeNumChildren = 0; Node->GetNumChildren(NodeNumChildren); for(uint32 ChildIdx = 0 ; ChildIdx < NodeNumChildren ; ++ChildIdx) { TSharedPtr<IPropertyHandle> ChildHandle = Node->GetChildHandle(ChildIdx); CollectChildPropertiesRecursive(ChildHandle, OutProperties); if(ChildHandle->GetProperty()) { OutProperties.AddUnique(ChildHandle); } } }
bool ADA2UE4Creature::ChangeEYEMatByID(int32 IDCode) { bool IsValid; if (LoadedMeshesDatabase != NULL && LoadedMeshesDatabase->MeshList.Num() >= IDCode) { TArray<FStringAssetReference> ObjToLoad; FStreamableManager& BaseLoader = UDA2UE4Library::GetDA2UE4Data(IsValid)->AssetLoader; EYEMatAssetToLoad = LoadedMeshesDatabase->MeshList[IDCode].MeshMat.ToStringReference(); ObjToLoad.AddUnique(EYEMatAssetToLoad); BaseLoader.RequestAsyncLoad(ObjToLoad, FStreamableDelegate::CreateUObject(this, &ADA2UE4Creature::DoAsyncEYEMatChange)); return true; } return false; }
void FMRUList::InternalReadINI( TArray<FString>& OutItems, const FString& INISection, const FString& INIKeyBase, int32 NumElements ) { // Clear existing items OutItems.Empty(); // Iterate over the maximum number of provided elements for( int32 ItemIdx = 0 ; ItemIdx < NumElements ; ++ItemIdx ) { // Try to find data for a key formed as "INIKeyBaseItemIdx" for the provided INI section. If found, add the data to the output item array. FString CurItem; if ( GConfig->GetString( *INISection, *FString::Printf( TEXT("%s%d"), *INIKeyBase, ItemIdx ), CurItem, GEditorUserSettingsIni ) ) { OutItems.AddUnique( FPaths::ConvertRelativePathToFull(CurItem) ); } } }
/** * Called when a Controller is logout from the game or changes teams. If there is * atleast one teammate left on the team, then the team will continue to be in controll * of the leaving Controllers ControlPoints.If there is no other teammates left on the * team after the player changes teams/logout, then any ControlPoints controlled by the * Controller is set back to Neutral. * @param PS The Controller who is changing teams or is logout. */ void AUTDomGameMode::ClearControl(AUTPlayerState* PS) { TArray<AUTPlayerState*> Pick; uint8 Num, i; // find a teammate if (PS == NULL) { return; } for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator) { AUTPlayerController* NextPlayer = Cast<AUTPlayerController>(*Iterator); AUTPlayerState* TestPS = NextPlayer ? Cast<AUTPlayerState>(NextPlayer->PlayerState) : NULL; if (TestPS != NULL && TestPS != PS && (PS->GetTeamNum() == TestPS->GetTeamNum())) { Pick.AddUnique(TestPS); } } if (Pick.Num() > 0) { Num = FMath::RandHelper(Pick.Num()); if (Pick.IsValidIndex(Num) && Pick[Num] != NULL) { // Give random team mate control over leaving players control points for (i = 0; i < CDomPoints.Num(); i++) { if (CDomPoints[i]->TeamNum != 255 && CDomPoints[i]->ControllingPawn == PS) { CDomPoints[i]->ControllingPawn = Pick[Num]; CDomPoints[i]->UpdateStatus(); } } return; } } // No teammate found, so reset the point to X for (i = 0; i < CDomPoints.Num(); i++) { if (CDomPoints[i]->ControllingPawn == PS) { CDomPoints[i]->ResetPoint(true); } } }
static void AddNamedValue(const FName& ParamName, const EEnvQueryParam::Type& ParamType, float Value, TArray<FEnvNamedValue>& NamedValues, TArray<FName>& RequiredParams) { if (ParamName != NAME_None) { if (!HasNamedValue(ParamName, NamedValues)) { FEnvNamedValue NewValue; NewValue.ParamName = ParamName; NewValue.ParamType = ParamType; NewValue.Value = Value; NamedValues.Add(NewValue); } RequiredParams.AddUnique(ParamName); } }
TArray<const FShaderPipelineType*> FShaderPipelineType::GetShaderPipelineTypesByFilename(const TCHAR* Filename) { TArray<const FShaderPipelineType*> PipelineTypes; for (TLinkedList<FShaderPipelineType*>::TIterator It(FShaderPipelineType::GetTypeList()); It; It.Next()) { auto* PipelineType = *It; for (auto* ShaderType : PipelineType->Stages) { if (FPlatformString::Strcmp(Filename, ShaderType->GetShaderFilename()) == 0) { PipelineTypes.AddUnique(PipelineType); break; } } } return PipelineTypes; }
bool FFeaturePackContentSource::InstallToProject(FString InstallPath) { bool bResult = false; if( IsDataValid() == false ) { UE_LOG(LogFeaturePack, Warning, TEXT("Trying to install invalid pack %s"), *InstallPath); } else { FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>("AssetTools"); TArray<FString> AssetPaths; AssetPaths.Add(FeaturePackPath); TArray<UObject*> ImportedObjects = AssetToolsModule.Get().ImportAssets(AssetPaths, InstallPath ); if( ImportedObjects.Num() == 0 ) { UE_LOG(LogFeaturePack, Warning, TEXT("No objects imported installing pack %s"), *InstallPath); } else { // Save any imported assets. TArray<UPackage*> ToSave; for (auto ImportedObject : ImportedObjects) { ToSave.AddUnique(ImportedObject->GetOutermost()); } FEditorFileUtils::PromptForCheckoutAndSave( ToSave, /*bCheckDirty=*/ false, /*bPromptToSave=*/ false ); bResult = true; // Focus on a specific asset if we want to. if( GetFocusAssetName().IsEmpty() == false ) { UObject* FocusAsset = LoadObject<UObject>(nullptr, *GetFocusAssetName()); if (FocusAsset) { FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>("ContentBrowser"); TArray<UObject*> SyncObjects; SyncObjects.Add(FocusAsset); ContentBrowserModule.Get().SyncBrowserToAssets(SyncObjects); } } } } return bResult; }
void FAxisMappingsNodeBuilder::RemoveAxisMappingGroupButton_OnClick(const FMappingSet MappingSet) { const FScopedTransaction Transaction(LOCTEXT("RemoveAxisMappingGroup_Transaction", "Remove Axis Mapping Group")); TSharedPtr<IPropertyHandleArray> AxisMappingsArrayHandle = AxisMappingsPropertyHandle->AsArray(); TArray<int32> SortedIndices; for (int32 Index = 0; Index < MappingSet.Mappings.Num(); ++Index) { SortedIndices.AddUnique(MappingSet.Mappings[Index]->GetIndexInArray()); } SortedIndices.Sort(); for (int32 Index = SortedIndices.Num() - 1; Index >= 0; --Index) { AxisMappingsArrayHandle->DeleteItem(SortedIndices[Index]); } }
template<typename T> ENGINE_API void USoundCue::RecursiveFindNode( USoundNode* Node, TArray<T*>& OutNodes ) { if( Node ) { // Record the node if it is the desired type if( Node->IsA( T::StaticClass() ) ) { OutNodes.AddUnique( static_cast<T*>( Node ) ); } // Recurse. const int32 MaxChildNodes = Node->GetMaxChildNodes(); for( int32 ChildIndex = 0 ; ChildIndex < Node->ChildNodes.Num() && ChildIndex < MaxChildNodes ; ++ChildIndex ) { RecursiveFindNode<T>( Node->ChildNodes[ ChildIndex ], OutNodes ); } } }
bool GetBoneReductionData( const USkeletalMesh* SkeletalMesh, int32 DesiredLOD, TMap<FBoneIndexType, FBoneIndexType> &OutBonesToReplace ) override { const TArray<FMeshBoneInfo> & RefBoneInfo = SkeletalMesh->RefSkeleton.GetRefBoneInfo(); USkeleton* Skeleton = SkeletalMesh->Skeleton; if (Skeleton) { TArray<FBoneIndexType> BoneIndicesToRemove; // it accumulate from LOD 0 -> LOD N if N+1 is DesiredLOD // since we don't like to keep the bones that weren't included in (LOD-1) for ( int LODIndex=0; LODIndex < DesiredLOD && Skeleton->BoneReductionSettingsForLODs.Num() > LODIndex; ++LODIndex ) { // first gather indices. we don't want to add bones to replace if that "to-be-replace" will be removed as well for (int32 Index = 0; Index < Skeleton->BoneReductionSettingsForLODs[LODIndex].BonesToRemove.Num(); ++Index) { int32 BoneIndex = SkeletalMesh->RefSkeleton.FindBoneIndex(Skeleton->BoneReductionSettingsForLODs[LODIndex].BonesToRemove[Index]); // we don't allow root to be removed if ( BoneIndex > 0 ) { BoneIndicesToRemove.AddUnique(BoneIndex); } } } // now make sure the parent isn't the one to be removed, find the one that won't be removed for (int32 Index = 0; Index < BoneIndicesToRemove.Num(); ++Index) { int32 BoneIndex = BoneIndicesToRemove[Index]; int32 ParentIndex = RefBoneInfo[BoneIndex].ParentIndex; while (BoneIndicesToRemove.Contains(ParentIndex)) { ParentIndex = RefBoneInfo[ParentIndex].ParentIndex; } OutBonesToReplace.Add(BoneIndex, ParentIndex); } } return ( OutBonesToReplace.Num() > 0 ); }
void FGameplayTagQueryExpression::EmitTokens(TArray<uint8>& TokenStream, TArray<FGameplayTag>& TagDictionary) const { // emit exprtype TokenStream.Add(ExprType); // emit exprdata switch (ExprType) { case EGameplayTagQueryExprType::AnyTagsMatch: case EGameplayTagQueryExprType::AllTagsMatch: case EGameplayTagQueryExprType::NoTagsMatch: { // emit tagset uint8 NumTags = (uint8)TagSet.Num(); TokenStream.Add(NumTags); for (auto Tag : TagSet) { int32 TagIdx = TagDictionary.AddUnique(Tag); check(TagIdx <= 254); // we reserve token 255 for internal use, so 254 is max unique tags TokenStream.Add((uint8)TagIdx); } } break; case EGameplayTagQueryExprType::AnyExprMatch: case EGameplayTagQueryExprType::AllExprMatch: case EGameplayTagQueryExprType::NoExprMatch: { // emit tagset uint8 NumExprs = (uint8)ExprSet.Num(); TokenStream.Add(NumExprs); for (auto& E : ExprSet) { E.EmitTokens(TokenStream, TagDictionary); } } break; default: break; } }