Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/Metasound.cpp
aurel cordonnier 3e68a3edef [Backout] - CL18345215
[FYI] rob.gay
Original CL Desc
-----------------------------------------------------------------
MetaSounds Interfaces Checkpoint 2:
- Version up source archetypes to become two interfaces: channel interfaces (mono/stereo) & base source namespace
- Clean-up Interface panel to support namespacing better
- Fix bugs with assuming interfaces are always and the only base namespace members
- Allow namespacing for any arbitrary interface member
- Add lock icon to clarify what interface members cannot be modified individually (i.e. cannot add, remove, or rename them as they are interface members)
- Organize members alphabetically
#jira UE-135000
#rnx
#rb phil.popp
#preflight 61a7d1079c77d610079303ec
#p4v-cherrypick 18344347

#ROBOMERGE-AUTHOR: aurel.cordonnier
#ROBOMERGE-SOURCE: CL 18369256 via CL 18369273 via CL 18369290 via CL 18434224 via CL 18435611
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18436532 by aurel cordonnier in ue5-release-engine-test branch]
2021-12-10 19:13:22 -05:00

145 lines
3.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Metasound.h"
#include "AssetRegistryModule.h"
#include "CoreMinimal.h"
#include "Internationalization/Text.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"
UMetaSound::UMetaSound(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, FMetasoundAssetBase()
{
}
#if WITH_EDITOR
void UMetaSound::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)
{
Metasound::Frontend::FRegenerateAssetClassName().Transform(GetDocumentHandle());
}
}
void UMetaSound::PostEditUndo()
{
Super::PostEditUndo();
bSynchronizationRequired = true;
}
void UMetaSound::PostEditChangeProperty(FPropertyChangedEvent& InEvent)
{
Super::PostEditChangeProperty(InEvent);
Metasound::PostEditChangeProperty(*this, InEvent);
}
#endif // WITHEDITOR
void UMetaSound::BeginDestroy()
{
UnregisterGraphWithFrontend();
Super::BeginDestroy();
}
void UMetaSound::PreSave(FObjectPreSaveContext InSaveContext)
{
Super::PreSave(InSaveContext);
Metasound::PreSaveAsset(*this, InSaveContext);
}
void UMetaSound::Serialize(FArchive& InArchive)
{
Super::Serialize(InArchive);
Metasound::SerializeToArchive(*this, InArchive);
}
#if WITH_EDITORONLY_DATA
UEdGraph* UMetaSound::GetGraph()
{
return Graph;
}
const UEdGraph* UMetaSound::GetGraph() const
{
return Graph;
}
UEdGraph& UMetaSound::GetGraphChecked()
{
check(Graph);
return *Graph;
}
const UEdGraph& UMetaSound::GetGraphChecked() const
{
check(Graph);
return *Graph;
}
FText UMetaSound::GetDisplayName() const
{
FString TypeName = UMetaSound::StaticClass()->GetName();
return FMetasoundAssetBase::GetDisplayName(MoveTemp(TypeName));
}
void UMetaSound::SetRegistryAssetClassInfo(const Metasound::Frontend::FNodeClassInfo& InNodeInfo)
{
Metasound::SetMetaSoundRegistryAssetClassInfo(*this, InNodeInfo);
}
#endif // WITH_EDITORONLY_DATA
Metasound::Frontend::FNodeClassInfo UMetaSound::GetAssetClassInfo() const
{
return { GetDocumentChecked().RootGraph, *GetPathName() };
}
void UMetaSound::SetReferencedAssetClassKeys(TSet<Metasound::Frontend::FNodeRegistryKey>&& InKeys)
{
ReferencedAssetClassKeys = MoveTemp(InKeys);
}
TSet<FSoftObjectPath>& UMetaSound::GetReferencedAssetClassCache()
{
return ReferenceAssetClassCache;
}
const TSet<FSoftObjectPath>& UMetaSound::GetReferencedAssetClassCache() const
{
return ReferenceAssetClassCache;
}
const FMetasoundFrontendVersion& UMetaSound::GetDefaultArchetypeVersion() const
{
static const FMetasoundFrontendVersion DefaultArchetypeVersion = Metasound::Engine::MetasoundV1_0::GetVersion();
return DefaultArchetypeVersion;
}
#undef LOCTEXT_NAMESPACE // MetaSound