2020-07-15 00:16:40 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
#include "Metasound.h"
|
|
|
|
|
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "AssetRegistryModule.h"
|
2020-07-15 00:16:40 -04:00
|
|
|
#include "CoreMinimal.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "Internationalization/Text.h"
|
|
|
|
|
#include "MetasoundAssetBase.h"
|
|
|
|
|
#include "MetasoundAudioFormats.h"
|
2021-06-23 20:08:21 -04:00
|
|
|
#include "MetasoundEngineArchetypes.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "MetasoundEngineEnvironment.h"
|
2021-07-27 15:36:03 -04:00
|
|
|
#include "MetasoundEnvironment.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "MetasoundFrontendController.h"
|
|
|
|
|
#include "MetasoundFrontendQuery.h"
|
|
|
|
|
#include "MetasoundFrontendQuerySteps.h"
|
2021-08-18 15:16:57 -04:00
|
|
|
#include "MetasoundFrontendRegistries.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "MetasoundFrontendSearchEngine.h"
|
|
|
|
|
#include "MetasoundGenerator.h"
|
|
|
|
|
#include "MetasoundLog.h"
|
|
|
|
|
#include "MetasoundOperatorSettings.h"
|
2021-08-30 14:08:45 -04:00
|
|
|
#include "MetasoundParameterTransmitter.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "MetasoundPrimitives.h"
|
|
|
|
|
#include "MetasoundReceiveNode.h"
|
|
|
|
|
#include "MetasoundTrigger.h"
|
2021-07-27 15:36:03 -04:00
|
|
|
#include "MetasoundUObjectRegistry.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "UObject/ObjectSaveContext.h"
|
2020-07-23 16:39:56 -04:00
|
|
|
|
2021-06-08 10:52:31 -04:00
|
|
|
#if WITH_EDITORONLY_DATA
|
|
|
|
|
#include "EdGraph/EdGraph.h"
|
|
|
|
|
#endif // WITH_EDITORONLY_DATA
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "MetaSound"
|
2021-06-16 11:21:13 -04:00
|
|
|
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
UMetaSound::UMetaSound(const FObjectInitializer& ObjectInitializer)
|
2020-07-15 00:16:40 -04:00
|
|
|
: Super(ObjectInitializer)
|
2021-06-08 10:52:31 -04:00
|
|
|
, FMetasoundAssetBase()
|
2020-07-15 00:16:40 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-08 10:52:31 -04:00
|
|
|
#if WITH_EDITOR
|
2021-07-28 16:21:39 -04:00
|
|
|
void UMetaSound::PostDuplicate(EDuplicateMode::Type InDuplicateMode)
|
|
|
|
|
{
|
|
|
|
|
Super::PostDuplicate(InDuplicateMode);
|
2021-11-22 15:55:50 -05:00
|
|
|
|
|
|
|
|
// 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());
|
|
|
|
|
}
|
2021-07-28 16:21:39 -04:00
|
|
|
}
|
|
|
|
|
|
2021-06-08 10:52:31 -04:00
|
|
|
void UMetaSound::PostEditUndo()
|
|
|
|
|
{
|
|
|
|
|
Super::PostEditUndo();
|
2021-11-18 14:37:34 -05:00
|
|
|
bSynchronizationRequired = true;
|
2021-06-08 10:52:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UMetaSound::PostEditChangeProperty(FPropertyChangedEvent& InEvent)
|
|
|
|
|
{
|
|
|
|
|
Super::PostEditChangeProperty(InEvent);
|
2021-06-16 11:21:13 -04:00
|
|
|
Metasound::PostEditChangeProperty(*this, InEvent);
|
2021-06-08 10:52:31 -04:00
|
|
|
}
|
|
|
|
|
#endif // WITHEDITOR
|
|
|
|
|
|
2021-07-27 15:36:03 -04:00
|
|
|
void UMetaSound::BeginDestroy()
|
|
|
|
|
{
|
|
|
|
|
UnregisterGraphWithFrontend();
|
|
|
|
|
Super::BeginDestroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UMetaSound::PreSave(FObjectPreSaveContext InSaveContext)
|
|
|
|
|
{
|
|
|
|
|
Super::PreSave(InSaveContext);
|
2021-08-31 16:07:45 -04:00
|
|
|
Metasound::PreSaveAsset(*this, InSaveContext);
|
2021-07-27 15:36:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UMetaSound::Serialize(FArchive& InArchive)
|
|
|
|
|
{
|
|
|
|
|
Super::Serialize(InArchive);
|
|
|
|
|
Metasound::SerializeToArchive(*this, InArchive);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 12:59:38 -04:00
|
|
|
#if WITH_EDITORONLY_DATA
|
2021-04-02 02:09:50 -04:00
|
|
|
UEdGraph* UMetaSound::GetGraph()
|
2020-07-15 12:59:38 -04:00
|
|
|
{
|
|
|
|
|
return Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
const UEdGraph* UMetaSound::GetGraph() const
|
2020-07-17 16:43:42 -04:00
|
|
|
{
|
|
|
|
|
return Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
UEdGraph& UMetaSound::GetGraphChecked()
|
2020-07-15 12:59:38 -04:00
|
|
|
{
|
|
|
|
|
check(Graph);
|
|
|
|
|
return *Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
const UEdGraph& UMetaSound::GetGraphChecked() const
|
2020-07-17 16:43:42 -04:00
|
|
|
{
|
|
|
|
|
check(Graph);
|
|
|
|
|
return *Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-08 10:52:31 -04:00
|
|
|
FText UMetaSound::GetDisplayName() const
|
2020-07-15 12:59:38 -04:00
|
|
|
{
|
2021-06-08 10:52:31 -04:00
|
|
|
FString TypeName = UMetaSound::StaticClass()->GetName();
|
|
|
|
|
return FMetasoundAssetBase::GetDisplayName(MoveTemp(TypeName));
|
2020-07-15 12:59:38 -04:00
|
|
|
}
|
2021-06-16 11:21:13 -04:00
|
|
|
|
|
|
|
|
void UMetaSound::SetRegistryAssetClassInfo(const Metasound::Frontend::FNodeClassInfo& InNodeInfo)
|
|
|
|
|
{
|
|
|
|
|
Metasound::SetMetaSoundRegistryAssetClassInfo(*this, InNodeInfo);
|
|
|
|
|
}
|
2020-07-15 12:59:38 -04:00
|
|
|
#endif // WITH_EDITORONLY_DATA
|
|
|
|
|
|
2021-06-16 11:21:13 -04:00
|
|
|
Metasound::Frontend::FNodeClassInfo UMetaSound::GetAssetClassInfo() const
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
2021-06-16 11:21:13 -04:00
|
|
|
return { GetDocumentChecked().RootGraph, *GetPathName() };
|
2020-12-14 15:48:27 -04:00
|
|
|
}
|
|
|
|
|
|
2021-08-18 15:16:57 -04:00
|
|
|
void UMetaSound::SetReferencedAssetClassKeys(TSet<Metasound::Frontend::FNodeRegistryKey>&& InKeys)
|
|
|
|
|
{
|
|
|
|
|
ReferencedAssetClassKeys = MoveTemp(InKeys);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-07 23:43:01 -05:00
|
|
|
TSet<FSoftObjectPath>& UMetaSound::GetReferencedAssetClassCache()
|
|
|
|
|
{
|
|
|
|
|
return ReferenceAssetClassCache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TSet<FSoftObjectPath>& UMetaSound::GetReferencedAssetClassCache() const
|
2021-08-18 15:16:57 -04:00
|
|
|
{
|
|
|
|
|
return ReferenceAssetClassCache;
|
|
|
|
|
}
|
2021-12-10 19:13:22 -05:00
|
|
|
|
|
|
|
|
const FMetasoundFrontendVersion& UMetaSound::GetDefaultArchetypeVersion() const
|
|
|
|
|
{
|
|
|
|
|
static const FMetasoundFrontendVersion DefaultArchetypeVersion = Metasound::Engine::MetasoundV1_0::GetVersion();
|
|
|
|
|
return DefaultArchetypeVersion;
|
|
|
|
|
}
|
2021-06-08 10:52:31 -04:00
|
|
|
#undef LOCTEXT_NAMESPACE // MetaSound
|