Description

ClassPaths are stored in FBlueprintTags::GeneratedClassPath, FBlueprintTags::ParentClassPath, FBlueprintTags::NativeParentClassPath, and are read by many locations in editor code. But these locations do not all handle CoreRedirects, and use the old names of the classes when there has been a PackageRedirect or a ClassRedirect, breaking the functionality of whatever operation is using it.

Add utility functions for reading these tags from the AssetRegistry and change all existing locations to use it.

Examples:

ComponentTypeRegistry.cpp line 628

// GetAssetsByClass call is a kludge to get the full asset paths for the blueprints we care about
// Bob T. thinks that the Asset Registry could just keep asset paths
TArray<FAssetData> Assets;
 
AssetRegistry.GetAssetsByClass(UBlueprint::StaticClass()->GetClassPathName(), Assets, true);
for (FAssetData& BPAsset : Assets)
{
	FTopLevelAssetPath ClassPath(FEditorClassUtils::GetClassPathNameFromAssetTag(BPAsset));
	if (!ClassPath.IsNull())
	{

GameplayCueManager.cpp line 888

FGameplayTag GameplayCueTag = Manager.RequestGameplayTag(FoundGameplayTag, false);
if (GameplayCueTag.IsValid())
{
	// Add a new NotifyData entry to our flat list for this one
	FSoftObjectPath StringRef;
	StringRef.SetPath(FPackageName::ExportTextPathToObjectPath(GeneratedClassTag));
 
	OutCuesToAdd.Add(FGameplayCueReferencePair(GameplayCueTag, StringRef));
FPrimaryAssetId FAssetData::GetPrimaryAssetId() const
{
	FName PrimaryAssetType = GetTagValueRef<FName>(FPrimaryAssetId::PrimaryAssetTypeTag);
	FName PrimaryAssetName = GetTagValueRef<FName>(FPrimaryAssetId::PrimaryAssetNameTag);
 
//Edit Begin - Use Redirected Asset Name from FPrimaryAssetId::PrimaryAssetNameTag
	PrimaryAssetName = FCoreRedirects::GetRedirectedName(ECoreRedirectFlags::Type_Package,
		FCoreRedirectObjectName(NAME_None, NAME_None, PrimaryAssetName)).PackageName;
//Edit End - Use Redirected Asset Name from FPrimaryAssetId::PrimaryAssetNameTag
 
	if (!PrimaryAssetType.IsNone() && !PrimaryAssetName.IsNone())
	{
		return FPrimaryAssetId(PrimaryAssetType, PrimaryAssetName);
	}
 
	return FPrimaryAssetId();
}

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-202303 in the post.

0
Login to Vote

Unresolved
ComponentUE - Foundation - Core - Cooker
Affects Versions5.3
Target Fix5.5
Main Commit30320595
CreatedDec 11, 2023
UpdatedFeb 29, 2024
View Jira Issue