Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Private/MetasoundFrontendDocument.cpp
rob gay e26ac0345b - Migrate MetaSound InputLiterals to DefaultLiterals housed on FrontendNodes
- Add FrontendGraphBuilder support for generating VariableNodes for DefaultLiterals if no connection is provided on External/Output nodes
- Move node names to be guids (they're never seen by the user and this will be easier to migrate later)
- Fix DisplayName logic to be unique against one another SEPARATELY from node name logic
- Fix for MetaSounds not compiling if trigger outputs do not have input connected
- MetaSound Document Transform Support
- Fix for for MetaSound Generators not stopping source if failed to create generator due to build errors
#rb phil.popp
#jira UE-112951
#jira UE-116172
#jira UE-116174
#jira UE-116176
#jira UE-116178
#preflight 60b11e7b7e4e6a0001b81c21
#preflight 60b1292d072a1d000164b470

#ROBOMERGE-SOURCE: CL 16502735 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v826-16501804)

[CL 16502750 by rob gay in ue5-main branch]
2021-05-28 14:09:45 -04:00

126 lines
4.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MetasoundFrontendDocument.h"
#include "MetasoundFrontend.h"
#include "MetasoundFrontendRegistries.h"
#include "MetasoundLog.h"
namespace Metasound
{
const FGuid FrontendInvalidID = FGuid();
}
FMetasoundFrontendNodeInterface::FMetasoundFrontendNodeInterface(const FMetasoundFrontendClassInterface& InClassInterface)
{
for (const FMetasoundFrontendClassInput& Input : InClassInterface.Inputs)
{
Inputs.Add(Input);
}
for (const FMetasoundFrontendClassOutput& Output : InClassInterface.Outputs)
{
Outputs.Add(Output);
}
for (const FMetasoundFrontendClassEnvironmentVariable& EnvVar : InClassInterface.Environment)
{
FMetasoundFrontendVertex EnvVertex;
EnvVertex.Name = EnvVar.Name;
EnvVertex.TypeName = EnvVar.TypeName;
Environment.Add(MoveTemp(EnvVertex));
}
}
FMetasoundFrontendNode::FMetasoundFrontendNode(const FMetasoundFrontendClass& InClass)
: ClassID(InClass.ID)
, Name(InClass.Metadata.ClassName.Name.ToString())
, Interface(InClass.Interface)
{
}
bool FMetasoundFrontendVertex::IsFunctionalEquivalent(const FMetasoundFrontendVertex& InLHS, const FMetasoundFrontendVertex& InRHS)
{
return (InLHS.Name == InRHS.Name) && (InLHS.TypeName == InRHS.TypeName);
}
bool FMetasoundFrontendClassVertex::IsFunctionalEquivalent(const FMetasoundFrontendClassVertex& InLHS, const FMetasoundFrontendClassVertex& InRHS)
{
return FMetasoundFrontendVertex::IsFunctionalEquivalent(InLHS, InRHS);
}
FMetasoundFrontendClassName::FMetasoundFrontendClassName(const FName& InNamespace, const FName& InName, const FName& InVariant)
: Namespace(InNamespace)
, Name(InName)
, Variant(InVariant)
{
}
FMetasoundFrontendClassName::FMetasoundFrontendClassName(const Metasound::FNodeClassName& InName)
: FMetasoundFrontendClassName(InName.GetNamespace(), InName.GetName(), InName.GetVariant())
{
}
FName FMetasoundFrontendClassName::GetScopedName() const
{
return Metasound::FNodeClassName::FormatScopedName(Namespace, Name);
}
FName FMetasoundFrontendClassName::GetFullName() const
{
return Metasound::FNodeClassName::FormatFullName(Namespace, Name, Variant);
}
FString FMetasoundFrontendClassName::ToString() const
{
return GetFullName().ToString();
}
bool operator==(const FMetasoundFrontendClassName& InLHS, const FMetasoundFrontendClassName& InRHS)
{
return (InLHS.Namespace == InRHS.Namespace) && (InLHS.Name == InRHS.Name) && (InLHS.Variant == InRHS.Variant);
}
FMetasoundFrontendClassMetadata::FMetasoundFrontendClassMetadata(const Metasound::FNodeClassMetadata& InNodeClassMetadata)
: ClassName(InNodeClassMetadata.ClassName)
, Version{InNodeClassMetadata.MajorVersion, InNodeClassMetadata.MinorVersion}
, Type(EMetasoundFrontendClassType::External)
, DisplayName(InNodeClassMetadata.DisplayName)
, Description(InNodeClassMetadata.Description)
, PromptIfMissing(InNodeClassMetadata.PromptIfMissing)
, Author(InNodeClassMetadata.Author)
, Keywords(InNodeClassMetadata.Keywords)
, CategoryHierarchy(InNodeClassMetadata.CategoryHierarchy)
{
}
FMetasoundFrontendClassInput::FMetasoundFrontendClassInput(const FMetasoundFrontendClassVertex& InOther)
: FMetasoundFrontendClassVertex(InOther)
{
EMetasoundFrontendLiteralType DefaultType = Metasound::Frontend::GetMetasoundFrontendLiteralType(FMetasoundFrontendRegistryContainer::Get()->GetDesiredLiteralTypeForDataType(InOther.TypeName));
DefaultLiteral.SetType(DefaultType);
}
FMetasoundFrontendClassVariable::FMetasoundFrontendClassVariable(const FMetasoundFrontendClassVertex& InOther)
: FMetasoundFrontendClassVertex(InOther)
{
EMetasoundFrontendLiteralType DefaultType = Metasound::Frontend::GetMetasoundFrontendLiteralType(FMetasoundFrontendRegistryContainer::Get()->GetDesiredLiteralTypeForDataType(InOther.TypeName));
DefaultLiteral.SetType(DefaultType);
}
FMetasoundFrontendGraphClass::FMetasoundFrontendGraphClass()
{
Metadata.Type = EMetasoundFrontendClassType::Graph;
}
FMetasoundFrontendDocument::FMetasoundFrontendDocument()
{
RootGraph.ID = FGuid::NewGuid();
RootGraph.Metadata.Type = EMetasoundFrontendClassType::Graph;
}