Fix for crash due to parent asset not being added to MetaSoundAsset registry early enough in graph registration when adding new asset/dynamically loading

#rb phil.popp
#jira UE-135868
#rnx
#preflight 619ea268aa4521f9e7c50a62

#ROBOMERGE-AUTHOR: rob.gay
#ROBOMERGE-SOURCE: CL 18289406 in //UE5/Release-5.0/... via CL 18289431
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18289450 by rob gay in ue5-release-engine-test branch]
This commit is contained in:
rob gay
2021-11-24 16:44:58 -05:00
parent 6e65166ead
commit 7d94772033
3 changed files with 19 additions and 9 deletions

View File

@@ -111,18 +111,29 @@ void UMetaSoundAssetSubsystem::PostInitAssetScan()
}
}
void UMetaSoundAssetSubsystem::AddAssetReferences(const FMetasoundAssetBase& InAssetBase)
void UMetaSoundAssetSubsystem::AddAssetReferences(FMetasoundAssetBase& InAssetBase)
{
using namespace Metasound;
using namespace Metasound::Frontend;
bool bLoadFromPathCache = false;
const TSet<FString>& AssetClassKeys = InAssetBase.GetReferencedAssetClassKeys();
for (const FString& AssetClassKey : AssetClassKeys)
constexpr bool bRegisterWithFrontend = false;
const FNodeClassInfo AssetClassInfo = InAssetBase.GetAssetClassInfo();
const FNodeRegistryKey AssetClassKey = NodeRegistryKey::CreateKey(AssetClassInfo);
if (!ContainsKey(AssetClassKey))
{
if (!ContainsKey(AssetClassKey))
AddOrUpdateAsset(*InAssetBase.GetOwningAsset(), bRegisterWithFrontend);
UE_LOG(LogMetaSound, Log, TEXT("Adding asset '%s' to MetaSoundAsset registry."), *InAssetBase.GetOwningAssetName());
}
bool bLoadFromPathCache = false;
const TSet<FString>& ReferencedAssetClassKeys = InAssetBase.GetReferencedAssetClassKeys();
for (const FString& ReferencedAssetClassKey : ReferencedAssetClassKeys)
{
if (!ContainsKey(ReferencedAssetClassKey))
{
UE_LOG(LogMetaSound, Log, TEXT("Missing referenced class '%s' asset entry."), *AssetClassKey);
UE_LOG(LogMetaSound, Log, TEXT("Missing referenced class '%s' asset entry."), *ReferencedAssetClassKey);
bLoadFromPathCache = true;
}
}
@@ -152,7 +163,6 @@ void UMetaSoundAssetSubsystem::AddAssetReferences(const FMetasoundAssetBase& InA
"registration request (asset scan likely not complete)."),
*ClassKey,
*AssetClassPath.ToString());
constexpr bool bRegisterWithFrontend = false;
UObject* MetaSoundObject = MetaSoundAsset->GetOwningAsset();
if (ensureAlways(MetaSoundObject))