Properly early out if MetaSound Preset's reference could not be or is not loaded properly

#rb phil.popp
#jira none
#preflight 619d793a47752856c972bbff
#rnx

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

[CL 18288009 by rob gay in ue5-release-engine-test branch]
This commit is contained in:
rob gay
2021-11-24 15:45:43 -05:00
parent d479887ea2
commit 01084c3c2c

View File

@@ -421,6 +421,10 @@ namespace Metasound
{
const FNodeRegistryKey RegistryKey = FMetasoundFrontendRegistryContainer::Get()->GetRegistryKey(ClassMetadata);
PresetReferencedMetaSoundAsset = IMetaSoundAssetManager::GetChecked().TryLoadAssetFromKey(RegistryKey);
if (!PresetReferencedMetaSoundAsset)
{
UE_LOG(LogMetaSound, Error, TEXT("Failed to update Preset. Referenced asset class '%s' not found."), *ClassMetadata.GetDisplayName().ToString());
}
return;
}
@@ -446,16 +450,21 @@ namespace Metasound
if (PresetReferencedMetaSoundAsset)
{
bDidEdit |= FRebuildPresetRootGraph(PresetReferencedMetaSoundAsset->GetDocumentHandle()).Transform(InDocument);
if (bDidEdit)
if (bInterfaceManaged)
{
FMetasoundFrontendClassMetadata ParentMetadata = InDocument->GetRootGraphClass().Metadata;
ParentMetadata.SetType(EMetasoundFrontendClassType::External);
const FNodeRegistryKey RegistryKey = FMetasoundFrontendRegistryContainer::Get()->GetRegistryKey(ParentMetadata);
FMetasoundAssetBase* ParentMetaSoundAsset = IMetaSoundAssetManager::GetChecked().TryLoadAssetFromKey(RegistryKey);
if (ensure(ParentMetaSoundAsset))
bDidEdit |= FRebuildPresetRootGraph(PresetReferencedMetaSoundAsset->GetDocumentHandle()).Transform(InDocument);
if (bDidEdit)
{
ParentMetaSoundAsset->ConformObjectDataToInterfaces();
FMetasoundFrontendClassMetadata ParentMetadata = InDocument->GetRootGraphClass().Metadata;
ParentMetadata.SetType(EMetasoundFrontendClassType::External);
const FNodeRegistryKey RegistryKey = FMetasoundFrontendRegistryContainer::Get()->GetRegistryKey(ParentMetadata);
FMetasoundAssetBase* ParentMetaSoundAsset = IMetaSoundAssetManager::GetChecked().TryLoadAssetFromKey(RegistryKey);
if (ensure(ParentMetaSoundAsset))
{
ParentMetaSoundAsset->ConformObjectDataToInterfaces();
}
InDocument->SynchronizeDependencies();
}
}
}
@@ -471,9 +480,10 @@ namespace Metasound
Style.bMessageNodeUpdated = NewNode->GetClassMetadata().GetVersion() > InitialVersion;
NewNode->SetNodeStyle(Style);
}
InDocument->SynchronizeDependencies();
}
InDocument->SynchronizeDependencies();
return bDidEdit;
}