FString FChunkManifestGenerator::CreateCookerFileOrderString(const TMap<FName, FAssetData*>& InAssetData, const TArray<FName>& InMaps)
{
	FString FileOrderString;
	TArray<FAssetData*> TopLevelNodes;

	for (auto Asset : InAssetData)
	{
		auto PackageName = Asset.Value->PackageName;
		TArray<FName> Referencers;
		AssetRegistry.GetReferencers(PackageName, Referencers);

		bool bIsTopLevel = true;
		bool bIsMap = InMaps.Contains(PackageName);

		if (!bIsMap && Referencers.Num() > 0)
		{
			for (auto ReferencerName : Referencers)
			{
				if (InAssetData.Contains(ReferencerName))
				{
					bIsTopLevel = false;
					break;
				}
			}
		}

		if (bIsTopLevel)
		{
			if (bIsMap)
			{
				TopLevelNodes.Insert(Asset.Value, 0);
			}
			else
			{
				TopLevelNodes.Insert(Asset.Value, TopLevelNodes.Num());
			}
		}
	}

	TArray<FName> FileOrder;
	TArray<FName> EncounteredNames;
	for (auto Asset : TopLevelNodes)
	{
		AddAssetToFileOrderRecursive(Asset, FileOrder, EncounteredNames, InAssetData, InMaps);
	}

	int32 CurrentIndex = 0;
	for (auto PackageName : FileOrder)
	{
		auto Asset = InAssetData[PackageName];
		bool bIsMap = InMaps.Contains(Asset->PackageName);
		auto Filename = FPackageName::LongPackageNameToFilename(Asset->PackageName.ToString(), bIsMap ? FPackageName::GetMapPackageExtension() : FPackageName::GetAssetPackageExtension());

		ConvertFilenameToPakFormat(Filename);
		auto Line = FString::Printf(TEXT("\"%s\" %i\n"), *Filename, CurrentIndex++);
		FileOrderString.Append(Line);
	}

	return FileOrderString;
}
Пример #2
0
bool UUnitTest::ValidateUnitTestSettings(bool bCDOCheck/*=false*/)
{
	bool bSuccess = true;

	// The unit test must specify some ExpectedResult values
	UNIT_ASSERT(ExpectedResult.Num() > 0);


	TArray<EUnitTestVerification> ExpectedResultList;

	ExpectedResult.GenerateValueArray(ExpectedResultList);

	// Unit tests should not expect unreliable results, without being marked as unreliable
	UNIT_ASSERT(!ExpectedResultList.Contains(EUnitTestVerification::VerifiedUnreliable) || bUnreliable);

	// Unit tests should never expect 'needs-update' as a valid unit test result
	// @todo JohnB: It might make sense to allow this in the future, if you want to mark unit tests as 'needs-update' before running,
	//				so that you can skip running those unit tests
	UNIT_ASSERT(!ExpectedResultList.Contains(EUnitTestVerification::VerifiedNeedsUpdate));


	// Every unit test must specify a timeout value
	UNIT_ASSERT(UnitTestTimeout > 0);

	return bSuccess;
}
void FStereoPanoramaManager::PanoramicQuality(const TArray<FString>& Args)
{
	if (Args.Contains(TEXT("preview")))
	{
		UE_LOG(LogStereoPanorama, Display, TEXT(" ... setting 'preview' quality"));

		FStereoPanoramaManager::HorizontalAngularIncrement->Set(TEXT("5"));
		FStereoPanoramaManager::VerticalAngularIncrement->Set(TEXT("60"));
		FStereoPanoramaManager::CaptureHorizontalFOV->Set(TEXT("60"));
		FStereoPanoramaManager::StepCaptureWidth->Set(TEXT("720"));
	}
	else if (Args.Contains(TEXT("average")))
	{
		UE_LOG(LogStereoPanorama, Display, TEXT(" ... setting 'average' quality"));
		
		FStereoPanoramaManager::HorizontalAngularIncrement->Set(TEXT("2"));
		FStereoPanoramaManager::VerticalAngularIncrement->Set(TEXT("30"));
		FStereoPanoramaManager::CaptureHorizontalFOV->Set(TEXT("30"));
		FStereoPanoramaManager::StepCaptureWidth->Set(TEXT("1440"));
	}
	else if (Args.Contains(TEXT("improved")))
	{
		UE_LOG(LogStereoPanorama, Display, TEXT(" ... setting 'improved' quality"));
		
		FStereoPanoramaManager::HorizontalAngularIncrement->Set(TEXT("0.5"));
		FStereoPanoramaManager::VerticalAngularIncrement->Set(TEXT("22.5"));
		FStereoPanoramaManager::CaptureHorizontalFOV->Set(TEXT("22.5"));
		FStereoPanoramaManager::StepCaptureWidth->Set(TEXT("1440"));
	}
	else
	{
		UE_LOG(LogStereoPanorama, Warning, TEXT("No quality setting found; options are 'preview | average | improved'"));
	}
}
Пример #4
0
		virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory)
		{
			FString NewName(FilenameOrDirectory);
			// change the root and rename paths/files
			NewName.RemoveFromStart(SourceRoot);
			NewName = NewName.Replace(TEXT("PLUGIN_NAME"), *PluginName, ESearchCase::CaseSensitive);
			NewName = FPaths::Combine(DestRoot, *NewName);

			if (bIsDirectory)
			{
				// create new directory structure
				if (!PlatformFile.CreateDirectoryTree(*NewName) && !PlatformFile.DirectoryExists(*NewName))
				{
					return false;
				}
			}
			else
			{
				FString NewExt = FPaths::GetExtension(FilenameOrDirectory);

				if (!IgnoredFileTypes.Contains(NewExt))
				{
					// Delete destination file if it exists
					if (PlatformFile.FileExists(*NewName))
					{
						PlatformFile.DeleteFile(*NewName);
					}

					// If file of specified extension - open the file as text and replace PLUGIN_NAME in there before saving
					if (NameReplacementFileTypes.Contains(NewExt))
					{
						FString OutFileContents;
						if (!FFileHelper::LoadFileToString(OutFileContents, FilenameOrDirectory))
						{
							return false;
						}

						OutFileContents = OutFileContents.Replace(TEXT("PLUGIN_NAME"), *PluginName, ESearchCase::CaseSensitive);

						if (!FFileHelper::SaveStringToFile(OutFileContents, *NewName))
						{
							return false;
						}
					}
					else
					{
						// Copy file from source
						if (!PlatformFile.CopyFile(*NewName, FilenameOrDirectory))
						{
							// Not all files could be copied
							return false;
						}
					}
				}
			}
			return true; // continue searching
		}
void FPrimitiveSceneInfo::GatherLightingAttachmentGroupPrimitives(TArray<FPrimitiveSceneInfo*, SceneRenderingAllocator>& OutChildSceneInfos)
{
#if ENABLE_NAN_DIAGNOSTIC
	// local function that returns full name of object
	auto GetObjectName = [](const UPrimitiveComponent* InPrimitive)->FString
	{
		return (InPrimitive) ? InPrimitive->GetFullName() : FString(TEXT("Unknown Object"));
	};

	// verify that the current object has a valid bbox before adding it
	const float& BoundsRadius = this->Proxy->GetBounds().SphereRadius;
	if (ensureMsgf(!FMath::IsNaN(BoundsRadius) && FMath::IsFinite(BoundsRadius),
		TEXT("%s had an ill-formed bbox and was skipped during shadow setup, contact DavidH."), *GetObjectName(this->ComponentForDebuggingOnly)))
	{
		OutChildSceneInfos.Add(this);
	}
	else
	{
		// return, leaving the TArray empty
		return;
	}

#else 
	// add self at the head of this queue
	OutChildSceneInfos.Add(this);
#endif

	if (!LightingAttachmentRoot.IsValid() && Proxy->LightAttachmentsAsGroup())
	{
		const FAttachmentGroupSceneInfo* AttachmentGroup = Scene->AttachmentGroups.Find(PrimitiveComponentId);

		if (AttachmentGroup)
		{
			
			for (int32 ChildIndex = 0, ChildIndexMax = AttachmentGroup->Primitives.Num(); ChildIndex < ChildIndexMax; ChildIndex++)
			{
				FPrimitiveSceneInfo* ShadowChild = AttachmentGroup->Primitives[ChildIndex];
#if ENABLE_NAN_DIAGNOSTIC
				// Only enqueue objects with valid bounds using the normality of the SphereRaduis as criteria.

				const float& ShadowChildBoundsRadius = ShadowChild->Proxy->GetBounds().SphereRadius;

				if (ensureMsgf(!FMath::IsNaN(ShadowChildBoundsRadius) && FMath::IsFinite(ShadowChildBoundsRadius),
					TEXT("%s had an ill-formed bbox and was skipped during shadow setup, contact DavidH."), *GetObjectName(ShadowChild->ComponentForDebuggingOnly)))
				{
					checkSlow(!OutChildSceneInfos.Contains(ShadowChild))
				    OutChildSceneInfos.Add(ShadowChild);
				}
#else
				// enqueue all objects.
				checkSlow(!OutChildSceneInfos.Contains(ShadowChild))
			    OutChildSceneInfos.Add(ShadowChild);
#endif
			}
		}
	}
}
void UAnimGraphNode_BlendListBase::RemovePinsFromOldPins(TArray<UEdGraphPin*>& OldPins, int32 RemovedArrayIndex)
{
	TArray<FString> RemovedPropertyNames;
	TArray<FString> NewPinNames;

	// Store new pin names to compare with old pin names
	for (int32 NewPinIndx = 0; NewPinIndx < Pins.Num(); NewPinIndx++)
	{
		NewPinNames.Add(Pins[NewPinIndx]->PinName);
	}

	// don't know which pins are removed yet so find removed pins comparing NewPins and OldPins
	for (int32 OldPinIdx = 0; OldPinIdx < OldPins.Num(); OldPinIdx++)
	{
		FString& OldPinName = OldPins[OldPinIdx]->PinName;
		if (!NewPinNames.Contains(OldPinName))
		{
			int32 UnderscoreIndex = OldPinName.Find(TEXT("_"));
			if (UnderscoreIndex != INDEX_NONE)
			{
				FString PropertyName = OldPinName.Left(UnderscoreIndex);
				RemovedPropertyNames.Add(PropertyName);
			}
		}
	}

	for (int32 PinIdx = 0; PinIdx < OldPins.Num(); PinIdx++)
	{
		// Separate the pin name into property name and index
		FString PropertyName;
		int32 ArrayIndex = -1;
		FString& OldPinName = OldPins[PinIdx]->PinName;

		int32 UnderscoreIndex = OldPinName.Find(TEXT("_"));
		if (UnderscoreIndex != INDEX_NONE)
		{
			PropertyName = OldPinName.Left(UnderscoreIndex);
			ArrayIndex = FCString::Atoi(*(OldPinName.Mid(UnderscoreIndex + 1)));

			if (RemovedPropertyNames.Contains(PropertyName))
			{
				// if array index is matched, removes pins 
				// and if array index is greater than removed index, decrease index
				if (ArrayIndex == RemovedArrayIndex)
				{
					OldPins.RemoveAt(PinIdx);
					--PinIdx;
				}
				else
					if (ArrayIndex > RemovedArrayIndex)
					{
						OldPinName = FString::Printf(TEXT("%s_%d"), *PropertyName, ArrayIndex - 1);
					}
			}
		}
	}
}
bool UEnvQueryGenerator_PathingGrid::IsNavLocationInPathDistance(const class ARecastNavMesh* NavMesh,
		const struct FNavLocation& NavLocation, const TArray<NavNodeRef>& NodeRefs) const
{
#if ENVQUERY_CLUSTER_SEARCH
	const NavNodeRef ClusterRef = NavMesh->GetClusterRef(NavLocation.NodeRef);
	return NodeRefs.Contains(ClusterRef);
#else
	return NodeRefs.Contains(NavLocation.NodeRef);
#endif
}
Пример #8
0
int32 AMod::GetCost(bool bNeededCost /* = false */, APlayerCharacter* buyer /* = nullptr */)
{
	if (!bNeededCost)
		return cost;
	else
	{
		if (!IsValid(buyer))
			return cost;

		//array of mods we need for this mod
		TArray<TSubclassOf<AMod> > recipeMods;
		GetRecipe(recipeMods);

		//get an array of mods that the character has
		TArray<AMod*> mods = buyer->GetMods();

		//see if they have the correct recipe and enough credits
		int32 neededCredits = cost;
		for (int32 j = 0; j < mods.Num(); j++)
		{
			if (recipeMods.Contains(mods[j]->GetClass()))
				neededCredits -= mods[j]->cost;
		}

		return neededCredits;
	}
}
Пример #9
0
bool FFbxImportUIDetails::IsImportTypeMetaDataValid(EFBXImportType& ImportType, FString& MetaData)
{
	TArray<FString> Types;
	MetaData.ParseIntoArray(&Types, TEXT("|"), 1);
	switch(ImportType)
	{
		case FBXIT_StaticMesh:
			return Types.Contains(TEXT("StaticMesh")) || Types.Contains(TEXT("Mesh"));
		case FBXIT_SkeletalMesh:
			return Types.Contains(TEXT("SkeletalMesh")) || Types.Contains(TEXT("Mesh"));
		case FBXIT_Animation:
			return Types.Contains(TEXT("Animation"));
		default:
			return false;
	}
}
bool PointOverlapsNeighborsAlongCongruentAxes(FVector point, TArray<UDoNNavigationVolumeComponent*> currentVolumeNeighbors, TArray<UDoNNavigationVolumeComponent*> destinationVolumeNeighbors, UDoNNavigationVolumeComponent* destination, bool currentVolOverlapsDestX, bool currentVolOverlapsDestY, bool currentVolOverlapsDestZ)
{
	bool overlaps = false;

	for (UDoNNavigationVolumeComponent* neighbor : currentVolumeNeighbors)
	{
		if (neighbor == destination)
			continue;

		bool overlapsX = PointOverlapsVolumeAxis('X', point, neighbor);
		bool overlapsY = PointOverlapsVolumeAxis('Y', point, neighbor);
		bool overlapsZ = PointOverlapsVolumeAxis('Z', point, neighbor);

		if ((overlapsX == true && currentVolOverlapsDestX == true && overlapsY == true && currentVolOverlapsDestY == true) ||
			(overlapsX == true && currentVolOverlapsDestX == true && overlapsZ == true && currentVolOverlapsDestZ == true) ||
			(overlapsY == true && currentVolOverlapsDestY == true && overlapsZ == true && currentVolOverlapsDestZ == true)
			)
		{
			if (!destinationVolumeNeighbors.Contains(neighbor))
				continue;
			
			/*
			neighbor->ShapeColor = FColor::Red;
			neighbor->SetVisibility(true);
			neighbor->SetHiddenInGame(false);
			*/
			overlaps = true;
			break;
		}		
	}

	return overlaps;
}
Пример #11
0
FGlobalComponentReregisterContext::FGlobalComponentReregisterContext(const TArray<AActor*>& InParentActors)
{
	ActiveGlobalReregisterContextCount++;

	// wait until resources are released
	FlushRenderingCommands();

	// Detach only actor components that are children of the actors list provided
	for(TObjectIterator<UActorComponent> ComponentIt;ComponentIt;++ComponentIt)
	{
		bool bShouldReregister=false;
		UPrimitiveComponent* PrimitiveComponent = Cast<UPrimitiveComponent>(*ComponentIt);
		if (PrimitiveComponent && PrimitiveComponent->ReplacementPrimitive.Get())
		{
			UPrimitiveComponent* ReplacementPrimitive = PrimitiveComponent->ReplacementPrimitive.Get();
			AActor* ParentActor = Cast<AActor>(ReplacementPrimitive->GetOuter());
			if (ParentActor && InParentActors.Contains(ParentActor))
			{
				bShouldReregister = true;
			}
		}
		if( bShouldReregister )
		{
			new(ComponentContexts) FComponentReregisterContext(*ComponentIt);		
		}
	}
}
Пример #12
0
void FAnimationRuntime::ExcludeBonesWithNoParents(const TArray<int32> & BoneIndices, const FReferenceSkeleton& RefSkeleton, TArray<int32> & FilteredRequiredBones)
{
	// Filter list, we only want bones that have their parents present in this array.
	FilteredRequiredBones.Empty(BoneIndices.Num());

	for (int32 Index=0; Index<BoneIndices.Num(); Index++)
	{
		const int32& BoneIndex = BoneIndices[Index];
		// Always add root bone.
		if( BoneIndex == 0 )
		{
			FilteredRequiredBones.Add(BoneIndex);
		}
		else
		{
			const int32 ParentBoneIndex = RefSkeleton.GetParentIndex(BoneIndex);
			if( FilteredRequiredBones.Contains(ParentBoneIndex) )
			{
				FilteredRequiredBones.Add(BoneIndex);
			}
			else
			{
				UE_LOG(LogAnimation, Warning, TEXT("ExcludeBonesWithNoParents: Filtering out bone (%s) since parent (%s) is missing"), 
					*RefSkeleton.GetBoneName(BoneIndex).ToString(), *RefSkeleton.GetBoneName(ParentBoneIndex).ToString());
			}
		}
	}
}
bool FFindStronglyConnected::FindSimpleCycleForComponentInner( TArray<UObject*>& Dest, const TArray<UObject*>& Component, UObject* Node )
{
	Stack.Push(Node);
	TArray<UObject*> Refs;
	Edges.MultiFind(Node, Refs);

	for (int32 Index = 0; Index < Refs.Num(); Index++)
	{
		UObject* Other = Refs[Index];
		if (!Component.Contains(Other))
		{
			continue;
		}
		if (Stack.Contains(Other))
		{
			while (1)
			{
				UObject* Out = Stack.Pop();
				Dest.Add(Out);
				if (Out == Other)
				{
					return true;
				}
			}
		}
		if (FindSimpleCycleForComponentInner(Dest, Component, Other))
		{
			return true;
		}
	}
	check(0);
	return false;
}
Пример #14
0
/** Checks the command line for the presence of switches to indicate running as "dedicated server only" */
int32 CORE_API StaticDedicatedServerCheck()
{
	static int32 HasServerSwitch = -1;
	if (HasServerSwitch == -1)
	{
		const FString CmdLine = FString(FCommandLine::Get()).Trim();
		const TCHAR* TCmdLine = *CmdLine;

		TArray<FString> Tokens;
		TArray<FString> Switches;
		FCommandLine::Parse(TCmdLine, Tokens, Switches);

		HasServerSwitch = (Switches.Contains(TEXT("SERVER")) || Switches.Contains(TEXT("RUN=SERVER"))) ? 1 : 0;
	}
	return HasServerSwitch;
}
Пример #15
0
bool UUnitTest::NotifyConsoleCommandRequest(FString CommandContext, FString Command)
{
	bool bHandled = false;
	static TArray<FString> BadCmds = TArrayBuilder<FString>()
		.Add("exit");

	// Don't execute commands that crash
	if (BadCmds.Contains(Command))
	{
		bHandled = true;

		UNIT_LOG(ELogType::OriginConsole,
					TEXT("Can't execute command '%s', it's in the 'bad commands' list (i.e. probably crashes)"), *Command);
	}

	if (!bHandled)
	{
		if (CommandContext == TEXT("Global"))
		{
			UNIT_LOG_BEGIN(this, ELogType::OriginConsole);
			bHandled = GEngine->Exec(NULL, *Command, *GLog);
			UNIT_LOG_END();
		}
	}

	return bHandled;
}
Пример #16
0
void FBehaviorTreeDebugger::OnActiveNodeChanged(const TArray<uint16>& ActivePath, const TArray<uint16>& PrevStepPath)
{
	bool bShouldPause = false;
	StoppedOnBreakpointExecutionIndex = MAX_uint16;
	
	// breakpoints: check only nodes, that have changed from previous state
	// (e.g. breakpoint on sequence, it would break multiple times for every child
	// but we want only once: when it becomes active)

	for (int32 i = 0; i < ActivePath.Num(); i++)
	{
		const uint16 TestExecutionIndex = ActivePath[i];
		if (!PrevStepPath.Contains(TestExecutionIndex))
		{
			if (ActiveBreakpoints.Contains(TestExecutionIndex))
			{
				bShouldPause = true;
				StoppedOnBreakpointExecutionIndex = TestExecutionIndex;
				break;
			}
		}
	}

	if (bShouldPause)
	{
		PausePlaySession();
	}
}
Пример #17
0
void SDetailsView::RemoveDeletedObjects( const TArray<UObject*>& DeletedObjects )
{
	TArray< TWeakObjectPtr< UObject > > NewObjectList;
	bool bObjectsRemoved = false;

	for(const TSharedPtr<FComplexPropertyNode>& ComplexRootNode : RootPropertyNodes)
	{
		FObjectPropertyNode* RootPropertyNode = ComplexRootNode->AsObjectNode();
		// Scan all objects and look for objects which need to be replaced
		for ( TPropObjectIterator Itor( RootPropertyNode->ObjectIterator() ); Itor; ++Itor )
		{
			if( DeletedObjects.Contains( Itor->Get() ) )
			{
				// An object we had needs to be removed
				bObjectsRemoved = true;
			}
			else
			{
				// If the deleted object list does not contain the current object, its ok to keep it in the list
				NewObjectList.Add( Itor->Get() );
			}
		}
	}

	// if any objects were replaced update the observed objects
	if( bObjectsRemoved )
	{
		SetObjectArrayPrivate( NewObjectList );
	}
}
Пример #18
0
//------------------------------------------------------------------------------
static bool BlueprintActionMenuUtilsImpl::IsUnexposedMemberAction(FBlueprintActionFilter const& Filter, FBlueprintActionInfo& BlueprintAction)
{
	bool bIsFliteredOut = false;

	if (UFunction const* Function = BlueprintAction.GetAssociatedFunction())
	{
		TArray<FString> AllExposedCategories;
		for (TWeakObjectPtr<UObject> Binding : BlueprintAction.GetBindings())
		{
			if (UProperty* Property = Cast<UProperty>(Binding.Get()))
			{
				FString const ExposedCategoryMetadata = Property->GetMetaData(FBlueprintMetadata::MD_ExposeFunctionCategories);
				if (ExposedCategoryMetadata.IsEmpty())
				{
					continue;
				}

				TArray<FString> PropertyExposedCategories;
				ExposedCategoryMetadata.ParseIntoArray(PropertyExposedCategories, TEXT(","), true);
				AllExposedCategories.Append(PropertyExposedCategories);
			}
		}

		FString FunctionCategory = Function->GetMetaData(FBlueprintMetadata::MD_FunctionCategory);
		bIsFliteredOut = !AllExposedCategories.Contains(FunctionCategory);
	}
	return bIsFliteredOut;
}
bool FBuildDataCompactifier::DeleteNonReferencedManifests(TArray<FString>& AllManifests, const TArray<FString>& ManifestsToKeep, TArray<FString>& DeletedManifests, uint64& BytesDeleted) const
{
	if (ManifestsToKeep.Num() == 0)
	{
		return true; // We don't need to delete anything, just return a success response
	}

	for (const auto& Manifest : AllManifests)
	{
		if (!ManifestsToKeep.Contains(Manifest))
		{
			FString LogMsg = FString::Printf(TEXT("Found deleteable manifest file %s"), *Manifest);
			FString ManifestPath = CloudDir / Manifest;

			DeletedManifests.Add(Manifest);
			BytesDeleted += IFileManager::Get().FileSize(*ManifestPath);

			if (!bPreview && !bNoPatchDelete)
			{
				IFileManager::Get().Delete(*ManifestPath);
				if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*ManifestPath))
				{
					// Something went wrong ... the file still exists!
					GLog->Logf(ELogVerbosity::Error, TEXT("Compactify could not delete manifest file %s"), *Manifest);
					return false;
				}
				LogMsg.Append(TEXT(" ... deleted"));
			}
			GLog->Logf(*LogMsg);
		}
	}

	AllManifests = ManifestsToKeep;
	return true; // None of the manifests we need to get rid of still exist, we succeeded
}
Пример #20
0
void SBlutilityShelf::GetFavoriteStatus(const TArray<FAssetData>& AssetList, /*out*/ bool& bAreAnySelected, /*out*/ bool& bAreAllSelected)
{
	TArray<FName> AssetPaths;
	FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
	CollectionManagerModule.Get().GetAssetsInCollection(BlutilityModule::BlutilityShelfCollectionName, ECollectionShareType::CST_Local, /*out*/ AssetPaths);

	bAreAnySelected = false;
	bAreAllSelected = false;

	if (AssetList.Num() > 0)
	{
		bAreAllSelected = true;
		for (auto AssetIt = AssetList.CreateConstIterator(); AssetIt; ++AssetIt)
		{
			const FAssetData& AssetData = *AssetIt;
			if (AssetPaths.Contains(AssetData.ObjectPath))
			{
				bAreAnySelected = true;
			}
			else
			{
				bAreAllSelected = false;
			}
		}
	}
}
Пример #21
0
bool UFaceFXMatineeControl::GetClosestSnapPosition( float InPosition, TArray<int32>& IgnoreKeys, float& OutPosition ) 
{
	if(Keys.Num() == 0)
	{
		return false;
	}
	bool bFoundSnap = false;
	float ClosestSnap = 0.f;
	float ClosestDist = BIG_NUMBER;
	for(int32 i=0; i<Keys.Num(); i++)
	{
		if(!IgnoreKeys.Contains(i))
		{
			float Dist = FMath::Abs( Keys[i].Time - InPosition );
			if(Dist < ClosestDist)
			{
				ClosestSnap = Keys[i].Time;
				ClosestDist = Dist;
				bFoundSnap = true;
			}
		}
	}
	OutPosition = ClosestSnap;
	return bFoundSnap;
}
Пример #22
0
void UEnvQuery::CollectQueryParams(TArray<FEnvNamedValue>& NamedValues) const
{
	TArray<FName> RequiredParams;

	// collect all params
	for (int32 OptionIndex = 0; OptionIndex < Options.Num(); OptionIndex++)
	{
		const UEnvQueryOption* Option = Options[OptionIndex];
		AddNamedValuesFromObject(Option->Generator, NamedValues, RequiredParams);

		for (int32 TestIndex = 0; TestIndex < Option->Tests.Num(); TestIndex++)
		{
			const UEnvQueryTest* TestOb = Option->Tests[TestIndex];
			AddNamedValuesFromObject(TestOb, NamedValues, RequiredParams);
		}
	}

	// remove unnecessary params
	for (int32 ValueIndex = NamedValues.Num() - 1; ValueIndex >= 0; ValueIndex--)
	{
		if (!RequiredParams.Contains(NamedValues[ValueIndex].ParamName))
		{
			NamedValues.RemoveAt(ValueIndex);
		}
	}
}
void FPluginManager::RefreshPluginsList()
{
	// Read a new list of all plugins
	TArray<TSharedRef<FPlugin>> NewPlugins;
	ReadAllPlugins(NewPlugins, PluginDiscoveryPaths);

	// Build a list of filenames for plugins which are enabled, and remove the rest
	TArray<FString> EnabledPluginFileNames;
	for(int32 Idx = 0; Idx < AllPlugins.Num(); Idx++)
	{
		const TSharedRef<FPlugin>& Plugin = AllPlugins[Idx];
		if(Plugin->bEnabled)
		{
			EnabledPluginFileNames.Add(Plugin->FileName);
		}
		else
		{
			AllPlugins.RemoveAt(Idx--);
		}
	}

	// Add all the plugins which aren't already enabled
	for(TSharedRef<FPlugin>& NewPlugin: NewPlugins)
	{
		if(!EnabledPluginFileNames.Contains(NewPlugin->FileName))
		{
			AllPlugins.Add(NewPlugin);
		}
	}
}
Пример #24
0
FExportObjectInnerContext::FExportObjectInnerContext(TArray<UObject*>& ObjsToIgnore)
{
    // For each object . . .
    for (UObject* InnerObj : TObjectRange<UObject>(RF_ClassDefaultObject | RF_PendingKill))
    {
        if (!ObjsToIgnore.Contains(InnerObj))
        {
            UObject* OuterObj = InnerObj->GetOuter();
            if (OuterObj && !OuterObj->IsPendingKill())
            {
                InnerList* Inners = ObjectToInnerMap.Find(OuterObj);
                if (Inners)
                {
                    // Add object to existing inner list.
                    Inners->Add(InnerObj);
                }
                else
                {
                    // Create a new inner list for the outer object.
                    InnerList& InnersForOuterObject = ObjectToInnerMap.Add(OuterObj, InnerList());
                    InnersForOuterObject.Add(InnerObj);
                }
            }
        }
    }
}
ELightInteractionType FLightCacheInterface::GetStaticInteraction(const FLightSceneProxy* LightSceneProxy, const TArray<FGuid>& IrrelevantLights) const
{
	ELightInteractionType Ret = LIT_MAX;

	// Check if the light has static lighting or shadowing.
	// This directly accesses the component's static lighting with the assumption that it won't be changed without synchronizing with the rendering thread.
	if(LightSceneProxy->HasStaticShadowing())
	{
		const FGuid LightGuid = LightSceneProxy->GetLightGuid();

		// this code was unified, in some place IrrelevantLights was checked after LightMap and ShadowMap
		if(IrrelevantLights.Contains(LightGuid))
		{
			Ret = LIT_CachedIrrelevant;
		}
		else if(LightMap && LightMap->ContainsLight(LightGuid))
		{
			Ret = LIT_CachedLightMap;
		}
		else if(ShadowMap && ShadowMap->ContainsLight(LightGuid))
		{
			Ret = LIT_CachedSignedDistanceFieldShadowMap2D;
		}
	}

	return Ret;
}
bool UAblAbilityTaskDependencyValidator::HasCircularDependency(const TWeakObjectPtr<UAblAbilityTaskValidatorContext>& Context, const UAblAbilityTask* TaskToCheck, const UAblAbilityTask* CurrentTask) const
{
	static TArray<const UAblAbilityTask*> Stack;
	Stack.Push(CurrentTask);

	bool Result = false;
	if (CurrentTask->HasDependencies())
	{
		for (const UAblAbilityTask* Dependency : CurrentTask->GetTaskDependencies())
		{
			if (Dependency == TaskToCheck)
			{
				FText ErrorMessage = FText::FormatOrdered(LOCTEXT("AbilityValidatorTaskCirculeDependency", "Circular Dependency Detected for Task {0}, dependency stack:"), TaskToCheck->GetTaskName());
				Context->AddError(ErrorMessage);

				Result = true;
				break;
			}
			else
			{
				if (!Stack.Contains(Dependency) && HasCircularDependency(Context, TaskToCheck, Dependency))
				{
					Context->AddError(FText::FormatOrdered(LOCTEXT("AbilityValidatorTaskCircularDependencyStack", "Task {0} depends on {1}"), CurrentTask->GetTaskName(), Dependency->GetTaskName()));

					Result = true;
					break;
				}
			}
		}
	}

	Stack.Pop();
	return Result;
}
Пример #27
0
FExportObjectInnerContext::FExportObjectInnerContext(TArray<UObject*>& ObjsToIgnore)
{
	// For each object . . .
	for ( TObjectIterator<UObject> It ; It ; ++It )
	{
		UObject* InnerObj = *It;
		if ( !InnerObj->IsPendingKill() )
		{
			if ( !ObjsToIgnore.Contains(InnerObj) )
			{
				UObject* OuterObj = InnerObj->GetOuter();
				if ( OuterObj && !OuterObj->IsPendingKill() )
				{
					InnerList* Inners = ObjectToInnerMap.Find( OuterObj );
					if ( Inners )
					{
						// Add object to existing inner list.
						Inners->Add( InnerObj );
					}
					else
					{
						// Create a new inner list for the outer object.
						InnerList& InnersForOuterObject = ObjectToInnerMap.Add( OuterObj, InnerList() );
						InnersForOuterObject.Add( InnerObj );
					}
				}
			}
		}
	}
}
Пример #28
0
UK2Node::ERedirectType UK2Node::ShouldRedirectParam(const TArray<FString>& OldPinNames, FName& NewPinName, const UK2Node * NewPinNode) const 
{
	if ( ensure(NewPinNode) )
	{
		const TMultiMap<UClass*, FParamRemapInfo>& ParamRedirectMap = FMemberReference::GetParamRedirectMap();

		if ( ParamRedirectMap.Num() > 0 )
		{
			// convert TArray<FString> to TArray<FName>, faster to search
			TArray<FName> OldPinFNames;
			for (auto NameIter=OldPinNames.CreateConstIterator(); NameIter; ++NameIter)
			{
				const FString& Name = *NameIter;
				OldPinFNames.AddUnique(*Name);
			}

			// go through for the NewPinNode
			for(TMultiMap<UClass*, FParamRemapInfo>::TConstKeyIterator ParamIter(ParamRedirectMap, NewPinNode->GetClass()); ParamIter; ++ParamIter)
			{
				const FParamRemapInfo& ParamRemap = ParamIter.Value();

				// if it has it, return true
				if (OldPinFNames.Contains(ParamRemap.OldParam)
					&& (ParamRemap.NodeTitle == NAME_None || ParamRemap.NodeTitle.ToString() == NewPinNode->GetNodeTitle(ENodeTitleType::FullTitle).ToString()))
				{
					NewPinName = ParamRemap.NewParam;
					return (ParamRemap.bCustomValueMapping ? ERedirectType_Custom : (ParamRemap.ParamValueMap.Num() ? ERedirectType_Value : ERedirectType_Name));
				}
			}
		}
	}

	return ERedirectType_None;
}
Пример #29
0
	FString CollectPropertyDescription(const UObject* Ob, const UClass* StopAtClass, const TArray<UProperty*>& PropertyData)
	{
		FString RetString;
		for (UProperty* TestProperty = Ob->GetClass()->PropertyLink; TestProperty; TestProperty = TestProperty->PropertyLinkNext)
		{
			// stop when reaching base class
			if (TestProperty->GetOuter() == StopAtClass)
			{
				break;
			}

			// skip properties without any setup data	
			if (TestProperty->HasAnyPropertyFlags(CPF_Transient) ||
				TestProperty->HasAnyPropertyFlags(CPF_DisableEditOnInstance) ||
				PropertyData.Contains(TestProperty))
			{
				continue;
			}

			if (TestProperty->IsA(UClassProperty::StaticClass()) ||
				TestProperty->IsA(UStructProperty::StaticClass()) ||
				CanUsePropertyType(TestProperty))
			{
				if (RetString.Len())
				{
					RetString.AppendChar(TEXT('\n'));
				}

				const uint8* PropData = TestProperty->ContainerPtrToValuePtr<uint8>(Ob);
				RetString += DescribeProperty(TestProperty, PropData);
			}
		}

		return RetString;
	}
Пример #30
0
void UK2Node::ReconstructSinglePin(UEdGraphPin* NewPin, UEdGraphPin* OldPin, ERedirectType RedirectType)
{
	UBlueprint* Blueprint = GetBlueprint();

	check(NewPin && OldPin);

	// Copy over modified persistent data
	NewPin->CopyPersistentDataFromOldPin(*OldPin);

	if (NewPin->DefaultValue != NewPin->AutogeneratedDefaultValue)
	{
		if (RedirectType == ERedirectType_Value)
		{
			TArray<FString> OldPinNames;
			GetRedirectPinNames(*OldPin, OldPinNames);

			// convert TArray<FString> to TArray<FName>, faster to search
			TArray<FName> OldPinFNames;
			for (auto NameIter=OldPinNames.CreateConstIterator(); NameIter; ++NameIter)
			{
				const FString& Name = *NameIter;
				OldPinFNames.AddUnique(*Name);
			}

			// go through for the NewPinNode
			for(TMultiMap<UClass*, FParamRemapInfo>::TConstKeyIterator ParamIter(FMemberReference::GetParamRedirectMap(), Cast<UK2Node>(NewPin->GetOwningNode())->GetClass()); ParamIter; ++ParamIter)
			{
				const FParamRemapInfo& ParamRemap = ParamIter.Value();

				// once we find it, see about remapping the value
				if (OldPinFNames.Contains(ParamRemap.OldParam))
				{
					const FString* NewValue = ParamRemap.ParamValueMap.Find(NewPin->DefaultValue);
					if (NewValue)
					{
						NewPin->DefaultValue = *NewValue;
					}
					break;
				}
			}
		}
		else if (RedirectType == ERedirectType_Custom)
		{
			CustomMapParamValue(*NewPin);
		}
	}

	// Update the blueprints watched pins as the old pin will be going the way of the dodo
	for (int32 WatchIndex = 0; WatchIndex < Blueprint->PinWatches.Num(); ++WatchIndex)
	{
		UEdGraphPin*& WatchedPin = Blueprint->PinWatches[WatchIndex];
		if( WatchedPin == OldPin )
		{
			WatchedPin = NewPin;
			break;
		}
	}

	OldPin->Rename(NULL, GetTransientPackage(), (REN_DontCreateRedirectors|(Blueprint->bIsRegeneratingOnLoad ? REN_ForceNoResetLoaders : REN_None)));
}