Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/Metasound.cpp
Rob Gay 6fb458fd4f Checkpoint on more input/output work
- Expose I/O arrays to UI (TODO: fix rename. We currently have two places we're caching input/output names and no easy way to snatch I/O metadata from I/O node.  Could we add function to reference name from description instead of caching on node?)
- Stub in json import exposition to UI
- Fix crash with removing inputs/outputs
- Various clean-up
#rb ethan.geller
#jira UEAU-527

[CL 13937505 by Rob Gay in ue5-main branch]
2020-07-23 16:39:56 -04:00

85 lines
1.7 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"
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;
}
const FText& UMetasound::GetInputToolTip(FString InputName) const
{
for (const FMetasoundInputDescription& Desc : RootMetasoundDocument.RootClass.Inputs)
{
if (Desc.Name == InputName)
{
return Desc.ToolTip;
}
}
return FText::GetEmpty();
}
const FText& UMetasound::GetOutputToolTip(FString OutputName) const
{
for (const FMetasoundOutputDescription& Desc : RootMetasoundDocument.RootClass.Outputs)
{
if (Desc.Name == OutputName)
{
return Desc.ToolTip;
}
}
return FText::GetEmpty();
}
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();
}
// delete this asset's current metasound document,
// and replace it with InClassDescription.
void UMetasound::SetMetasoundDocument(const FMetasoundDocument& InDocument)
{
RootMetasoundDocument = InDocument;
}