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"
|
|
|
|
|
|
2020-07-15 00:16:40 -04:00
|
|
|
UMetasound::UMetasound(const FObjectInitializer& ObjectInitializer)
|
|
|
|
|
: 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
|
|
|
|
|
UEdGraph* UMetasound::GetGraph()
|
|
|
|
|
{
|
|
|
|
|
return Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-17 16:43:42 -04:00
|
|
|
const UEdGraph* UMetasound::GetGraph() const
|
|
|
|
|
{
|
|
|
|
|
return Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 12:59:38 -04:00
|
|
|
UEdGraph& UMetasound::GetGraphChecked()
|
|
|
|
|
{
|
|
|
|
|
check(Graph);
|
|
|
|
|
return *Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-17 16:43:42 -04:00
|
|
|
const UEdGraph& UMetasound::GetGraphChecked() const
|
|
|
|
|
{
|
|
|
|
|
check(Graph);
|
|
|
|
|
return *Graph;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 12:59:38 -04:00
|
|
|
void UMetasound::SetGraph(UEdGraph* InGraph)
|
|
|
|
|
{
|
|
|
|
|
Graph = InGraph;
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_EDITORONLY_DATA
|
|
|
|
|
|
2020-12-14 15:48:27 -04:00
|
|
|
// Returns document object responsible for serializing asset
|
2021-01-13 10:48:59 -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-01-13 10:48:59 -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-01-22 03:05:22 -04:00
|
|
|
const TArray<FMetasoundFrontendArchetype>& UMetasound::GetPreferredMetasoundArchetypes() const
|
2020-12-14 15:48:27 -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-01-22 03:05:22 -04:00
|
|
|
bool UMetasound::IsMetasoundArchetypeSupported(const FMetasoundFrontendArchetype& InArchetype) const
|
2020-12-14 15:48:27 -04:00
|
|
|
{
|
|
|
|
|
// All archetypes are supported.
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-22 03:05:22 -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;
|
|
|
|
|
}
|
|
|
|
|
|