static void AppendFilename(const FString& InFilename, TArray<FString>& OutBeautifiedNames, TArray<FString>& OutTestCommands)
{
	// append the filename to the commands we have passed in
	for(auto Iter(OutBeautifiedNames.CreateIterator()); Iter; Iter++)
	{
		*Iter = FString::Printf(TEXT("%s (%s)"), *InFilename, **Iter);
	}

	for(auto Iter(OutTestCommands.CreateIterator()); Iter; Iter++)
	{
		*Iter += TEXT(" ");
		*Iter += InFilename;
	}
}
Example #2
0
bool UAnimationAsset::ReplaceSkeleton(USkeleton* NewSkeleton, bool bConvertSpaces/*=false*/)
{
	// if it's not same 
	if (NewSkeleton != Skeleton)
	{
		// get all sequences that need to change
		TArray<UAnimSequence*> AnimSeqsToReplace;
		if (UAnimSequence* AnimSequence = Cast<UAnimSequence>(this))
		{
			AnimSeqsToReplace.AddUnique(AnimSequence);
		}
		if (GetAllAnimationSequencesReferred(AnimSeqsToReplace))
		{
			for (auto Iter = AnimSeqsToReplace.CreateIterator(); Iter; ++Iter)
			{
				UAnimSequence* AnimSeq = *Iter;
				if (AnimSeq && AnimSeq->Skeleton != NewSkeleton)
				{
					AnimSeq->RemapTracksToNewSkeleton(NewSkeleton, bConvertSpaces);
				}
			}
		}

		SetSkeleton(NewSkeleton);

		PostEditChange();
		MarkPackageDirty();
		return true;
	}

	return false;
}
void UAnimationGraphSchema::GetStateMachineMenuItems(FGraphContextMenuBuilder& ContextMenuBuilder) const
{
	// Show state machine helpers
	if ((ContextMenuBuilder.FromPin == NULL) || ((ContextMenuBuilder.FromPin->Direction == EGPD_Input) && (ContextMenuBuilder.FromPin->PinType.PinCategory == PC_Float)))
	{
		FString StateCategory(TEXT("State Machines"));

		// Create the additional entries to get state information
		TArray<UAnimStateNode*> States;
		UBlueprint* CurrentBlueprint = FBlueprintEditorUtils::FindBlueprintForGraphChecked(ContextMenuBuilder.CurrentGraph);
		FBlueprintEditorUtils::GetAllNodesOfClass(CurrentBlueprint, /*out*/ States);
	
		for (auto StateIt = States.CreateIterator(); StateIt; ++StateIt)
		{
			UAnimStateNode* StateNode = *StateIt;

			UK2Node_TransitionRuleGetter* NodeTemplate = ContextMenuBuilder.CreateTemplateNode<UK2Node_TransitionRuleGetter>();
			NodeTemplate->AssociatedStateNode = StateNode;
			NodeTemplate->GetterType = ETransitionGetter::ArbitraryState_GetBlendWeight;

			const FString OwnerName = StateNode->GetOuter()->GetName();
			const FString Title = FString::Printf(TEXT("Current %s for state '%s.%s'"), *UK2Node_TransitionRuleGetter::GetFriendlyName(NodeTemplate->GetterType), *OwnerName, *StateNode->GetStateName());

			TSharedPtr<FEdGraphSchemaAction_K2NewNode> Action = FK2ActionMenuBuilder::AddNewNodeAction(ContextMenuBuilder, StateCategory, Title, NodeTemplate->GetTooltip(), 0, NodeTemplate->GetKeywords());
			Action->NodeTemplate = NodeTemplate;
		}
	}
}
Example #4
0
TSharedPtr< FSurvey > FEpicSurvey::GetBranchSurvey( const FString& Filename )
{
	TSharedPtr< FSurvey >* Survey = BranchSurveys.Find(Filename);
	if( Survey == NULL )
	{
		TArray<FCloudFileHeader> Files;
		TitleCloud->GetFileList(Files);
		for( auto FileIt=Files.CreateIterator(); FileIt; ++FileIt )
		{
			if( FileIt->FileName == Filename )
			{
				if( TitleCloud->ReadFile(FileIt->DLName) )
				{
					Survey = BranchSurveys.Find(Filename);
					if( Survey )
					{
						return *Survey;
					}
				}
				return TSharedPtr< FSurvey >();
			}
		}
	}
	return *Survey;
}
Example #5
0
void FSourceControlModule::InitializeSourceControlProviders()
{
	int32 SourceControlCount = IModularFeatures::Get().GetModularFeatureImplementationCount(SourceControlFeatureName);
	if( SourceControlCount > 0 )
	{
		FString PreferredSourceControlProvider = SourceControlSettings.GetProvider();
		TArray<ISourceControlProvider*> Providers = IModularFeatures::Get().GetModularFeatureImplementations<ISourceControlProvider>(SourceControlFeatureName);
		for(auto It(Providers.CreateIterator()); It; It++)
		{ 
			ISourceControlProvider* Provider = *It;
			if(PreferredSourceControlProvider == Provider->GetName().ToString())
			{
				CurrentSourceControlProvider = Provider;
				break;
			}
		}

		// no provider found of this name, default to the first one
		if( CurrentSourceControlProvider == NULL )
		{
			CurrentSourceControlProvider = &DefaultSourceControlProvider;
		}
	}

	check(CurrentSourceControlProvider);

	CurrentSourceControlProvider->Init(false);	// Don't force a connection here, as its synchronous. Let the user establish a connection.
}
Example #6
0
int32 UCollisionProfile::LoadCustomResponses(FCollisionResponseTemplate& Template, const UEnum* CollisionChannelEnum, TArray<FResponseChannel>& CustomResponses) const
{
	int32 NumOfItemsCustomized=0;

	// now loads all custom setups
	for (auto ChannelIter = CustomResponses.CreateIterator(); ChannelIter; ++ChannelIter)
	{
		FResponseChannel& Custom = *ChannelIter;
		bool bValueFound=false;

		int32 EnumIndex = ReturnContainerIndexFromChannelName(Custom.Channel);
		if (EnumIndex != INDEX_NONE)
		{
			// use the enum index to set to response to channel
			Template.ResponseToChannels.EnumArray[EnumIndex] = Custom.Response;
			bValueFound = true;
			++NumOfItemsCustomized;
		}
		else
		{
			// print error
			UE_LOG(LogCollisionProfile, Warning, TEXT("Profile (%s) - Custom Channel Name = \'%s\' hasn't been found"), 
				*Template.Name.ToString(), *Custom.Channel.ToString());
		}
	}

	return (NumOfItemsCustomized == CustomResponses.Num());
}
	void GetLaunchOnDeviceID(FString& OutDeviceID, const FString& InMapName)
	{
		UAutomationTestSettings const* AutomationTestSettings = GetDefault<UAutomationTestSettings>();
		check(AutomationTestSettings);

		OutDeviceID = "None";

		FString LaunchOnDeviceId;
		for (auto LaunchIter = AutomationTestSettings->LaunchOnSettings.CreateConstIterator(); LaunchIter; LaunchIter++)
		{
			FString LaunchOnSettings = LaunchIter->DeviceID;
			FString LaunchOnMap = FPaths::GetBaseFilename(LaunchIter->LaunchOnTestmap.FilePath);
			if (LaunchOnMap.Equals(InMapName))
			{
				// shared devices section
				TSharedPtr<ITargetDeviceServicesModule> TargetDeviceServicesModule = StaticCastSharedPtr<ITargetDeviceServicesModule>(FModuleManager::Get().LoadModule(TEXT("TargetDeviceServices")));
				// for each platform...
				TArray<ITargetDeviceProxyPtr> DeviceProxies;
				TargetDeviceServicesModule->GetDeviceProxyManager()->GetProxies(FName(*LaunchOnSettings), true, DeviceProxies);
				// for each proxy...
				for (auto DeviceProxyIt = DeviceProxies.CreateIterator(); DeviceProxyIt; ++DeviceProxyIt)
				{
					ITargetDeviceProxyPtr DeviceProxy = *DeviceProxyIt;
					if (DeviceProxy->IsConnected())
					{
						OutDeviceID = DeviceProxy->GetTargetDeviceId((FName)*LaunchOnSettings);
						break;
					}
				}
			}
		}
	}
void FKCHandler_ClearDelegate::Compile(FKismetFunctionContext& Context, UEdGraphNode* Node)
{
	UK2Node_BaseMCDelegate* DelegateNode = CastChecked<UK2Node_BaseMCDelegate>(Node);

	UEdGraphPin* SelfPin = CompilerContext.GetSchema()->FindSelfPin(*DelegateNode, EEdGraphPinDirection::EGPD_Input);
	check(SelfPin);

	TArray<UEdGraphPin*> Links = SelfPin->LinkedTo;
	if(!Links.Num())
	{
		Links.Add(SelfPin);
	}

	for (auto NetIt = Links.CreateIterator(); NetIt; ++NetIt)
	{
		UEdGraphPin* NetPin = *NetIt;
		check(NetPin);

		FBlueprintCompiledStatement& AddStatement = Context.AppendStatementForNode(DelegateNode);
		AddStatement.Type = KCST_ClearMulticastDelegate;

		FBPTerminal** VarDelegate = InnerTermMap.Find(FDelegateOwnerId(NetPin, DelegateNode));
		check(VarDelegate && *VarDelegate);
		AddStatement.LHS = *VarDelegate;
	}

	GenerateSimpleThenGoto(Context, *DelegateNode, DelegateNode->FindPin(CompilerContext.GetSchema()->PN_Then));
	FNodeHandlingFunctor::Compile(Context, DelegateNode);
}
void FSequencerActorBindingManager::DeselectAllPuppetObjects()
{
	TArray< AActor* > ActorsToDeselect;

	for( auto MovieSceneIter( InstanceToPuppetObjectsMap.CreateConstIterator() ); MovieSceneIter; ++MovieSceneIter ) 
	{
		const TArray< TSharedRef<FPuppetActorInfo> >& PuppetObjects = MovieSceneIter.Value();

		for( auto PuppetObjectIter( PuppetObjects.CreateConstIterator() ); PuppetObjectIter; ++PuppetObjectIter )
		{
			if( PuppetObjectIter->Get().GetType() == EPuppetObjectType::Actor )
			{
				TSharedRef< FPuppetActorInfo > PuppetActorInfo = StaticCastSharedRef< FPuppetActorInfo >( *PuppetObjectIter );
				AActor* PuppetActor = PuppetActorInfo->PuppetActor.Get();
				if( PuppetActor != NULL )
				{
					ActorsToDeselect.Add( PuppetActor );
				}
			}
		}
	}

	if( ActorsToDeselect.Num() > 0 )
	{
		GEditor->GetSelectedActors()->BeginBatchSelectOperation();
		GEditor->GetSelectedActors()->MarkBatchDirty();
		for( auto ActorIt( ActorsToDeselect.CreateIterator() ); ActorIt; ++ActorIt )
		{
			GEditor->GetSelectedActors()->Deselect( *ActorIt );
		}
		GEditor->GetSelectedActors()->EndBatchSelectOperation();
	}
}
UK2Node_PlayMovieScene* FSequencerActorBindingManager::FindPlayMovieSceneNodeInLevelScript( const UMovieScene* MovieScene ) const
{
	// Grab the world object for this editor
	check( MovieScene != NULL );
	
	// Search all levels in the specified world
	for( TArray<ULevel*>::TConstIterator LevelIter( ActorWorld->GetLevels().CreateConstIterator() ); LevelIter; ++LevelIter )
	{
		auto* Level = *LevelIter;
		if( Level != NULL )
		{
			// We don't want to create a level script if one doesn't exist yet.  We just want to grab the one
			// that we already have, if one exists.
			const bool bDontCreate = true;
			ULevelScriptBlueprint* LSB = Level->GetLevelScriptBlueprint( bDontCreate );
			if( LSB != NULL )
			{
				TArray<UK2Node_PlayMovieScene*> EventNodes;
				FBlueprintEditorUtils::GetAllNodesOfClass( LSB, EventNodes );
				for( auto FoundNodeIter( EventNodes.CreateIterator() ); FoundNodeIter; ++FoundNodeIter )
				{
					UK2Node_PlayMovieScene* FoundNode = *FoundNodeIter;
					if( FoundNode->GetMovieScene() == MovieScene )
					{
						return FoundNode;
					}
				}
			}
		}
	}
	
	return NULL;
}
bool UShooterPersistentUser::IsInvertedYAxisDirty() const
{
	bool bIsDirty = false;
	if (GEngine)
	{
		TArray<APlayerController*> PlayerList;
		GEngine->GetAllLocalPlayerControllers(PlayerList);

		for (auto It = PlayerList.CreateIterator(); It; ++It)
		{
			APlayerController* PC = *It;
			if (!PC || !PC->Player || !PC->PlayerInput)
			{
				continue;
			}

			// Update key bindings for the current user only
			ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PC->Player);
			if(!LocalPlayer || LocalPlayer->ControllerId != UserIndex)
			{
				continue;
			}

			bIsDirty |= PC->PlayerInput->GetInvertAxis("Lookup") != GetInvertedYAxis();
			bIsDirty |= PC->PlayerInput->GetInvertAxis("LookupRate") != GetInvertedYAxis();
		}
	}

	return bIsDirty;
}
void SAnimCurveListRow::OnAnimCurveWeightChanged( float NewWeight )
{
	float NewValidWeight = FMath::Clamp(NewWeight, -MaxMorphWeight, MaxMorphWeight);
	Item->Weight = NewValidWeight;
	Item->bAutoFillData = false;

	TSharedPtr<SAnimCurveViewer> AnimCurveViewer = AnimCurveViewerPtr.Pin();
	if (AnimCurveViewer.IsValid())
	{

		// Add override
		AnimCurveViewer->AddAnimCurveOverride(Item->SmartName.DisplayName, Item->Weight);

		// ...then any selected rows need changing by the same delta
		TArray< TSharedPtr< FDisplayedAnimCurveInfo > > SelectedRows = AnimCurveViewer->AnimCurveListView->GetSelectedItems();
		for (auto ItemIt = SelectedRows.CreateIterator(); ItemIt; ++ItemIt)
		{
			TSharedPtr< FDisplayedAnimCurveInfo > RowItem = (*ItemIt);

			if (RowItem != Item) // Don't do "this" row again if it's selected
			{
				RowItem->Weight = NewValidWeight;
				RowItem->bAutoFillData = false;
				AnimCurveViewer->AddAnimCurveOverride(RowItem->SmartName.DisplayName, RowItem->Weight);
			}
		}

		if(PreviewScenePtr.IsValid())
		{
			PreviewScenePtr.Pin()->InvalidateViews();
		}
	}
}
Example #13
0
void NUTNet::CleanupUnitTestWorlds()
{
	for (auto It=PendingUnitWorldCleanup.CreateIterator(); It; ++It)
	{
		UWorld* CurWorld = *It;

		// Remove the tick-hook, for this world
		int32 TickHookIdx = ActiveTickHooks.IndexOfByPredicate(
			[&CurWorld](const FWorldTickHook* CurTickHook)
			{
				return CurTickHook != NULL && CurTickHook->AttachedWorld == CurWorld;
			});

		if (TickHookIdx != INDEX_NONE)
		{
			ActiveTickHooks.RemoveAt(TickHookIdx);
		}

		GEngine->DestroyWorldContext(CurWorld);
		CurWorld->DestroyWorld(false);
	}

	PendingUnitWorldCleanup.Empty();

	// Immediately garbage collect remaining objects, to finish net driver cleanup
	CollectGarbage(GARBAGE_COLLECTION_KEEPFLAGS, true);
}
	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);
			}
		}
	}
Example #15
0
void FPendingDelete::CheckForReferences()
{
	if ( bReferencesChecked )
	{
		return;
	}

	bReferencesChecked = true;

	// Load the asset registry module
	FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>( TEXT( "AssetRegistry" ) );

	AssetRegistryModule.Get().GetReferencers(Object->GetOutermost()->GetFName(), DiskReferences);

	// Check and see whether we are referenced by any objects that won't be garbage collected (*including* the undo buffer)
	FReferencerInformationList ReferencesIncludingUndo;
	bool bReferencedInMemoryOrUndoStack = IsReferenced(Object, GARBAGE_COLLECTION_KEEPFLAGS, true, &ReferencesIncludingUndo);

	// Determine the in-memory references, *excluding* the undo buffer
	GEditor->Trans->DisableObjectSerialization();
	bIsReferencedInMemoryByNonUndo = IsReferenced(Object, GARBAGE_COLLECTION_KEEPFLAGS, true, &MemoryReferences);
	GEditor->Trans->EnableObjectSerialization();

	// see if this object is the transaction buffer - set a flag so we know we need to clear the undo stack
	const int32 TotalReferenceCount = ReferencesIncludingUndo.ExternalReferences.Num() + ReferencesIncludingUndo.InternalReferences.Num();
	const int32 NonUndoReferenceCount = MemoryReferences.ExternalReferences.Num() + MemoryReferences.InternalReferences.Num();

	bIsReferencedInMemoryByUndo = TotalReferenceCount > NonUndoReferenceCount;

	// If the object itself isn't in the transaction buffer, check to see if it's a Blueprint asset. We might have instances of the
	// Blueprint in the transaction buffer, in which case we also want to both alert the user and clear it prior to deleting the asset.
	if ( !bIsReferencedInMemoryByUndo )
	{
		UBlueprint* Blueprint = Cast<UBlueprint>( Object );
		if ( Blueprint && Blueprint->GeneratedClass )
		{
			TArray<FReferencerInformation> ExternalMemoryReferences = MemoryReferences.ExternalReferences;
			for ( auto RefIt = ExternalMemoryReferences.CreateIterator(); RefIt && !bIsReferencedInMemoryByUndo; ++RefIt )
			{
				FReferencerInformation& RefInfo = *RefIt;
				if ( RefInfo.Referencer->IsA( Blueprint->GeneratedClass ) )
				{
					if ( IsReferenced( RefInfo.Referencer, GARBAGE_COLLECTION_KEEPFLAGS, true, &ReferencesIncludingUndo ) )
					{
						GEditor->Trans->DisableObjectSerialization();

						FReferencerInformationList ReferencesExcludingUndo;
						if ( IsReferenced( RefInfo.Referencer, GARBAGE_COLLECTION_KEEPFLAGS, true, &ReferencesExcludingUndo ) )
						{
							bIsReferencedInMemoryByUndo = ( ReferencesIncludingUndo.InternalReferences.Num() + ReferencesIncludingUndo.ExternalReferences.Num() ) > ( ReferencesExcludingUndo.InternalReferences.Num() + ReferencesExcludingUndo.ExternalReferences.Num() );
						}

						GEditor->Trans->EnableObjectSerialization();
					}
				}
			}
		}
	}
}
void FAssetFixUpRedirectors::DeleteRedirectors(TArray<FRedirectorRefs>& RedirectorsToFix) const
{
	TArray<UObject*> ObjectsToDelete;
	for ( auto RedirectorIt = RedirectorsToFix.CreateIterator(); RedirectorIt; ++RedirectorIt )
	{
		FRedirectorRefs& RedirectorRefs = *RedirectorIt;
		if ( RedirectorRefs.bRedirectorValidForFixup )
		{
			// Add all redirectors found in this package to the redirectors to delete list.
			// All redirectors in this package should be fixed up.
			UPackage* RedirectorPackage = RedirectorRefs.Redirector->GetOutermost();
			TArray<UObject*> AssetsInRedirectorPackage;
			GetObjectsWithOuter(RedirectorPackage, AssetsInRedirectorPackage, /*bIncludeNestedObjects=*/false);
			UMetaData* PackageMetaData = NULL;
			bool bContainsAtLeastOneOtherAsset = false;
			for ( auto ObjIt = AssetsInRedirectorPackage.CreateConstIterator(); ObjIt; ++ObjIt )
			{
				if ( UObjectRedirector* Redirector = Cast<UObjectRedirector>(*ObjIt) )
				{
					Redirector->RemoveFromRoot();
					ObjectsToDelete.Add(Redirector);
				}
				else if ( UMetaData* MetaData = Cast<UMetaData>(*ObjIt) )
				{
					PackageMetaData = MetaData;
				}
				else
				{
					bContainsAtLeastOneOtherAsset = true;
				}
			}

			if ( !bContainsAtLeastOneOtherAsset )
			{
				RedirectorPackage->RemoveFromRoot();
				ULinkerLoad* Linker = ULinkerLoad::FindExistingLinkerForPackage(RedirectorPackage);
				if ( Linker )
				{
					Linker->RemoveFromRoot();
				}

				// @todo we shouldnt be worrying about metadata objects here, ObjectTools::CleanUpAfterSuccessfulDelete should
				if ( PackageMetaData )
				{
					PackageMetaData->RemoveFromRoot();
					ObjectsToDelete.Add(PackageMetaData);
				}
			}

			// This redirector will be deleted, NULL the reference here
			RedirectorRefs.Redirector = NULL;
		}
	}

	if ( ObjectsToDelete.Num() > 0 )
	{
		ObjectTools::DeleteObjects(ObjectsToDelete);
	}
}
Example #17
0
void FAssetFixUpRedirectors::PopulateRedirectorReferencers(TArray<FRedirectorRefs>& RedirectorsToPopulate) const
{
	FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
	for ( auto RedirectorRefsIt = RedirectorsToPopulate.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
	{
		FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
		AssetRegistryModule.Get().GetReferencers(RedirectorRefs.RedirectorPackageName, RedirectorRefs.ReferencingPackageNames);
	}
}
void FOnlineAsyncTaskManager::Tick()
{
	// parallel Q.
	FOnlineAsyncTask* Task = NULL;

	// Tick Online services ( possibly callbacks ). 
	OnlineTick();

	// Tick all the parallel tasks - Tick unrelated tasks together. 

	// Create a copy of existing tasks. 
	TArray<FOnlineAsyncTask*> CopyParallelTasks = ParallelTasks;

	// Iterate. 
	for (auto it = CopyParallelTasks.CreateIterator(); it; ++it)
	{
		Task = *it;
		Task->Tick();

		if (Task->IsDone())
		{
			UE_LOG(LogOnline, Log, TEXT("Async parallel Task '%s' completed in %f seconds with %d (Parallel)"),
				*Task->ToString(),
				Task->GetElapsedTime(),
				Task->WasSuccessful());

			// Task is done, fixup the original parallel task queue. 
			RemoveFromParallelTasks(Task);
			AddToOutQueue(Task);
		}
	}

	// Serial Q.
	if (InQueue.Num() == 0)
		return;

	// Pick up the first element in the queue ( "current task" ). 
	Task = InQueue[0];

	// Needed ?
	if (Task == NULL)
		return;

	Task->Tick();

	if (Task->IsDone())
	{
		UE_LOG(LogOnline, Log, TEXT("Async serial task '%s' completed in %f seconds with %d"),
			*Task->ToString(),
			Task->GetElapsedTime(),
			Task->WasSuccessful());

		// Task is done, remove from the incoming queue and add to the outgoing queue
		PopFromInQueue();
		AddToOutQueue(Task);
	}
}
FString UStringUtilities::JoinStringsWithNewlines(TArray<FString> strings) {
    FString result;
    for ( auto Itr(strings.CreateIterator()); Itr; Itr++ ) {
        result.Append(*Itr);
        if ( Itr + 1 ) {
            result.Append("\n");
        }
    }
    return result;
}
Example #20
0
void FAssetFixUpRedirectors::LoadReferencingPackages(TArray<FRedirectorRefs>& RedirectorsToFix, TArray<UPackage*>& OutReferencingPackagesToSave) const
{
	FScopedSlowTask SlowTask( RedirectorsToFix.Num(), LOCTEXT( "LoadingReferencingPackages", "Loading Referencing Packages..." ) );
	SlowTask.MakeDialog();

	ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();

	// Load all packages that reference each redirector, if possible
	for ( auto RedirectorRefsIt = RedirectorsToFix.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
	{
		SlowTask.EnterProgressFrame(1);

		FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
		if ( ISourceControlModule::Get().IsEnabled() )
		{
			FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(RedirectorRefs.Redirector->GetOutermost(), EStateCacheUsage::Use);
			const bool bValidSCCState = !SourceControlState.IsValid() || SourceControlState->IsAdded() || SourceControlState->IsCheckedOut() || SourceControlState->CanCheckout() || !SourceControlState->IsSourceControlled() || SourceControlState->IsIgnored();

			if ( !bValidSCCState )
			{
				RedirectorRefs.bRedirectorValidForFixup = false;
				RedirectorRefs.FailureReason = LOCTEXT("RedirectorFixupFailed_BadSCC", "Redirector could not be checked out or marked for delete");
			}
		}

		// Load all referencers
		for ( auto PackageNameIt = RedirectorRefs.ReferencingPackageNames.CreateConstIterator(); PackageNameIt; ++PackageNameIt )
		{
			const FString PackageName = (*PackageNameIt).ToString();

			// Find the package in memory. If it is not in memory, try to load it
			UPackage* Package = FindPackage(NULL, *PackageName);
			if ( !Package )
			{
				Package = LoadPackage(NULL, *PackageName, LOAD_None);
			}

			if ( Package )
			{
				if ( Package->PackageFlags & PKG_CompiledIn )
				{
					// This is a script reference
					RedirectorRefs.bRedirectorValidForFixup = false;
					RedirectorRefs.FailureReason = FText::Format(LOCTEXT("RedirectorFixupFailed_CodeReference", "Redirector is referenced by code. Package: {0}"), FText::FromString(PackageName));
				}
				else
				{
					// If we found a valid package, mark it for save
					OutReferencingPackagesToSave.AddUnique(Package);
				}
			}
		}
	}
}
	/**
	 * Takes two blueprints and compares them (as if we were running the in-editor 
	 * diff tool). Any discrepancies between the two graphs will be listed in the DiffsOut array.
	 * 
	 * @param  LhsBlueprint	The baseline blueprint you wish to compare against.
	 * @param  RhsBlueprint	The blueprint you wish to look for changes in.
	 * @param  DiffsOut		An output list that will contain any graph internal differences that were found.
	 * @return True if the two blueprints differ, false if they are identical.
	 */
	static bool DiffBlueprints(UBlueprint* const LhsBlueprint, UBlueprint* const RhsBlueprint, TArray<FDiffSingleResult>& DiffsOut)
	{
		TArray<UEdGraph*> LhsGraphs;
		LhsBlueprint->GetAllGraphs(LhsGraphs);
		TArray<UEdGraph*> RhsGraphs;
		RhsBlueprint->GetAllGraphs(RhsGraphs);

		bool bDiffsFound = false;
		// walk the graphs in the rhs blueprint (because, conceptually, it is the more up to date one)
		for (auto RhsGraphIt(RhsGraphs.CreateIterator()); RhsGraphIt; ++RhsGraphIt)
		{
			UEdGraph* RhsGraph = *RhsGraphIt;
			UEdGraph* LhsGraph = NULL;

			// search for the corresponding graph in the lhs blueprint
			for (auto LhsGraphIt(LhsGraphs.CreateIterator()); LhsGraphIt; ++LhsGraphIt)
			{
				// can't trust the guid until we've done a resave on every asset
				//if ((*LhsGraphIt)->GraphGuid == RhsGraph->GraphGuid)
				
				// name compares is probably sufficient, but just so we don't always do a string compare
				if (((*LhsGraphIt)->GetClass() == RhsGraph->GetClass()) &&
					((*LhsGraphIt)->GetName() == RhsGraph->GetName()))
				{
					LhsGraph = *LhsGraphIt;
					break;
				}
			}

			// if a matching graph wasn't found in the lhs blueprint, then that is a BIG inconsistency
			if (LhsGraph == NULL)
			{
				bDiffsFound = true;
				continue;
			}

			bDiffsFound |= FGraphDiffControl::DiffGraphs(LhsGraph, RhsGraph, DiffsOut);
		}

		return bDiffsFound;
	}
void FSCSEditorViewportClient::BeginTransaction(const FText& Description)
{
	//UE_LOG(LogSCSEditorViewport, Log, TEXT("FSCSEditorViewportClient::BeginTransaction() pre: %s %08x"), SessionName, *((uint32*)&ScopedTransaction));

	if(!ScopedTransaction)
	{
		ScopedTransaction = new FScopedTransaction(Description);

		auto BlueprintEditor = BlueprintEditorPtr.Pin();
		if (BlueprintEditor.IsValid())
		{
			UBlueprint* PreviewBlueprint = BlueprintEditor->GetBlueprintObj();
			if (PreviewBlueprint != nullptr)
			{
				FBlueprintEditorUtils::MarkBlueprintAsModified(PreviewBlueprint);
			}

			TArray<FSCSEditorTreeNodePtrType> SelectedNodes = BlueprintEditor->GetSelectedSCSEditorTreeNodes();
			for(auto SelectedSCSNodeIter(SelectedNodes.CreateIterator()); SelectedSCSNodeIter; ++SelectedSCSNodeIter)
			{
				FSCSEditorTreeNodePtrType Node = *SelectedSCSNodeIter;
				if(Node.IsValid())
				{
					if(USCS_Node* SCS_Node = Node->GetSCSNode())
					{
						SCS_Node->Modify();
					}

					// Modify both the component template and the instance in the preview actor (provided there is one)
					UActorComponent* ComponentTemplate = Node->GetEditableComponentTemplate(PreviewBlueprint);
					if (ComponentTemplate != nullptr)
					{
						ComponentTemplate->SetFlags(RF_Transactional);
						ComponentTemplate->Modify();
					}

					AActor* PreviewActor = GetPreviewActor();
					if (PreviewActor)
					{
						UActorComponent* ComponentPreviewInstance = Node->FindComponentInstanceInActor(PreviewActor);
						if (ComponentPreviewInstance != nullptr)
						{
							ComponentPreviewInstance->SetFlags(RF_Transactional);
							ComponentPreviewInstance->Modify();
						}
					}
				}
			}
		}
	}

	//UE_LOG(LogSCSEditorViewport, Log, TEXT("FSCSEditorViewportClient::BeginTransaction() post: %s %08x"), SessionName, *((uint32*)&ScopedTransaction));
}
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());
		}
	}
}
Example #24
0
void AFastBox::NormalizeWorldSpeed()
{
	Cast<AMazeRunBall>(GetWorld()->GetFirstPlayerController()->GetPawn())->CustomTimeDilation = 1.0f;
	Cast<AMazeRunBall>(GetWorld()->GetFirstPlayerController()->GetPawn())->Music->SetPitchMultiplier(1.0f);
	UGameplayStatics::SetGlobalTimeDilation(this, 1.0f);

	TArray<AActor*> spikes;
	UGameplayStatics::GetAllActorsOfClass(this, ADeathSpike::StaticClass(), spikes);
	for (auto Iter(spikes.CreateIterator()); Iter; Iter++)
	{
		Cast<ADeathSpike>(*Iter)->TimeDilation = 1.0f;
	}
}
Example #25
0
	FA3NodeOptionalPinManager(class UAnimGraphNode_Base* Node, TArray<UEdGraphPin*>* InOldPins)
		: BaseNode(Node)
		, OldPins(InOldPins)
	{
		if (OldPins != NULL)
		{
			for (auto PinIt = OldPins->CreateIterator(); PinIt; ++PinIt)
			{
				UEdGraphPin* Pin = *PinIt;
				OldPinMap.Add(Pin->PinName, Pin);
			}
		}
	}
Example #26
0
FReply SContentReference::OnClickUseButton()
{
	TArray<FAssetData> Objects;

	FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
	ContentBrowserModule.Get().GetSelectedAssets(Objects);

	for(auto It(Objects.CreateIterator());It;++It)
	{
		OnSetReference.ExecuteIfBound(It->GetAsset());
	}
	return FReply::Handled();
}
void ConditionTranslationMetadata( TSharedRef<FLocMetadataValue> MetadataValue )
{
    switch( MetadataValue->Type )
    {
    case ELocMetadataType::String:
    {
        TSharedPtr<FLocMetadataValue> MetadataValuePtr = MetadataValue;
        TSharedPtr<FLocMetadataValueString> MetadataString = StaticCastSharedPtr<FLocMetadataValueString>( MetadataValuePtr );
        MetadataString->SetString( TEXT("") );
    }
    break;

    case ELocMetadataType::Array:
    {
        TArray< TSharedPtr< FLocMetadataValue > > MetadataArray = MetadataValue->AsArray();
        for( auto ArrayIter = MetadataArray.CreateIterator(); ArrayIter; ++ArrayIter )
        {
            TSharedPtr<FLocMetadataValue>& Item = *ArrayIter;
            if( Item.IsValid() )
            {
                ConditionTranslationMetadata( Item.ToSharedRef() );
            }
        }
    }
    break;

    case ELocMetadataType::Object:
    {
        TSharedPtr< FLocMetadataObject > MetadataObject = MetadataValue->AsObject();
        for( auto ValueIter = MetadataObject->Values.CreateConstIterator(); ValueIter; ++ValueIter )
        {
            const FString Name = (*ValueIter).Key;
            TSharedPtr< FLocMetadataValue > Value = (*ValueIter).Value;
            if( Value.IsValid() )
            {
                if( Value->Type == ELocMetadataType::String )
                {
                    MetadataObject->SetStringField( Name, TEXT("") );
                }
                else
                {
                    ConditionTranslationMetadata( Value.ToSharedRef() );
                }
            }
        }
    }

    default:
        break;
    }
}
void UK2Node_TransitionRuleGetter::GetStateSpecificMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar, const UAnimBlueprint* AnimBlueprint) const
{
	TArray<UAnimStateNode*> States;
	FBlueprintEditorUtils::GetAllNodesOfClass(AnimBlueprint, /*out*/ States);

	// Go through all states to generate possible menu actions
	for (auto StateIt = States.CreateIterator(); StateIt; ++StateIt)
	{
		UAnimStateNode* StateNode = *StateIt;

		GetStateSpecificAnimGraphSchemaMenuActions(ActionRegistrar, AnimBlueprint, StateNode);
		GetStateSpecificAnimTransitionSchemaMenuActions(ActionRegistrar, AnimBlueprint, StateNode);
	}
}
Example #29
0
bool FAssetFixUpRedirectors::CheckOutReferencingPackages(TArray<FRedirectorRefs>& RedirectorsToFix, TArray<UPackage*>& InOutReferencingPackagesToSave) const
{
	// Prompt to check out all successfully loaded packages
	bool bUserAcceptedCheckout = true;

	if ( InOutReferencingPackagesToSave.Num() > 0 )
	{
		if ( ISourceControlModule::Get().IsEnabled() )
		{
			TArray<UPackage*> PackagesCheckedOutOrMadeWritable;
			TArray<UPackage*> PackagesNotNeedingCheckout;
			bUserAcceptedCheckout = FEditorFileUtils::PromptToCheckoutPackages( false, InOutReferencingPackagesToSave, &PackagesCheckedOutOrMadeWritable, &PackagesNotNeedingCheckout );
			if ( bUserAcceptedCheckout )
			{
				TArray<UPackage*> PackagesThatCouldNotBeCheckedOut = InOutReferencingPackagesToSave;

				for ( auto PackageIt = PackagesCheckedOutOrMadeWritable.CreateConstIterator(); PackageIt; ++PackageIt )
				{
					PackagesThatCouldNotBeCheckedOut.Remove(*PackageIt);
				}

				for ( auto PackageIt = PackagesNotNeedingCheckout.CreateConstIterator(); PackageIt; ++PackageIt )
				{
					PackagesThatCouldNotBeCheckedOut.Remove(*PackageIt);
				}

				for ( auto PackageIt = PackagesThatCouldNotBeCheckedOut.CreateConstIterator(); PackageIt; ++PackageIt )
				{
					const FName NonCheckedOutPackageName = (*PackageIt)->GetFName();

					for ( auto RedirectorRefsIt = RedirectorsToFix.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
					{
						FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
						if ( RedirectorRefs.ReferencingPackageNames.Contains(NonCheckedOutPackageName) )
						{
							// We did not check out at least one of the packages we needed to. This redirector can not be fixed up.
							RedirectorRefs.FailureReason = FText::Format(LOCTEXT("RedirectorFixupFailed_NotCheckedOut", "Referencing package {0} was not checked out"), FText::FromName(NonCheckedOutPackageName));
							RedirectorRefs.bRedirectorValidForFixup = false;
						}
					}

					InOutReferencingPackagesToSave.Remove(*PackageIt);
				}
			}
		}
	}

	return bUserAcceptedCheckout;
}
bool FAssetTypeActions_Curve::CanReimportCurves( TArray<TWeakObjectPtr<UCurveBase>> Objects )const
{
	for(auto It = Objects.CreateIterator();It;++It)
	{
		auto& Obj = *It;
		if(UCurveBase* Curve = Obj.Get())
		{
			if(!Curve->ImportPath.IsEmpty())
			{
				return true;
			}
		}
	}
	return false;
}