Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/Metasound.cpp
Rob Gay 82054890b6 Fix PostLoad crash on asset load in-editor
#rb trivial
#rnx
#jira none
#fyi ethan.geller

[CL 13950741 by Rob Gay in ue5-main branch]
2020-07-27 19:10:04 -04:00

69 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Metasound.h"
#include "CoreMinimal.h"
#include "HAL/FileManager.h"
#include "StructSerializer.h"
#include "UObject/UnrealType.h"
#include "MetasoundArchetypeRegistration.h"
UMetasound::UMetasound(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, FMetasoundAssetBase(RootMetasoundDocument)
{
}
#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;
}
void UMetasound::SetGraph(UEdGraph* InGraph)
{
Graph = InGraph;
}
#endif // WITH_EDITORONLY_DATA
// This can be used to update the metadata (name, author, etc) for this metasound.
// @param InMetadata may be updated with any corrections we do to the input metadata.
void UMetasound::SetMetadata(FMetasoundClassMetadata& InMetadata)
{
FMetasoundAssetBase::SetMetadata(InMetadata);
MarkPackageDirty();
}
void UMetasound::PostLoad()
{
ConformDocumentToArchetype();
Super::PostLoad();
}
FMetasoundArchetype UMetasound::GetArchetype() const
{
FMetasoundArchetype Archetype;
static FName MetasoundArchetypeName = TEXT("Generic Metasound");
Archetype.ArchetypeName = MetasoundArchetypeName;
return Archetype;
}