Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/Metasound.cpp
rob gay 31435d69a5 Fix bug with synchronization not being completed prior to validation for referenced MetaSound graphs
TLBSRA (Too long but still read anyway)
This was due to validation moving to recursive behavior but sync not to support bubbling up referenced errors/warnings in 5.1.  This resulted in missing members after interface transforms are applied and potentially hitting ensures in validation.
...
But wait there's more!!! Synchronization on tick is now more efficient as it doesn't attempt to resynchronize/validate references already synchronized/validated in prior pass in same frame due to referencing graph needing to sync

#rb helen.yang
#rnx
#jira UE-162586
#preflight 63223e6c29254beccbf06119

[CL 22019580 by rob gay in ue5-main branch]
2022-09-14 18:49:46 -04:00

151 lines
3.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Metasound.h"
#include "AssetRegistry/AssetRegistryModule.h"
#include "Internationalization/Text.h"
#include "Logging/TokenizedMessage.h"
#include "MetasoundAssetBase.h"
#include "MetasoundAudioFormats.h"
#include "MetasoundEngineArchetypes.h"
#include "MetasoundEngineEnvironment.h"
#include "MetasoundEnvironment.h"
#include "MetasoundFrontendController.h"
#include "MetasoundFrontendQuery.h"
#include "MetasoundFrontendQuerySteps.h"
#include "MetasoundFrontendRegistries.h"
#include "MetasoundFrontendSearchEngine.h"
#include "MetasoundGenerator.h"
#include "MetasoundLog.h"
#include "MetasoundOperatorSettings.h"
#include "MetasoundParameterTransmitter.h"
#include "MetasoundPrimitives.h"
#include "MetasoundReceiveNode.h"
#include "MetasoundTrigger.h"
#include "MetasoundUObjectRegistry.h"
#include "UObject/ObjectSaveContext.h"
#if WITH_EDITORONLY_DATA
#include "EdGraph/EdGraph.h"
#endif // WITH_EDITORONLY_DATA
#define LOCTEXT_NAMESPACE "MetaSound"
int32 UMetasoundEditorGraphBase::GetHighestMessageSeverity() const
{
int32 HighestMessageSeverity = EMessageSeverity::Info;
for (const UEdGraphNode* Node : Nodes)
{
// Lower integer value is "higher severity"
if (Node->ErrorType < HighestMessageSeverity)
{
HighestMessageSeverity = Node->ErrorType;
}
}
return HighestMessageSeverity;
}
UMetaSoundPatch::UMetaSoundPatch(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, FMetasoundAssetBase()
{
}
#if WITH_EDITOR
void UMetaSoundPatch::PostDuplicate(EDuplicateMode::Type InDuplicateMode)
{
Super::PostDuplicate(InDuplicateMode);
// Guid is reset as asset may share implementation from
// asset duplicated from but should not be registered as such.
if (InDuplicateMode == EDuplicateMode::Normal)
{
AssetClassID = FGuid::NewGuid();
Metasound::Frontend::FRenameRootGraphClass::Generate(GetDocumentHandle(), AssetClassID);
}
}
void UMetaSoundPatch::PostEditUndo()
{
Super::PostEditUndo();
Metasound::PostEditUndo(*this);
}
#endif // WITHEDITOR
void UMetaSoundPatch::BeginDestroy()
{
UnregisterGraphWithFrontend();
Super::BeginDestroy();
}
void UMetaSoundPatch::PreSave(FObjectPreSaveContext InSaveContext)
{
Super::PreSave(InSaveContext);
Metasound::PreSaveAsset(*this, InSaveContext);
}
void UMetaSoundPatch::Serialize(FArchive& InArchive)
{
Super::Serialize(InArchive);
Metasound::SerializeToArchive(*this, InArchive);
}
#if WITH_EDITORONLY_DATA
UEdGraph* UMetaSoundPatch::GetGraph()
{
return Graph;
}
const UEdGraph* UMetaSoundPatch::GetGraph() const
{
return Graph;
}
UEdGraph& UMetaSoundPatch::GetGraphChecked()
{
check(Graph);
return *Graph;
}
const UEdGraph& UMetaSoundPatch::GetGraphChecked() const
{
check(Graph);
return *Graph;
}
FText UMetaSoundPatch::GetDisplayName() const
{
FString TypeName = UMetaSoundPatch::StaticClass()->GetName();
return FMetasoundAssetBase::GetDisplayName(MoveTemp(TypeName));
}
void UMetaSoundPatch::SetRegistryAssetClassInfo(const Metasound::Frontend::FNodeClassInfo& InNodeInfo)
{
Metasound::SetMetaSoundRegistryAssetClassInfo(*this, InNodeInfo);
}
#endif // WITH_EDITORONLY_DATA
Metasound::Frontend::FNodeClassInfo UMetaSoundPatch::GetAssetClassInfo() const
{
return { GetDocumentChecked().RootGraph, FSoftObjectPath(this) };
}
void UMetaSoundPatch::SetReferencedAssetClassKeys(TSet<Metasound::Frontend::FNodeRegistryKey>&& InKeys)
{
ReferencedAssetClassKeys = MoveTemp(InKeys);
}
TSet<FSoftObjectPath>& UMetaSoundPatch::GetReferencedAssetClassCache()
{
return ReferenceAssetClassCache;
}
const TSet<FSoftObjectPath>& UMetaSoundPatch::GetReferencedAssetClassCache() const
{
return ReferenceAssetClassCache;
}
#undef LOCTEXT_NAMESPACE // MetaSound