2020-07-15 00:16:40 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
#include "Metasound.h"
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "HAL/FileManager.h"
|
|
|
|
|
#include "StructSerializer.h"
|
2020-07-23 16:39:56 -04:00
|
|
|
#include "UObject/UnrealType.h"
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
UMetaSound::UMetaSound(const FObjectInitializer& ObjectInitializer)
|
2020-07-15 00:16:40 -04:00
|
|
|
: Super(ObjectInitializer)
|
2021-01-13 10:48:59 -04:00
|
|
|
, FMetasoundAssetBase(FMetasoundFrontendArchetype())
|
2020-07-15 00:16:40 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
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-04-02 02:09:50 -04:00
|
|
|
void UMetaSound::SetGraph(UEdGraph* InGraph)
|
2020-07-15 12:59:38 -04:00
|
|
|
{
|
|
|
|
|
Graph = InGraph;
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_EDITORONLY_DATA
|
|
|
|
|
|
2020-12-14 15:48:27 -04:00
|
|
|
// Returns document object responsible for serializing asset
|
2021-04-02 02:09:50 -04:00
|
|
|
Metasound::Frontend::TAccessPtr<FMetasoundFrontendDocument> UMetaSound::GetDocument()
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
2021-01-13 10:48:59 -04:00
|
|
|
return Metasound::Frontend::MakeAccessPtr(MetasoundDocument.AccessPoint, MetasoundDocument);
|
2020-12-14 15:48:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Returns document object responsible for serializing asset
|
2021-04-02 02:09:50 -04:00
|
|
|
Metasound::Frontend::TAccessPtr<const FMetasoundFrontendDocument> UMetaSound::GetDocument() const
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
2021-01-13 10:48:59 -04:00
|
|
|
return Metasound::Frontend::MakeAccessPtr<const FMetasoundFrontendDocument>(MetasoundDocument.AccessPoint, MetasoundDocument);
|
2020-12-14 15:48:27 -04:00
|
|
|
}
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
const TArray<FMetasoundFrontendArchetype>& UMetaSound::GetPreferredMetasoundArchetypes() const
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
2021-04-02 02:09:50 -04:00
|
|
|
// Not preferred archetypes for a basic UMetaSound.
|
2021-01-13 10:48:59 -04:00
|
|
|
static const TArray<FMetasoundFrontendArchetype> Preferred;
|
2020-12-14 15:48:27 -04:00
|
|
|
return Preferred;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
bool UMetaSound::IsMetasoundArchetypeSupported(const FMetasoundFrontendArchetype& InArchetype) const
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
|
|
|
|
// All archetypes are supported.
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 02:09:50 -04:00
|
|
|
const FMetasoundFrontendArchetype& UMetaSound::GetPreferredMetasoundArchetype(const FMetasoundFrontendDocument& InDocument) const
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
|
|
|
|
// Prefer to keep original archetype.
|
|
|
|
|
return InDocument.Archetype;
|
|
|
|
|
}
|
|
|
|
|
|