2021-01-13 10:48:59 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# pragma once
2022-03-01 16:31:55 -05:00
# include "Algo/Transform.h"
2021-10-12 21:21:22 -04:00
# include "Containers/Array.h"
# include "Containers/Map.h"
2022-03-01 16:31:55 -05:00
# include "IAudioParameterInterfaceRegistry.h"
2021-01-13 10:48:59 -04:00
# include "Internationalization/Text.h"
# include "MetasoundAccessPtr.h"
2021-02-10 21:43:31 -04:00
# include "MetasoundFrontendLiteral.h"
2021-01-23 12:59:01 -04:00
# include "MetasoundNodeInterface.h"
2021-09-13 14:14:37 -04:00
# include "MetasoundVertex.h"
2021-01-20 17:26:40 -04:00
# include "Misc/Guid.h"
2022-03-16 19:27:27 -04:00
# include "Templates/Function.h"
# include "Templates/Invoke.h"
2021-12-10 20:37:31 -05:00
# include "Templates/TypeHash.h"
2022-05-10 16:51:39 -04:00
# include "UObject/NoExportTypes.h"
2021-01-13 10:48:59 -04:00
# include "MetasoundFrontendDocument.generated.h"
2021-02-03 14:36:36 -04:00
// Forward Declarations
2021-01-13 10:48:59 -04:00
struct FMetasoundFrontendClass ;
struct FMetasoundFrontendClassInterface ;
2021-02-03 14:36:36 -04:00
namespace Metasound
{
struct FLiteral ;
extern const FGuid METASOUNDFRONTEND_API FrontendInvalidID ;
2021-07-27 15:36:03 -04:00
namespace Frontend
{
namespace DisplayStyle
{
2022-05-10 16:51:39 -04:00
namespace EdgeAnimation
{
extern const FLinearColor METASOUNDFRONTEND_API DefaultColor ;
} // namespace EdgeStyle
2021-07-27 15:36:03 -04:00
namespace NodeLayout
{
extern const FVector2D METASOUNDFRONTEND_API DefaultOffsetX ;
extern const FVector2D METASOUNDFRONTEND_API DefaultOffsetY ;
} // namespace NodeLayout
} // namespace DisplayStyle
} // namespace Frontend
2021-02-03 14:36:36 -04:00
} // namespace Metasound
2022-05-26 17:59:27 -04:00
// Describes how a vertex accesses the data connected to it.
UENUM ( )
enum class EMetasoundFrontendVertexAccessType
{
Reference , //< The vertex accesses data by reference.
Value //< The vertex accesses data by value.
} ;
2021-01-13 10:48:59 -04:00
UENUM ( )
enum class EMetasoundFrontendClassType : uint8
{
2022-08-10 14:18:10 -04:00
// The MetaSound class is defined externally, in compiled code or in another document.
2021-01-13 10:48:59 -04:00
External ,
2022-08-10 14:18:10 -04:00
// The MetaSound class is a graph within the containing document.
2021-01-13 10:48:59 -04:00
Graph ,
2022-08-10 14:18:10 -04:00
// The MetaSound class is an input into a graph in the containing document.
2021-01-13 10:48:59 -04:00
Input ,
2022-08-10 14:18:10 -04:00
// The MetaSound class is an output from a graph in the containing document.
2021-01-13 10:48:59 -04:00
Output ,
2022-08-10 14:18:10 -04:00
// The MetaSound class is an literal requiring an literal value to construct.
2021-10-12 21:21:22 -04:00
Literal ,
2022-08-10 14:18:10 -04:00
// The MetaSound class is an variable requiring an literal value to construct.
2021-10-12 21:21:22 -04:00
Variable ,
2021-11-18 14:37:34 -05:00
// The MetaSound class accesses variables.
VariableDeferredAccessor ,
2021-10-12 21:21:22 -04:00
// The MetaSound class accesses variables.
VariableAccessor ,
// The MetaSound class mutates variables.
VariableMutator ,
2022-08-10 14:18:10 -04:00
// The MetaSound class is defined only by the Frontend, and associatively
// performs a functional replacement operation in a pre-build step.
Template ,
2021-01-13 10:48:59 -04:00
Invalid UMETA ( Hidden )
} ;
// General purpose version number for Metasound Frontend objects.
USTRUCT ( )
2021-05-03 17:52:04 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendVersionNumber
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
// Major version number.
2021-12-10 20:37:31 -05:00
UPROPERTY ( VisibleAnywhere , Category = General )
2021-01-13 10:48:59 -04:00
int32 Major = 1 ;
// Minor version number.
2021-12-10 20:37:31 -05:00
UPROPERTY ( VisibleAnywhere , Category = General )
2021-01-13 10:48:59 -04:00
int32 Minor = 0 ;
2021-05-03 17:52:04 -04:00
static const FMetasoundFrontendVersionNumber & GetInvalid ( )
{
static const FMetasoundFrontendVersionNumber Invalid { 0 , 0 } ;
return Invalid ;
}
bool IsValid ( ) const
{
return * this ! = GetInvalid ( ) ;
}
2021-12-10 20:37:31 -05:00
Audio : : FParameterInterface : : FVersion ToInterfaceVersion ( ) const
{
return Audio : : FParameterInterface : : FVersion { Major , Minor } ;
}
2021-05-03 17:52:04 -04:00
friend bool operator = = ( const FMetasoundFrontendVersionNumber & InLHS , const FMetasoundFrontendVersionNumber & InRHS )
{
return InLHS . Major = = InRHS . Major & & InLHS . Minor = = InRHS . Minor ;
}
friend bool operator ! = ( const FMetasoundFrontendVersionNumber & InLHS , const FMetasoundFrontendVersionNumber & InRHS )
{
return InLHS . Major ! = InRHS . Major | | InLHS . Minor ! = InRHS . Minor ;
}
friend bool operator > ( const FMetasoundFrontendVersionNumber & InLHS , const FMetasoundFrontendVersionNumber & InRHS )
{
if ( InLHS . Major > InRHS . Major )
{
return true ;
}
if ( InLHS . Major = = InRHS . Major )
{
return InLHS . Minor > InRHS . Minor ;
}
return false ;
}
friend bool operator > = ( const FMetasoundFrontendVersionNumber & InLHS , const FMetasoundFrontendVersionNumber & InRHS )
{
return InLHS = = InRHS | | InLHS > InRHS ;
}
friend bool operator < ( const FMetasoundFrontendVersionNumber & InLHS , const FMetasoundFrontendVersionNumber & InRHS )
{
if ( InLHS . Major < InRHS . Major )
{
return true ;
}
if ( InLHS . Major = = InRHS . Major )
{
return InLHS . Minor < InRHS . Minor ;
}
return false ;
}
friend bool operator < = ( const FMetasoundFrontendVersionNumber & InLHS , const FMetasoundFrontendVersionNumber & InRHS )
{
return InLHS = = InRHS | | InLHS < InRHS ;
}
FString ToString ( ) const
{
return FString : : Format ( TEXT ( " v{0}.{1} " ) , { Major , Minor } ) ;
}
2021-01-13 10:48:59 -04:00
} ;
2021-12-10 20:37:31 -05:00
FORCEINLINE uint32 GetTypeHash ( const FMetasoundFrontendVersionNumber & InNumber )
{
return HashCombineFast ( GetTypeHash ( InNumber . Major ) , GetTypeHash ( InNumber . Minor ) ) ;
}
2021-01-13 10:48:59 -04:00
// General purpose version info for Metasound Frontend objects.
USTRUCT ( )
2021-06-23 20:08:21 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendVersion
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
// Name of version.
2021-12-10 20:37:31 -05:00
UPROPERTY ( VisibleAnywhere , Category = CustomView )
2021-01-13 10:48:59 -04:00
FName Name ;
// Version number.
2021-12-10 20:37:31 -05:00
UPROPERTY ( VisibleAnywhere , Category = CustomView )
2021-01-13 10:48:59 -04:00
FMetasoundFrontendVersionNumber Number ;
2021-06-23 20:08:21 -04:00
FString ToString ( ) const ;
bool IsValid ( ) const ;
static const FMetasoundFrontendVersion & GetInvalid ( ) ;
friend bool operator = = ( const FMetasoundFrontendVersion & InLHS , const FMetasoundFrontendVersion & InRHS )
{
return InLHS . Name = = InRHS . Name & & InLHS . Number = = InRHS . Number ;
}
friend bool operator ! = ( const FMetasoundFrontendVersion & InLHS , const FMetasoundFrontendVersion & InRHS )
{
return ! ( InLHS = = InRHS ) ;
}
friend bool operator > ( const FMetasoundFrontendVersion & InLHS , const FMetasoundFrontendVersion & InRHS )
{
if ( InRHS . Name . FastLess ( InLHS . Name ) )
{
return true ;
}
if ( InLHS . Name = = InRHS . Name )
{
return InLHS . Number > InRHS . Number ;
}
return false ;
}
friend bool operator > = ( const FMetasoundFrontendVersion & InLHS , const FMetasoundFrontendVersion & InRHS )
{
return InLHS = = InRHS | | InLHS > InRHS ;
}
friend bool operator < ( const FMetasoundFrontendVersion & InLHS , const FMetasoundFrontendVersion & InRHS )
{
if ( InLHS . Name . FastLess ( InRHS . Name ) )
{
return true ;
}
if ( InLHS . Name = = InRHS . Name )
{
return InLHS . Number < InRHS . Number ;
}
return false ;
}
friend bool operator < = ( const FMetasoundFrontendVersion & InLHS , const FMetasoundFrontendVersion & InRHS )
{
return InLHS = = InRHS | | InLHS < InRHS ;
}
2021-01-13 10:48:59 -04:00
} ;
2021-12-10 20:37:31 -05:00
FORCEINLINE uint32 GetTypeHash ( const FMetasoundFrontendVersion & InVersion )
{
return HashCombineFast ( GetTypeHash ( InVersion . Name ) , GetTypeHash ( InVersion . Number ) ) ;
}
2021-01-13 10:48:59 -04:00
2021-02-03 14:36:36 -04:00
// An FMetasoundFrontendVertex provides a named connection point of a node.
2021-01-13 10:48:59 -04:00
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendVertex
{
GENERATED_BODY ( )
2021-02-03 14:36:36 -04:00
// Name of the vertex. Unique amongst other vertices on the same interface.
2021-01-13 10:48:59 -04:00
UPROPERTY ( VisibleAnywhere , Category = CustomView )
2021-09-13 14:14:37 -04:00
FName Name ;
2021-01-13 10:48:59 -04:00
// Data type name of the vertex.
2021-12-10 20:37:31 -05:00
UPROPERTY ( VisibleAnywhere , Category = Parameters )
2021-01-13 10:48:59 -04:00
FName TypeName ;
2021-02-24 18:37:19 -04:00
// ID of vertex
2021-09-13 14:14:37 -04:00
UPROPERTY ( )
2021-02-24 18:37:19 -04:00
FGuid VertexID ;
2021-01-13 10:48:59 -04:00
2021-08-09 15:13:40 -04:00
// Returns true if vertices have equal name & type.
2021-01-13 10:48:59 -04:00
static bool IsFunctionalEquivalent ( const FMetasoundFrontendVertex & InLHS , const FMetasoundFrontendVertex & InRHS ) ;
} ;
// Contains a default value for a single vertex ID
USTRUCT ( )
struct FMetasoundFrontendVertexLiteral
{
GENERATED_BODY ( )
// ID of vertex.
2021-12-10 20:37:31 -05:00
UPROPERTY ( VisibleAnywhere , Category = Parameters )
2021-02-24 18:37:19 -04:00
FGuid VertexID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
2021-12-10 20:37:31 -05:00
// Value to use when constructing input.
2021-01-13 10:48:59 -04:00
UPROPERTY ( EditAnywhere , Category = Parameters )
FMetasoundFrontendLiteral Value ;
} ;
2021-10-12 21:21:22 -04:00
// Contains graph data associated with a variable.
USTRUCT ( )
struct FMetasoundFrontendVariable
{
GENERATED_BODY ( )
2021-10-25 20:05:28 -04:00
// Name of the vertex. Unique amongst other vertices on the same interface.
UPROPERTY ( VisibleAnywhere , Category = CustomView )
FName Name ;
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-10-12 21:21:22 -04:00
// Variable display name
UPROPERTY ( )
FText DisplayName ;
2021-10-25 20:05:28 -04:00
// Variable description
UPROPERTY ( )
FText Description ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-10-12 21:21:22 -04:00
// Variable data type name
UPROPERTY ( )
FName TypeName ;
// Literal used to initialize the variable.
UPROPERTY ( )
FMetasoundFrontendLiteral Literal ;
// Unique ID for the variable
UPROPERTY ( )
FGuid ID = Metasound : : FrontendInvalidID ;
// Node ID of the associated VariableNode
UPROPERTY ( )
FGuid VariableNodeID = Metasound : : FrontendInvalidID ;
// Node ID of the associated VariableMutatorNode
UPROPERTY ( )
FGuid MutatorNodeID = Metasound : : FrontendInvalidID ;
// Node IDs of the associated VariableAccessorNodes
UPROPERTY ( )
TArray < FGuid > AccessorNodeIDs ;
// Node IDs of the associated VariableDeferredAccessorNodes
UPROPERTY ( )
TArray < FGuid > DeferredAccessorNodeIDs ;
} ;
2021-01-13 10:48:59 -04:00
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendNodeInterface
{
GENERATED_BODY ( )
FMetasoundFrontendNodeInterface ( ) = default ;
// Create a node interface which satisfies an existing class interface.
FMetasoundFrontendNodeInterface ( const FMetasoundFrontendClassInterface & InClassInterface ) ;
// Input vertices to node.
UPROPERTY ( )
TArray < FMetasoundFrontendVertex > Inputs ;
// Output vertices to node.
UPROPERTY ( )
TArray < FMetasoundFrontendVertex > Outputs ;
// Environment variables of node.
UPROPERTY ( )
TArray < FMetasoundFrontendVertex > Environment ;
} ;
2021-05-28 14:09:45 -04:00
// DEPRECATED in Document Model v1.1
2021-01-23 12:59:01 -04:00
UENUM ( )
enum class EMetasoundFrontendNodeStyleDisplayVisibility : uint8
{
Visible ,
Hidden
} ;
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendNodeStyleDisplay
{
GENERATED_BODY ( )
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-05-28 14:09:45 -04:00
// DEPRECATED in Document Model v1.1: Visibility state of node
2021-01-23 12:59:01 -04:00
UPROPERTY ( )
EMetasoundFrontendNodeStyleDisplayVisibility Visibility = EMetasoundFrontendNodeStyleDisplayVisibility : : Visible ;
2021-03-19 15:10:57 -04:00
// Map of visual node guid to 2D location. May have more than one if the node allows displaying in
// more than one place on the graph (Only functionally relevant for nodes that cannot contain inputs.)
2021-01-23 12:59:01 -04:00
UPROPERTY ( )
2021-03-19 15:10:57 -04:00
TMap < FGuid , FVector2D > Locations ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-01-23 12:59:01 -04:00
} ;
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendNodeStyle
{
GENERATED_BODY ( )
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-01-23 12:59:01 -04:00
// Display style of a node
UPROPERTY ( )
FMetasoundFrontendNodeStyleDisplay Display ;
2021-02-24 02:02:03 -04:00
2021-08-09 15:13:40 -04:00
// Whether or not to display if
// the node's version has been updated
UPROPERTY ( )
bool bMessageNodeUpdated = false ;
2021-02-24 02:02:03 -04:00
UPROPERTY ( )
bool bIsPrivate = false ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-01-23 12:59:01 -04:00
} ;
2021-01-13 10:48:59 -04:00
2022-05-02 12:35:54 -04:00
2021-01-13 10:48:59 -04:00
// An FMetasoundFrontendNode represents a single instance of a FMetasoundFrontendClass
USTRUCT ( )
2021-01-23 12:59:01 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendNode
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
FMetasoundFrontendNode ( ) = default ;
// Construct node to satisfy class.
FMetasoundFrontendNode ( const FMetasoundFrontendClass & InClass ) ;
2021-09-13 14:14:37 -04:00
private :
2021-01-13 10:48:59 -04:00
// Unique ID of this node.
UPROPERTY ( )
2021-01-20 17:26:40 -04:00
FGuid ID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
2021-09-13 14:14:37 -04:00
public :
2021-01-13 10:48:59 -04:00
// ID of FMetasoundFrontendClass corresponding to this node.
UPROPERTY ( )
2021-01-20 17:26:40 -04:00
FGuid ClassID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
2021-09-13 14:14:37 -04:00
// Name of node instance.
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2021-09-13 14:14:37 -04:00
FName Name ;
2021-01-13 10:48:59 -04:00
// Interface of node instance.
UPROPERTY ( )
FMetasoundFrontendNodeInterface Interface ;
// Default values for node inputs.
UPROPERTY ( )
TArray < FMetasoundFrontendVertexLiteral > InputLiterals ;
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-01-23 12:59:01 -04:00
// Style info related to a node.
UPROPERTY ( )
FMetasoundFrontendNodeStyle Style ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-09-13 14:14:37 -04:00
const FGuid & GetID ( ) const
{
return ID ;
}
2021-10-12 21:21:22 -04:00
void UpdateID ( const FGuid & InNewGuid )
2021-09-13 14:14:37 -04:00
{
2021-10-12 21:21:22 -04:00
ID = InNewGuid ;
2021-09-13 14:14:37 -04:00
}
2021-01-13 10:48:59 -04:00
} ;
// Represents a single connection from one point to another.
USTRUCT ( )
struct FMetasoundFrontendEdge
{
GENERATED_BODY ( )
// ID of source node.
UPROPERTY ( )
2021-01-20 17:26:40 -04:00
FGuid FromNodeID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
// ID of source point on source node.
UPROPERTY ( )
2021-02-24 18:37:19 -04:00
FGuid FromVertexID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
// ID of destination node.
UPROPERTY ( )
2021-01-20 17:26:40 -04:00
FGuid ToNodeID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
// ID of destination point on destination node.
UPROPERTY ( )
2021-02-24 18:37:19 -04:00
FGuid ToVertexID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
2022-05-10 16:51:39 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendEdgeStyleLiteralColorPair
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
UPROPERTY ( )
2022-05-10 16:51:39 -04:00
FMetasoundFrontendLiteral Value ;
UPROPERTY ( )
FLinearColor Color = Metasound : : Frontend : : DisplayStyle : : EdgeAnimation : : DefaultColor ;
2021-01-13 10:48:59 -04:00
} ;
2022-05-10 16:51:39 -04:00
// Styling for all edges associated with a given output (characterized by NodeID & Name)
2021-01-13 10:48:59 -04:00
USTRUCT ( )
2022-05-10 16:51:39 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendEdgeStyle
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
2022-05-10 16:51:39 -04:00
// Node ID for associated edge(s) that should use the given style data.
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2022-05-10 16:51:39 -04:00
FGuid NodeID ;
2021-01-13 10:48:59 -04:00
2022-05-10 16:51:39 -04:00
// Name of node's output to associate style information for its associated edge(s).
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2022-05-10 16:51:39 -04:00
FName OutputName ;
// Array of colors used to animate given output's associated edge(s). Interpolation
// between values dependent on value used.
UPROPERTY ( )
TArray < FMetasoundFrontendEdgeStyleLiteralColorPair > LiteralColorPairs ;
2021-01-13 10:48:59 -04:00
} ;
// Styling for a class
2022-02-10 15:07:39 -05:00
USTRUCT ( )
2022-05-10 16:51:39 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendGraphStyle
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
2021-07-27 15:36:03 -04:00
// Whether or not the graph is editable by a user
2021-06-02 15:41:32 -04:00
UPROPERTY ( )
bool bIsGraphEditable = true ;
2022-05-10 16:51:39 -04:00
// Styles for graph edges.
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2022-05-10 16:51:39 -04:00
TArray < FMetasoundFrontendEdgeStyle > EdgeStyles ;
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
2022-05-10 16:51:39 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendGraph
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
// Node contained in graph
UPROPERTY ( )
TArray < FMetasoundFrontendNode > Nodes ;
// Connections between points on nodes.
UPROPERTY ( )
TArray < FMetasoundFrontendEdge > Edges ;
2021-10-12 21:21:22 -04:00
// Graph local variables.
UPROPERTY ( )
TArray < FMetasoundFrontendVariable > Variables ;
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
// Style of graph display.
UPROPERTY ( )
FMetasoundFrontendGraphStyle Style ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
} ;
// Metadata associated with a vertex.
2022-02-10 15:07:39 -05:00
USTRUCT ( )
2022-05-10 16:51:39 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendVertexMetadata
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
2021-02-24 21:34:19 -04:00
2022-02-10 15:07:39 -05:00
# if WITH_EDITORONLY_DATA
2022-01-26 18:11:52 -05:00
private :
2021-01-13 10:48:59 -04:00
// Display name for a vertex
UPROPERTY ( EditAnywhere , Category = Parameters , meta = ( DisplayName = " Name " ) )
FText DisplayName ;
2022-01-26 18:11:52 -05:00
// Display name for a vertex if vertex is natively defined
// (must be transient to avoid localization desync on load)
UPROPERTY ( Transient )
FText DisplayNameTransient ;
2021-01-13 10:48:59 -04:00
// Description of the vertex.
UPROPERTY ( EditAnywhere , Category = Parameters )
FText Description ;
2022-01-26 18:11:52 -05:00
// Description of the vertex if vertex is natively defined
// (must be transient to avoid localization desync on load)
UPROPERTY ( Transient )
FText DescriptionTransient ;
public :
2022-03-01 16:31:55 -05:00
// Order index of vertex member when shown as a node.
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2022-03-01 16:31:55 -05:00
int32 SortOrderIndex = 0 ;
2021-01-13 10:48:59 -04:00
// If true, vertex is shown for advanced display.
UPROPERTY ( )
bool bIsAdvancedDisplay = false ;
2022-01-26 18:11:52 -05:00
private :
// Whether or not the given metadata text should be serialized
// or is procedurally maintained via auto-update & the referenced
// registry class (to avoid localization text desync). Should be
// false for classes serialized as externally-defined dependencies
// or interfaces.
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2022-01-26 18:11:52 -05:00
bool bSerializeText = true ;
2021-01-13 10:48:59 -04:00
2022-01-26 18:11:52 -05:00
FText & GetDescription ( )
{
return bSerializeText ? Description : DescriptionTransient ;
}
FText & GetDisplayName ( )
{
return bSerializeText ? DisplayName : DisplayNameTransient ;
}
public :
const FText & GetDescription ( ) const
{
return bSerializeText ? Description : DescriptionTransient ;
}
const FText & GetDisplayName ( ) const
{
return bSerializeText ? DisplayName : DisplayNameTransient ;
}
bool GetSerializeText ( ) const
{
return bSerializeText ;
}
void SetDescription ( const FText & InText )
{
GetDescription ( ) = InText ;
}
void SetDisplayName ( const FText & InText )
{
GetDisplayName ( ) = InText ;
}
void SetSerializeText ( bool bInSerializeText )
{
if ( bSerializeText )
{
if ( ! bInSerializeText )
{
DisplayNameTransient = DisplayName ;
DescriptionTransient = Description ;
DisplayName = { } ;
Description = { } ;
}
}
else
{
if ( bInSerializeText )
{
DisplayName = DisplayNameTransient ;
Description = DescriptionTransient ;
DisplayNameTransient = { } ;
DescriptionTransient = { } ;
}
}
bSerializeText = bInSerializeText ;
}
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
} ;
2022-02-10 15:07:39 -05:00
USTRUCT ( )
2021-01-13 10:48:59 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendClassVertex : public FMetasoundFrontendVertex
{
GENERATED_BODY ( )
UPROPERTY ( )
2021-01-20 17:26:40 -04:00
FGuid NodeID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
2022-02-10 15:07:39 -05:00
# if WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
// Metadata associated with input.
UPROPERTY ( EditAnywhere , Category = CustomView )
FMetasoundFrontendVertexMetadata Metadata ;
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
2022-05-26 17:59:27 -04:00
UPROPERTY ( )
EMetasoundFrontendVertexAccessType AccessType = EMetasoundFrontendVertexAccessType : : Reference ;
2021-12-10 20:37:31 -05:00
// Splits name into namespace & parameter name
void SplitName ( FName & OutNamespace , FName & OutParameterName ) const ;
2021-01-13 10:48:59 -04:00
static bool IsFunctionalEquivalent ( const FMetasoundFrontendClassVertex & InLHS , const FMetasoundFrontendClassVertex & InRHS ) ;
2022-07-18 17:14:25 -04:00
// Whether vertex access types are compatible when connecting from an output to an input
static bool CanConnectVertexAccessTypes ( EMetasoundFrontendVertexAccessType InFromType , EMetasoundFrontendVertexAccessType InToType ) ;
2021-01-13 10:48:59 -04:00
} ;
2022-05-02 12:35:54 -04:00
2021-01-20 00:42:47 -04:00
// Information regarding how to display a node class
USTRUCT ( )
2021-01-23 12:59:01 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendClassStyleDisplay
2021-01-20 00:42:47 -04:00
{
GENERATED_BODY ( )
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-01-23 12:59:01 -04:00
FMetasoundFrontendClassStyleDisplay ( ) = default ;
FMetasoundFrontendClassStyleDisplay ( const Metasound : : FNodeDisplayStyle & InDisplayStyle )
: ImageName ( InDisplayStyle . ImageName )
, bShowName ( InDisplayStyle . bShowName )
, bShowInputNames ( InDisplayStyle . bShowInputNames )
, bShowOutputNames ( InDisplayStyle . bShowOutputNames )
2022-08-10 14:18:10 -04:00
, bShowLiterals ( InDisplayStyle . bShowLiterals )
2021-01-23 12:59:01 -04:00
{
}
2021-01-20 00:42:47 -04:00
UPROPERTY ( )
FName ImageName ;
UPROPERTY ( )
bool bShowName = true ;
UPROPERTY ( )
2021-01-23 12:59:01 -04:00
bool bShowInputNames = true ;
2021-01-20 00:42:47 -04:00
UPROPERTY ( )
2021-01-23 12:59:01 -04:00
bool bShowOutputNames = true ;
2022-08-10 14:18:10 -04:00
UPROPERTY ( )
bool bShowLiterals = true ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-01-20 00:42:47 -04:00
} ;
2022-05-02 12:35:54 -04:00
2021-01-13 10:48:59 -04:00
// Contains info for input vertex of a Metasound class.
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendClassInput : public FMetasoundFrontendClassVertex
{
GENERATED_BODY ( )
FMetasoundFrontendClassInput ( ) = default ;
FMetasoundFrontendClassInput ( const FMetasoundFrontendClassVertex & InOther ) ;
2021-02-24 18:37:19 -04:00
// Default value for this input.
2021-01-13 10:48:59 -04:00
UPROPERTY ( EditAnywhere , Category = Parameters )
2021-02-24 18:37:19 -04:00
FMetasoundFrontendLiteral DefaultLiteral ;
2021-01-13 10:48:59 -04:00
} ;
2021-05-28 14:09:45 -04:00
// Contains info for variable vertex of a Metasound class.
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendClassVariable : public FMetasoundFrontendClassVertex
{
GENERATED_BODY ( )
FMetasoundFrontendClassVariable ( ) = default ;
FMetasoundFrontendClassVariable ( const FMetasoundFrontendClassVertex & InOther ) ;
// Default value for this variable.
UPROPERTY ( EditAnywhere , Category = Parameters )
FMetasoundFrontendLiteral DefaultLiteral ;
} ;
// Contains info for output vertex of a Metasound class.
2021-01-13 10:48:59 -04:00
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendClassOutput : public FMetasoundFrontendClassVertex
{
GENERATED_BODY ( )
FMetasoundFrontendClassOutput ( ) = default ;
FMetasoundFrontendClassOutput ( const FMetasoundFrontendClassVertex & InOther )
: FMetasoundFrontendClassVertex ( InOther )
{
}
} ;
2021-11-22 15:55:50 -05:00
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendClassEnvironmentVariable
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
// Name of environment variable.
UPROPERTY ( )
2021-09-13 14:14:37 -04:00
FName Name ;
2021-01-13 10:48:59 -04:00
// Type of environment variable.
UPROPERTY ( )
FName TypeName ;
2021-11-22 15:55:50 -05:00
// True if the environment variable is needed in order to instantiate a node instance of the class.
// TODO: Should be deprecated?
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
bool bIsRequired = true ;
} ;
// Style info of an interface.
USTRUCT ( )
struct FMetasoundFrontendInterfaceStyle
{
GENERATED_BODY ( )
2022-03-01 16:31:55 -05:00
# if WITH_EDITORONLY_DATA
2021-03-02 21:39:09 -04:00
// Default vertex sort order, where array index mirrors array interface index and value is display sort index.
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2021-03-02 21:39:09 -04:00
TArray < int32 > DefaultSortOrder ;
2022-02-25 09:45:49 -05:00
// Map of member names with FText to be used as warnings if not hooked up
UPROPERTY ( )
TMap < FName , FText > RequiredMembers ;
2022-03-16 19:27:27 -04:00
template < typename HandleType , typename NamePredicateType >
void SortDefaults ( TArray < HandleType > & OutHandles , NamePredicateType InGetDisplayNamePredicate ) const
2021-03-02 21:39:09 -04:00
{
2022-03-01 16:31:55 -05:00
TMap < FGuid , int32 > NodeIDToSortIndex ;
int32 HighestSortOrder = TNumericLimits < int32 > : : Min ( ) ;
for ( int32 i = 0 ; i < OutHandles . Num ( ) ; + + i )
2021-03-02 21:39:09 -04:00
{
2022-03-01 16:31:55 -05:00
const FGuid & HandleID = OutHandles [ i ] - > GetID ( ) ;
int32 SortIndex = 0 ;
if ( DefaultSortOrder . IsValidIndex ( i ) )
2021-03-02 21:39:09 -04:00
{
2022-03-01 16:31:55 -05:00
SortIndex = DefaultSortOrder [ i ] ;
HighestSortOrder = FMath : : Max ( SortIndex , HighestSortOrder ) ;
2021-06-16 11:21:13 -04:00
}
2022-03-01 16:31:55 -05:00
else
{
SortIndex = + + HighestSortOrder ;
}
NodeIDToSortIndex . Add ( HandleID , SortIndex ) ;
2021-06-08 10:52:31 -04:00
}
2021-03-31 15:34:29 -04:00
2022-03-16 19:27:27 -04:00
OutHandles . Sort ( [ & NodeIDToSortIndex , & InGetDisplayNamePredicate ] ( const HandleType & HandleA , const HandleType & HandleB ) - > bool
2022-03-01 16:31:55 -05:00
{
const FGuid HandleAID = HandleA - > GetID ( ) ;
const FGuid HandleBID = HandleB - > GetID ( ) ;
2022-03-16 19:27:27 -04:00
const int32 AID = NodeIDToSortIndex [ HandleAID ] ;
const int32 BID = NodeIDToSortIndex [ HandleBID ] ;
// If IDs are equal, sort alphabetically using provided name predicate
if ( AID = = BID )
{
return Invoke ( InGetDisplayNamePredicate , HandleA ) . CompareTo ( Invoke ( InGetDisplayNamePredicate , HandleB ) ) < 0 ;
}
return AID < BID ;
2022-03-01 16:31:55 -05:00
} ) ;
2021-03-02 21:39:09 -04:00
}
2022-03-01 16:31:55 -05:00
# endif // #if WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
2021-07-27 15:36:03 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendClassInterface
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
2021-07-27 15:36:03 -04:00
private :
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2022-02-25 09:45:49 -05:00
2021-01-13 10:48:59 -04:00
// Style info for inputs.
UPROPERTY ( )
FMetasoundFrontendInterfaceStyle InputStyle ;
// Style info for outputs.
UPROPERTY ( )
FMetasoundFrontendInterfaceStyle OutputStyle ;
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
2021-07-27 15:36:03 -04:00
public :
2022-02-25 09:45:49 -05:00
2022-01-27 01:31:46 -05:00
// Generates class interface intended to be used as a registry descriptor from FNodeClassMetadata.
// Does not initialize a change ID as it is not considered to be transactional.
2022-01-31 17:23:08 -05:00
static FMetasoundFrontendClassInterface GenerateClassInterface ( const Metasound : : FVertexInterface & InVertexInterface ) ;
2022-01-27 01:31:46 -05:00
2021-01-13 10:48:59 -04:00
// Description of class inputs.
2021-07-27 15:36:03 -04:00
UPROPERTY ( VisibleAnywhere , Category = CustomView )
2021-01-13 10:48:59 -04:00
TArray < FMetasoundFrontendClassInput > Inputs ;
// Description of class outputs.
2021-07-27 15:36:03 -04:00
UPROPERTY ( VisibleAnywhere , Category = CustomView )
2021-01-13 10:48:59 -04:00
TArray < FMetasoundFrontendClassOutput > Outputs ;
// Description of class environment variables.
2021-07-27 15:36:03 -04:00
UPROPERTY ( VisibleAnywhere , Category = CustomView )
2021-01-13 10:48:59 -04:00
TArray < FMetasoundFrontendClassEnvironmentVariable > Environment ;
2021-07-27 15:36:03 -04:00
private :
UPROPERTY ( )
FGuid ChangeID ;
public :
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-07-27 15:36:03 -04:00
const FMetasoundFrontendInterfaceStyle & GetInputStyle ( ) const
{
return InputStyle ;
}
void SetInputStyle ( const FMetasoundFrontendInterfaceStyle & InInputStyle )
{
InputStyle = InInputStyle ;
ChangeID = FGuid : : NewGuid ( ) ;
}
const FMetasoundFrontendInterfaceStyle & GetOutputStyle ( ) const
{
return OutputStyle ;
}
void SetOutputStyle ( const FMetasoundFrontendInterfaceStyle & InOutputStyle )
{
OutputStyle = InOutputStyle ;
ChangeID = FGuid : : NewGuid ( ) ;
}
2022-02-25 09:45:49 -05:00
void AddRequiredInputToStyle ( const FName & InInputName , const FText & InRequiredText )
{
InputStyle . RequiredMembers . Add ( InInputName , InRequiredText ) ;
2022-03-02 16:52:01 -05:00
ChangeID = FGuid : : NewGuid ( ) ;
2022-02-25 09:45:49 -05:00
}
void AddRequiredOutputToStyle ( const FName & InOutputName , const FText & InRequiredText )
{
OutputStyle . RequiredMembers . Add ( InOutputName , InRequiredText ) ;
2022-03-02 16:52:01 -05:00
ChangeID = FGuid : : NewGuid ( ) ;
2022-02-25 09:45:49 -05:00
}
bool IsMemberInputRequired ( const FName & InInputName , FText & OutRequiredText )
{
if ( FText * RequiredText = InputStyle . RequiredMembers . Find ( InInputName ) )
{
OutRequiredText = * RequiredText ;
return true ;
}
return false ;
}
bool IsMemberOutputRequired ( const FName & InOutputName , FText & OutRequiredText )
{
if ( FText * RequiredText = OutputStyle . RequiredMembers . Find ( InOutputName ) )
{
OutRequiredText = * RequiredText ;
return true ;
}
return false ;
}
2022-03-02 16:52:01 -05:00
void AddSortOrderToInputStyle ( const int32 InSortOrder )
{
InputStyle . DefaultSortOrder . Add ( InSortOrder ) ;
ChangeID = FGuid : : NewGuid ( ) ;
}
void AddSortOrderToOutputStyle ( const int32 InSortOrder )
{
OutputStyle . DefaultSortOrder . Add ( InSortOrder ) ;
ChangeID = FGuid : : NewGuid ( ) ;
}
2022-02-25 09:45:49 -05:00
# endif // #if WITH_EDITORONLY_DATA
2021-07-27 15:36:03 -04:00
const FGuid & GetChangeID ( ) const
{
return ChangeID ;
}
// TODO: This is unfortunately required to be manually managed and executed anytime the input/output/environment arrays
// are mutated due to the design of the controller system obscuring away read/write permissions
// when querying. Need to add accessors and refactor so that this isn't as error prone and
// remove manual execution at the call sites when mutating aforementioned UPROPERTIES.
void UpdateChangeID ( )
{
ChangeID = FGuid : : NewGuid ( ) ;
}
2022-01-20 19:19:55 -05:00
// Required to allow caching registry data without modifying the ChangeID
friend struct FMetasoundFrontendClass ;
2021-01-13 10:48:59 -04:00
} ;
2021-11-22 15:55:50 -05:00
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendInterface : public FMetasoundFrontendClassInterface
{
GENERATED_BODY ( )
// Name and version number of the interface
UPROPERTY ( )
FMetasoundFrontendVersion Version ;
} ;
2021-01-13 10:48:59 -04:00
// Name of a Metasound class
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendClassName
{
GENERATED_BODY ( )
2021-01-28 19:02:51 -04:00
FMetasoundFrontendClassName ( ) = default ;
FMetasoundFrontendClassName ( const FName & InNamespace , const FName & InName , const FName & InVariant ) ;
FMetasoundFrontendClassName ( const Metasound : : FNodeClassName & InName ) ;
2021-01-13 10:48:59 -04:00
// Namespace of class.
2022-02-09 19:27:40 -05:00
UPROPERTY ( EditAnywhere , Category = General )
2021-01-28 19:02:51 -04:00
FName Namespace ;
2021-01-13 10:48:59 -04:00
// Name of class.
2022-02-09 19:27:40 -05:00
UPROPERTY ( EditAnywhere , Category = General )
2021-01-28 19:02:51 -04:00
FName Name ;
2021-01-13 10:48:59 -04:00
// Variant of class. The Variant is used to describe an equivalent class which performs the same operation but on differing types.
2022-02-09 19:27:40 -05:00
UPROPERTY ( EditAnywhere , Category = General )
2021-01-28 19:02:51 -04:00
FName Variant ;
2021-01-13 10:48:59 -04:00
// Returns a full name of the class.
2021-01-28 19:02:51 -04:00
FName GetFullName ( ) const ;
// Returns scoped name representing namespace and name.
FName GetScopedName ( ) const ;
2021-05-03 17:52:04 -04:00
// Returns NodeClassName version of full name
Metasound : : FNodeClassName ToNodeClassName ( ) const
{
return { Namespace , Name , Variant } ;
}
2021-01-28 19:02:51 -04:00
// Return string version of full name.
FString ToString ( ) const ;
2021-01-13 10:48:59 -04:00
METASOUNDFRONTEND_API friend bool operator = = ( const FMetasoundFrontendClassName & InLHS , const FMetasoundFrontendClassName & InRHS ) ;
2021-07-27 15:36:03 -04:00
METASOUNDFRONTEND_API friend bool operator ! = ( const FMetasoundFrontendClassName & InLHS , const FMetasoundFrontendClassName & InRHS ) ;
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
2021-06-16 11:21:13 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendClassMetadata
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
2022-01-19 18:24:30 -05:00
// Generates class metadata intended to be used as a registry descriptor from FNodeClassMetadata. Does not initialize a change ID as it is not considered to be transactional.
2022-01-31 17:23:08 -05:00
static FMetasoundFrontendClassMetadata GenerateClassMetadata ( const Metasound : : FNodeClassMetadata & InNodeClassMetadata , EMetasoundFrontendClassType InType ) ;
2021-01-28 19:02:51 -04:00
2022-01-19 18:24:30 -05:00
private :
UPROPERTY ( VisibleAnywhere , Category = Metasound )
FMetasoundFrontendClassName ClassName ;
2021-01-13 10:48:59 -04:00
2022-01-19 18:24:30 -05:00
UPROPERTY ( VisibleAnywhere , Category = Metasound )
FMetasoundFrontendVersionNumber Version ;
2021-01-13 10:48:59 -04:00
2022-01-19 18:24:30 -05:00
UPROPERTY ( VisibleAnywhere , Category = Metasound )
EMetasoundFrontendClassType Type = EMetasoundFrontendClassType : : Invalid ;
2021-01-13 10:48:59 -04:00
2022-02-10 15:07:39 -05:00
# if WITH_EDITORONLY_DATA
2022-02-02 02:19:16 -05:00
UPROPERTY ( EditAnywhere , Category = Metasound )
2022-01-19 18:24:30 -05:00
FText DisplayName ;
2021-01-28 19:02:51 -04:00
2022-01-26 18:11:52 -05:00
UPROPERTY ( Transient )
FText DisplayNameTransient ;
2022-01-19 18:24:30 -05:00
UPROPERTY ( EditAnywhere , Category = Metasound )
FText Description ;
2021-01-13 10:48:59 -04:00
2022-01-26 18:11:52 -05:00
UPROPERTY ( Transient )
FText DescriptionTransient ;
// TODO: Move to using a non-localized hint path. Due to localization,
// loading & the fact that class registration happens on demand (post serialization),
// copying an FText to the referencing document can result in localization ids
// mismatched to different text when attempting to gather text.
UPROPERTY ( Transient )
FText PromptIfMissingTransient ;
2021-01-13 10:48:59 -04:00
2022-01-19 18:24:30 -05:00
UPROPERTY ( EditAnywhere , Category = Metasound )
2022-02-10 15:07:39 -05:00
FString Author ;
2022-01-26 18:11:52 -05:00
2022-02-02 02:19:16 -05:00
UPROPERTY ( EditAnywhere , Category = Metasound )
2022-01-19 18:24:30 -05:00
TArray < FText > Keywords ;
2021-01-20 00:42:47 -04:00
2022-01-26 18:11:52 -05:00
UPROPERTY ( Transient )
TArray < FText > KeywordsTransient ;
2022-01-19 18:24:30 -05:00
UPROPERTY ( EditAnywhere , Category = Metasound )
TArray < FText > CategoryHierarchy ;
2021-07-27 15:36:03 -04:00
2022-01-26 18:11:52 -05:00
UPROPERTY ( Transient )
TArray < FText > CategoryHierarchyTransient ;
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITORONLY_DATA
2022-01-19 18:24:30 -05:00
// If true, this node is deprecated and should not be used in new MetaSounds.
2022-02-02 02:19:16 -05:00
UPROPERTY ( EditAnywhere , Category = Metasound )
2022-01-19 18:24:30 -05:00
bool bIsDeprecated = false ;
2022-01-12 15:58:54 -05:00
2022-01-19 18:24:30 -05:00
// If true, auto-update will manage (add and remove)
// inputs/outputs associated with internally connected
// nodes when the interface of the given node is auto-updated.
UPROPERTY ( )
bool bAutoUpdateManagesInterface = false ;
2021-07-27 15:36:03 -04:00
2022-02-10 15:07:39 -05:00
# if WITH_EDITORONLY_DATA
2022-01-26 18:11:52 -05:00
// Whether or not the given metadata text should be serialized
// or is procedurally maintained via auto-update & the referenced
// registry class (to avoid localization text desync). Should be
// false for classes serialized as externally-defined dependencies
// or interfaces.
UPROPERTY ( )
bool bSerializeText = true ;
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITORONLY_DATA
2022-01-26 18:11:52 -05:00
2022-01-19 18:24:30 -05:00
// ID used to identify if any of the above have been modified,
// to determine if the parent class should be auto-updated.
UPROPERTY ( )
FGuid ChangeID ;
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
public :
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2022-01-19 18:24:30 -05:00
static FName GetAuthorPropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , Author ) ;
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
static FName GetCategoryHierarchyPropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , CategoryHierarchy ) ;
}
2021-08-09 15:13:40 -04:00
2022-02-02 02:19:16 -05:00
static FName GetDisplayNamePropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , DisplayName ) ;
}
2022-01-19 18:24:30 -05:00
static FName GetDescriptionPropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , Description ) ;
}
2021-07-27 15:36:03 -04:00
2022-02-02 02:19:16 -05:00
static FName GetIsDeprecatedPropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , bIsDeprecated ) ;
}
static FName GetKeywordsPropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , Keywords ) ;
}
2022-01-26 18:11:52 -05:00
static FName GetClassNamePropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , ClassName ) ;
}
2022-01-19 18:24:30 -05:00
static FName GetVersionPropertyName ( )
{
return GET_MEMBER_NAME_CHECKED ( FMetasoundFrontendClassMetadata , Version ) ;
}
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
const FMetasoundFrontendClassName & GetClassName ( ) const
{
return ClassName ;
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
void SetClassName ( const FMetasoundFrontendClassName & InClassName ) ;
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
EMetasoundFrontendClassType GetType ( ) const
{
return Type ;
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
const FMetasoundFrontendVersionNumber & GetVersion ( ) const
{
return Version ;
}
2021-07-27 15:36:03 -04:00
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2022-01-19 18:24:30 -05:00
const FText & GetDisplayName ( ) const
{
2022-01-26 18:11:52 -05:00
return bSerializeText ? DisplayName : DisplayNameTransient ;
2022-01-19 18:24:30 -05:00
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
const FText & GetDescription ( ) const
{
2022-01-26 18:11:52 -05:00
return bSerializeText ? Description : DescriptionTransient ;
2022-01-19 18:24:30 -05:00
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
const FText & GetPromptIfMissing ( ) const
{
2022-01-26 18:11:52 -05:00
return PromptIfMissingTransient ;
2022-01-19 18:24:30 -05:00
}
2021-07-27 15:36:03 -04:00
2022-02-10 15:07:39 -05:00
const FString & GetAuthor ( ) const
2022-01-19 18:24:30 -05:00
{
2022-02-10 15:07:39 -05:00
return Author ;
2022-01-19 18:24:30 -05:00
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
const TArray < FText > & GetKeywords ( ) const
{
2022-01-26 18:11:52 -05:00
return bSerializeText ? Keywords : KeywordsTransient ;
2022-01-19 18:24:30 -05:00
}
2021-07-27 15:36:03 -04:00
2022-01-19 18:24:30 -05:00
const TArray < FText > & GetCategoryHierarchy ( ) const
{
2022-01-26 18:11:52 -05:00
return bSerializeText ? CategoryHierarchy : CategoryHierarchyTransient ;
2022-01-19 18:24:30 -05:00
}
2021-07-27 15:36:03 -04:00
2022-02-10 15:07:39 -05:00
void SetAuthor ( const FString & InAuthor ) ;
2022-01-19 18:24:30 -05:00
void SetCategoryHierarchy ( const TArray < FText > & InCategoryHierarchy ) ;
void SetDescription ( const FText & InDescription ) ;
void SetDisplayName ( const FText & InDisplayName ) ;
void SetIsDeprecated ( bool bInIsDeprecated ) ;
void SetKeywords ( const TArray < FText > & InKeywords ) ;
void SetPromptIfMissing ( const FText & InPromptIfMissing ) ;
2021-07-27 15:36:03 -04:00
2022-01-26 18:11:52 -05:00
void SetSerializeText ( bool bInSerializeText ) ;
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2022-02-10 18:36:26 -05:00
void SetVersion ( const FMetasoundFrontendVersionNumber & InVersion ) ;
2022-02-10 15:07:39 -05:00
const FGuid & GetChangeID ( ) const
{
return ChangeID ;
}
bool GetIsDeprecated ( ) const
{
return bIsDeprecated ;
}
2022-01-26 18:11:52 -05:00
2022-01-19 18:24:30 -05:00
void SetType ( const EMetasoundFrontendClassType InType )
{
Type = InType ;
// TODO: Type is modified while querying and swapped between
// to be external, so don't modify the ChangeID in this case.
// External/Internal should probably be a separate field.
// ChangeID = FGuid::NewGuid();
}
2022-02-09 12:52:07 -05:00
// Deprecated field in favor of GraphClass PresetOptions
bool GetAndClearAutoUpdateManagesInterface_Deprecated ( )
{
bool bToReturn = bAutoUpdateManagesInterface ;
bAutoUpdateManagesInterface = false ;
return bToReturn ;
}
2021-01-13 10:48:59 -04:00
} ;
2022-05-02 12:35:54 -04:00
2021-01-23 12:59:01 -04:00
USTRUCT ( )
2021-01-13 10:48:59 -04:00
struct FMetasoundFrontendClassStyle
{
GENERATED_BODY ( )
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
2021-01-23 12:59:01 -04:00
FMetasoundFrontendClassStyleDisplay Display ;
2022-01-31 15:48:27 -05:00
// Generates class style from core node class metadata.
2022-01-31 17:23:08 -05:00
static FMetasoundFrontendClassStyle GenerateClassStyle ( const Metasound : : FNodeDisplayStyle & InNodeDisplayStyle ) ;
2022-02-02 02:19:16 -05:00
// Editor only ID that allows for pumping view to reflect changes to class.
void UpdateChangeID ( )
{
ChangeID = FGuid : : NewGuid ( ) ;
}
FGuid GetChangeID ( ) const
{
return ChangeID ;
}
private :
UPROPERTY ( Transient )
FGuid ChangeID ;
# endif // WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendClass
{
GENERATED_BODY ( )
virtual ~ FMetasoundFrontendClass ( ) = default ;
UPROPERTY ( )
2021-01-20 17:26:40 -04:00
FGuid ID = Metasound : : FrontendInvalidID ;
2021-01-13 10:48:59 -04:00
UPROPERTY ( EditAnywhere , Category = CustomView )
FMetasoundFrontendClassMetadata Metadata ;
UPROPERTY ( EditAnywhere , Category = CustomView )
FMetasoundFrontendClassInterface Interface ;
2022-05-02 12:35:54 -04:00
# if WITH_EDITORONLY_DATA
2021-01-13 10:48:59 -04:00
UPROPERTY ( )
FMetasoundFrontendClassStyle Style ;
2022-01-20 19:19:55 -05:00
2022-05-02 12:35:54 -04:00
# endif // WITH_EDITORONLY_DATA
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2022-01-20 19:19:55 -05:00
/*
2022-01-27 01:31:46 -05:00
* Caches transient style , class & vertex Metadata found in the registry
* on a passed ( presumed ) dependency . Only modifies properties that are
* not necessary for serialization or core graph generation .
2022-01-21 00:53:01 -05:00
*
* @ return - Whether class was found in the registry & data was cached successfully .
2022-01-20 19:19:55 -05:00
*/
2022-01-27 01:31:46 -05:00
static bool CacheGraphDependencyMetadataFromRegistry ( FMetasoundFrontendClass & InOutDependency ) ;
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2021-01-13 10:48:59 -04:00
} ;
2022-02-09 12:52:07 -05:00
// Preset options related to a parent graph class. A graph class with bIsPreset set to true
// auto-updates to mirror the interface members (inputs & outputs) of the single, referenced
// node. It also connects all of these nodes' interface members on update to corresponding inputs
// & outputs, and inherits input defaults from the referenced node unless otherwise specified.
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendGraphClassPresetOptions
{
GENERATED_BODY ( )
// Whether or not graph class is a preset or not.
UPROPERTY ( )
bool bIsPreset = false ;
// Names of all inputs inheriting default values from the referenced node. All input names
// in this set have their default value set on update when registered with the Frontend Class
// Registry. Omitted inputs remain using the pre-existing, serialized default values.
UPROPERTY ( )
TSet < FName > InputsInheritingDefault ;
} ;
2021-01-13 10:48:59 -04:00
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendGraphClass : public FMetasoundFrontendClass
{
GENERATED_BODY ( )
FMetasoundFrontendGraphClass ( ) ;
virtual ~ FMetasoundFrontendGraphClass ( ) = default ;
UPROPERTY ( )
FMetasoundFrontendGraph Graph ;
2022-02-09 12:52:07 -05:00
UPROPERTY ( )
FMetasoundFrontendGraphClassPresetOptions PresetOptions ;
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
2022-05-10 16:51:39 -04:00
struct METASOUNDFRONTEND_API FMetasoundFrontendDocumentMetadata
2021-01-13 10:48:59 -04:00
{
GENERATED_BODY ( )
UPROPERTY ( )
2021-05-28 14:09:45 -04:00
FMetasoundFrontendVersion Version ;
2021-01-13 10:48:59 -04:00
} ;
USTRUCT ( )
struct METASOUNDFRONTEND_API FMetasoundFrontendDocument
{
GENERATED_BODY ( )
2022-08-19 12:14:31 -04:00
static FMetasoundFrontendVersionNumber GetMaxVersion ( ) ;
2021-01-13 10:48:59 -04:00
Metasound : : Frontend : : FAccessPoint AccessPoint ;
FMetasoundFrontendDocument ( ) ;
UPROPERTY ( EditAnywhere , Category = Metadata )
FMetasoundFrontendDocumentMetadata Metadata ;
2021-12-10 20:37:31 -05:00
public :
UPROPERTY ( VisibleAnywhere , Category = CustomView )
TSet < FMetasoundFrontendVersion > Interfaces ;
2021-11-22 15:55:50 -05:00
2021-01-13 10:48:59 -04:00
UPROPERTY ( EditAnywhere , Category = CustomView )
FMetasoundFrontendGraphClass RootGraph ;
UPROPERTY ( )
TArray < FMetasoundFrontendGraphClass > Subgraphs ;
UPROPERTY ( )
TArray < FMetasoundFrontendClass > Dependencies ;
2021-12-10 20:37:31 -05:00
private :
UPROPERTY ( meta = ( DeprecatedProperty , DeprecationMessage = " 5.0 - ArchetypeVersion has been migrated to InterfaceVersions array. " ) )
FMetasoundFrontendVersion ArchetypeVersion ;
UPROPERTY ( meta = ( DeprecatedProperty , DeprecationMessage = " 5.0 - InterfaceVersions has been migrated to Interfaces set. " ) )
TArray < FMetasoundFrontendVersion > InterfaceVersions ;
public :
// Data migration for 5.0 Early Access data. ArchetypeVersion/InterfaceVersions properties can be removed post 5.0 release
// and this fix-up can be removed post 5.0 release.
bool VersionInterfaces ( )
{
bool bDidEdit = false ;
if ( ArchetypeVersion . IsValid ( ) )
{
Interfaces . Add ( ArchetypeVersion ) ;
ArchetypeVersion = FMetasoundFrontendVersion : : GetInvalid ( ) ;
bDidEdit = true ;
}
if ( ! InterfaceVersions . IsEmpty ( ) )
{
Interfaces . Append ( InterfaceVersions ) ;
InterfaceVersions . Reset ( ) ;
bDidEdit = true ;
}
return bDidEdit ;
}
2021-01-13 10:48:59 -04:00
} ;
2022-06-02 10:50:07 -04:00
METASOUNDFRONTEND_API const TCHAR * LexToString ( EMetasoundFrontendVertexAccessType InVertexAccess ) ;