2020-07-20 00:05:22 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "MetasoundFrontendRegistries.h"
2021-01-13 10:48:59 -04:00
2020-07-20 00:05:22 -04:00
# include "CoreMinimal.h"
2021-01-13 10:48:59 -04:00
# include "MetasoundLog.h"
2020-07-20 13:14:38 -04:00
# include "Misc/ScopeLock.h"
# include "HAL/PlatformTime.h"
2020-07-20 00:05:22 -04:00
# ifndef WITH_METASOUND_FRONTEND
# define WITH_METASOUND_FRONTEND 0
# endif
2020-11-24 15:24:29 -04:00
namespace MetasoundFrontendRegistryPrivate
{
// All registry keys should be created through this function to ensure consistency.
Metasound : : Frontend : : FNodeRegistryKey GetRegistryKey ( const FName & InClassName , int32 InMajorVersion )
{
Metasound : : Frontend : : FNodeRegistryKey Key ;
2021-01-28 19:02:51 -04:00
Key . NodeClassFullName = InClassName ;
2020-11-24 15:24:29 -04:00
// NodeHash is hash of node name and major version.
2021-01-28 19:02:51 -04:00
Key . NodeHash = FCrc : : StrCrc32 ( * Key . NodeClassFullName . ToString ( ) ) ;
2020-11-24 15:24:29 -04:00
Key . NodeHash = HashCombine ( Key . NodeHash , FCrc : : TypeCrc32 ( InMajorVersion ) ) ;
return Key ;
}
}
2020-07-20 00:05:22 -04:00
FMetasoundFrontendRegistryContainer : : FMetasoundFrontendRegistryContainer ( )
: bHasModuleBeenInitialized ( false )
{
}
FMetasoundFrontendRegistryContainer * FMetasoundFrontendRegistryContainer : : LazySingleton = nullptr ;
FMetasoundFrontendRegistryContainer * FMetasoundFrontendRegistryContainer : : Get ( )
{
if ( ! LazySingleton )
{
LazySingleton = new FMetasoundFrontendRegistryContainer ( ) ;
}
return LazySingleton ;
}
void FMetasoundFrontendRegistryContainer : : ShutdownMetasoundFrontend ( )
{
if ( LazySingleton )
{
delete LazySingleton ;
LazySingleton = nullptr ;
}
}
void FMetasoundFrontendRegistryContainer : : InitializeFrontend ( )
{
FScopeLock ScopeLock ( & LazyInitCommandCritSection ) ;
if ( bHasModuleBeenInitialized )
{
// this function should only be called once.
checkNoEntry ( ) ;
}
UE_LOG ( LogTemp , Display , TEXT ( " Initializing Metasounds Frontend. " ) ) ;
uint64 CurrentTime = FPlatformTime : : Cycles64 ( ) ;
for ( TUniqueFunction < void ( ) > & Command : LazyInitCommands )
{
Command ( ) ;
}
LazyInitCommands . Empty ( ) ;
bHasModuleBeenInitialized = true ;
uint64 CyclesUsed = FPlatformTime : : Cycles64 ( ) - CurrentTime ;
UE_LOG ( LogTemp , Display , TEXT ( " Initializing Metasounds Frontend took %f seconds. " ) , FPlatformTime : : ToSeconds64 ( CyclesUsed ) ) ;
}
bool FMetasoundFrontendRegistryContainer : : EnqueueInitCommand ( TUniqueFunction < void ( ) > & & InFunc )
{
// if the module has been initalized already, we can safely call this function now.
if ( bHasModuleBeenInitialized )
{
InFunc ( ) ;
}
// otherwise, we enqueue the function to be executed after the frontend module has been initialized.
if ( LazyInitCommands . Num ( ) > = MaxNumNodesAndDatatypesToInitialize )
{
UE_LOG ( LogTemp , Warning , TEXT ( " Registering more that %d nodes and datatypes for metasounds! Consider increasing MetasoundFrontendRegistryContainer::MaxNumNodesAndDatatypesToInitialize. " ) ) ;
}
LazyInitCommands . Add ( MoveTemp ( InFunc ) ) ;
return true ;
}
TMap < FMetasoundFrontendRegistryContainer : : FNodeRegistryKey , FMetasoundFrontendRegistryContainer : : FNodeRegistryElement > & FMetasoundFrontendRegistryContainer : : GetExternalNodeRegistry ( )
{
return ExternalNodeRegistry ;
}
2020-08-13 19:07:41 -04:00
TUniquePtr < Metasound : : INode > FMetasoundFrontendRegistryContainer : : ConstructInputNode ( const FName & InInputType , Metasound : : FInputNodeConstructorParams & & InParams )
2020-07-20 00:05:22 -04:00
{
if ( ensureAlwaysMsgf ( DataTypeRegistry . Contains ( InInputType ) , TEXT ( " Couldn't find data type %s! " ) , * InInputType . ToString ( ) ) )
{
2020-11-24 15:24:29 -04:00
return DataTypeRegistry [ InInputType ] . Callbacks . CreateInputNode ( MoveTemp ( InParams ) ) ;
2020-07-20 00:05:22 -04:00
}
else
{
return nullptr ;
}
}
2021-01-13 10:48:59 -04:00
TUniquePtr < Metasound : : INode > FMetasoundFrontendRegistryContainer : : ConstructOutputNode ( const FName & InOutputType , const Metasound : : FOutputNodeConstructorParams & InParams )
2020-07-20 00:05:22 -04:00
{
if ( ensureAlwaysMsgf ( DataTypeRegistry . Contains ( InOutputType ) , TEXT ( " Couldn't find data type %s! " ) , * InOutputType . ToString ( ) ) )
{
2020-11-24 15:24:29 -04:00
return DataTypeRegistry [ InOutputType ] . Callbacks . CreateOutputNode ( InParams ) ;
2020-07-20 00:05:22 -04:00
}
else
{
return nullptr ;
}
}
2021-01-13 10:48:59 -04:00
Metasound : : FLiteral FMetasoundFrontendRegistryContainer : : GenerateLiteralForUObject ( const FName & InDataType , UObject * InObject )
2020-08-13 19:07:41 -04:00
{
if ( ensureAlwaysMsgf ( DataTypeRegistry . Contains ( InDataType ) , TEXT ( " Couldn't find data type %s! " ) , * InDataType . ToString ( ) ) )
{
2020-11-24 15:24:29 -04:00
Audio : : IProxyDataPtr ProxyPtr = DataTypeRegistry [ InDataType ] . Callbacks . CreateAudioProxy ( InObject ) ;
2020-08-13 19:07:41 -04:00
if ( ensureAlwaysMsgf ( ProxyPtr . IsValid ( ) , TEXT ( " UObject failed to create a valid proxy! " ) ) )
{
2021-01-13 10:48:59 -04:00
return Metasound : : FLiteral ( MoveTemp ( ProxyPtr ) ) ;
2020-08-13 19:07:41 -04:00
}
else
{
2021-01-13 10:48:59 -04:00
return Metasound : : FLiteral ( ) ;
2020-08-13 19:07:41 -04:00
}
}
else
{
2021-01-13 10:48:59 -04:00
return Metasound : : FLiteral ( ) ;
2020-08-13 19:07:41 -04:00
}
}
2021-01-13 10:48:59 -04:00
Metasound : : FLiteral FMetasoundFrontendRegistryContainer : : GenerateLiteralForUObjectArray ( const FName & InDataType , TArray < UObject * > InObjectArray )
2020-08-13 19:07:41 -04:00
{
if ( ensureAlwaysMsgf ( DataTypeRegistry . Contains ( InDataType ) , TEXT ( " Couldn't find data type %s! " ) , * InDataType . ToString ( ) ) )
{
TArray < Audio : : IProxyDataPtr > ProxyArray ;
for ( UObject * InObject : InObjectArray )
{
if ( InObject )
{
2020-11-24 15:24:29 -04:00
Audio : : IProxyDataPtr ProxyPtr = DataTypeRegistry [ InDataType ] . Callbacks . CreateAudioProxy ( InObject ) ;
2020-08-13 19:07:41 -04:00
ensureAlwaysMsgf ( ProxyPtr . IsValid ( ) , TEXT ( " UObject failed to create a valid proxy! " ) ) ;
ProxyArray . Add ( MoveTemp ( ProxyPtr ) ) ;
}
}
2021-01-13 10:48:59 -04:00
return Metasound : : FLiteral ( MoveTemp ( ProxyArray ) ) ;
2020-08-13 19:07:41 -04:00
}
else
{
2021-01-13 10:48:59 -04:00
return Metasound : : FLiteral ( ) ;
2020-08-13 19:07:41 -04:00
}
}
2021-01-28 19:02:51 -04:00
TUniquePtr < Metasound : : INode > FMetasoundFrontendRegistryContainer : : ConstructExternalNode ( const FName & InNodeClassFullName , uint32 InNodeHash , const Metasound : : FNodeInitData & InInitData )
2020-07-20 00:05:22 -04:00
{
Metasound : : Frontend : : FNodeRegistryKey RegistryKey ;
2021-01-28 19:02:51 -04:00
RegistryKey . NodeClassFullName = InNodeClassFullName ;
2020-07-20 00:05:22 -04:00
RegistryKey . NodeHash = InNodeHash ;
if ( ! ExternalNodeRegistry . Contains ( RegistryKey ) )
{
return nullptr ;
}
else
{
2020-11-24 15:24:29 -04:00
return ExternalNodeRegistry [ RegistryKey ] . CreateNode ( InInitData ) ;
2020-07-20 00:05:22 -04:00
}
}
2020-08-26 14:16:05 -04:00
TArray < : : Metasound : : Frontend : : FConverterNodeInfo > FMetasoundFrontendRegistryContainer : : GetPossibleConverterNodes ( const FName & FromDataType , const FName & ToDataType )
{
FConverterNodeRegistryKey InKey = { FromDataType , ToDataType } ;
if ( ! ConverterNodeRegistry . Contains ( InKey ) )
{
return TArray < FConverterNodeInfo > ( ) ;
}
else
{
return ConverterNodeRegistry [ InKey ] . PotentialConverterNodes ;
}
}
2021-01-13 10:48:59 -04:00
Metasound : : ELiteralType FMetasoundFrontendRegistryContainer : : GetDesiredLiteralTypeForDataType ( FName InDataType ) const
2020-07-20 00:05:22 -04:00
{
if ( ! DataTypeRegistry . Contains ( InDataType ) )
{
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : Invalid ;
2020-07-20 00:05:22 -04:00
}
const FDataTypeRegistryElement & DataTypeInfo = DataTypeRegistry [ InDataType ] ;
2021-02-09 14:46:26 -04:00
if ( DataTypeInfo . Info . bIsEnum )
{
return Metasound : : ELiteralType : : Integer ;
}
2020-07-20 00:05:22 -04:00
// If there's a designated preferred literal type for this datatype, use that.
2021-01-13 10:48:59 -04:00
if ( DataTypeInfo . Info . PreferredLiteralType ! = Metasound : : ELiteralType : : None )
2020-07-20 00:05:22 -04:00
{
return DataTypeInfo . Info . PreferredLiteralType ;
}
// Otherwise, we opt for the highest precision construction option available.
if ( DataTypeInfo . Info . bIsStringParsable )
{
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : String ;
2020-07-20 00:05:22 -04:00
}
else if ( DataTypeInfo . Info . bIsFloatParsable )
{
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : Float ;
2020-07-20 00:05:22 -04:00
}
else if ( DataTypeInfo . Info . bIsIntParsable )
{
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : Integer ;
2020-07-20 00:05:22 -04:00
}
else if ( DataTypeInfo . Info . bIsBoolParsable )
{
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : Boolean ;
2020-07-20 00:05:22 -04:00
}
2020-11-11 18:54:59 -04:00
else if ( DataTypeInfo . Info . bIsDefaultParsable )
2020-07-20 00:05:22 -04:00
{
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : None ;
2020-07-20 00:05:22 -04:00
}
else
{
// if we ever hit this, something has gone terribly wrong with the REGISTER_METASOUND_DATATYPE macro.
// we should have failed to compile if any of these are false.
checkNoEntry ( ) ;
2021-01-13 10:48:59 -04:00
return Metasound : : ELiteralType : : Invalid ;
2020-07-20 00:05:22 -04:00
}
}
2020-08-13 19:07:41 -04:00
UClass * FMetasoundFrontendRegistryContainer : : GetLiteralUClassForDataType ( FName InDataType ) const
{
if ( ! DataTypeRegistry . Contains ( InDataType ) )
{
2021-02-03 14:36:36 -04:00
ensureAlwaysMsgf ( false , TEXT ( " DataType %s not registered. " ) , * InDataType . ToString ( ) ) ;
2020-08-13 19:07:41 -04:00
return nullptr ;
}
else
{
return DataTypeRegistry [ InDataType ] . Info . ProxyGeneratorClass ;
}
}
2021-01-13 10:48:59 -04:00
bool FMetasoundFrontendRegistryContainer : : DoesDataTypeSupportLiteralType ( FName InDataType , Metasound : : ELiteralType InLiteralType ) const
2020-07-20 00:05:22 -04:00
{
if ( ! DataTypeRegistry . Contains ( InDataType ) )
{
2021-02-03 14:36:36 -04:00
ensureAlwaysMsgf ( false , TEXT ( " DataType %s not registered. " ) , * InDataType . ToString ( ) ) ;
2020-07-20 00:05:22 -04:00
return false ;
}
const FDataTypeRegistryElement & DataTypeInfo = DataTypeRegistry [ InDataType ] ;
switch ( InLiteralType )
{
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : Boolean :
2020-07-20 00:05:22 -04:00
{
return DataTypeInfo . Info . bIsBoolParsable ;
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : Integer :
2020-07-20 00:05:22 -04:00
{
return DataTypeInfo . Info . bIsIntParsable ;
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : Float :
2020-07-20 00:05:22 -04:00
{
return DataTypeInfo . Info . bIsFloatParsable ;
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : String :
2020-07-20 00:05:22 -04:00
{
return DataTypeInfo . Info . bIsStringParsable ;
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : UObjectProxy :
2020-08-13 19:07:41 -04:00
{
return DataTypeInfo . Info . bIsProxyParsable ;
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : UObjectProxyArray :
2020-08-13 19:07:41 -04:00
{
return DataTypeInfo . Info . bIsProxyArrayParsable ;
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : None :
2020-07-20 00:05:22 -04:00
{
2020-11-11 18:54:59 -04:00
return DataTypeInfo . Info . bIsDefaultParsable ;
2020-07-20 00:05:22 -04:00
}
2021-01-13 10:48:59 -04:00
case Metasound : : ELiteralType : : Invalid :
2020-07-20 00:05:22 -04:00
default :
{
return false ;
}
}
}
2021-01-13 10:48:59 -04:00
bool FMetasoundFrontendRegistryContainer : : RegisterDataType ( const : : Metasound : : FDataTypeRegistryInfo & InDataInfo , const : : Metasound : : FDataTypeConstructorCallbacks & InCallbacks )
2020-07-20 00:05:22 -04:00
{
2021-01-27 00:58:56 -04:00
if ( ! ensureAlwaysMsgf ( ! DataTypeRegistry . Contains ( InDataInfo . DataTypeName ) ,
TEXT ( " Name collision when trying to register Metasound Data Type %s! DataType must have "
" unique name and REGISTER_METASOUND_DATATYPE cannot be called in a public header. " ) ,
* InDataInfo . DataTypeName . ToString ( ) ) )
2020-07-20 00:05:22 -04:00
{
// todo: capture callstack for previous declaration for non-shipping builds to help clarify who already registered this name for a type.
return false ;
}
else
{
2021-01-13 10:48:59 -04:00
FDataTypeRegistryElement InElement = { InCallbacks , InDataInfo } ;
DataTypeRegistry . Add ( InDataInfo . DataTypeName , InElement ) ;
Metasound : : Frontend : : FNodeRegistryKey InputNodeRegistryKey = GetRegistryKey ( InCallbacks . CreateFrontendInputClass ( ) . Metadata ) ;
DataTypeNodeRegistry . Add ( InputNodeRegistryKey , InElement ) ;
Metasound : : Frontend : : FNodeRegistryKey OutputNodeRegistryKey = GetRegistryKey ( InCallbacks . CreateFrontendOutputClass ( ) . Metadata ) ;
DataTypeNodeRegistry . Add ( OutputNodeRegistryKey , InElement ) ;
UE_LOG ( LogMetasound , Display , TEXT ( " Registered Metasound Datatype %s. " ) , * InDataInfo . DataTypeName . ToString ( ) ) ;
2020-07-20 00:05:22 -04:00
return true ;
}
}
2021-02-09 14:46:26 -04:00
bool FMetasoundFrontendRegistryContainer : : RegisterEnumDataInterface ( FName InDataType , TSharedPtr < IEnumDataTypeInterface > & & InInterface )
{
if ( FDataTypeRegistryElement * Element = DataTypeRegistry . Find ( InDataType ) )
{
Element - > EnumInterface = MoveTemp ( InInterface ) ;
return true ;
}
return false ;
}
2021-01-13 10:48:59 -04:00
bool FMetasoundFrontendRegistryContainer : : RegisterExternalNode ( Metasound : : FCreateMetasoundNodeFunction & & InCreateNode , Metasound : : FCreateMetasoundFrontendClassFunction & & InCreateDescription )
2020-07-20 00:05:22 -04:00
{
2020-11-24 15:24:29 -04:00
FNodeRegistryElement RegistryElement = FNodeRegistryElement ( MoveTemp ( InCreateNode ) , MoveTemp ( InCreateDescription ) ) ;
2020-07-20 00:05:22 -04:00
2020-11-24 15:24:29 -04:00
FNodeRegistryKey Key ;
if ( ensure ( FMetasoundFrontendRegistryContainer : : GetRegistryKey ( RegistryElement , Key ) ) )
2020-07-20 00:05:22 -04:00
{
2020-11-24 15:24:29 -04:00
// check to see if an identical node was already registered, and log
2021-01-28 19:02:51 -04:00
ensureAlwaysMsgf ( ! ExternalNodeRegistry . Contains ( Key ) , TEXT ( " Node with identical name, inputs and outputs to node %s was already registered. The previously registered node will be overwritten. This could also happen because METASOUND_REGISTER_NODE is in a public header. " ) , * Key . NodeClassFullName . ToString ( ) ) ;
2020-11-24 15:24:29 -04:00
ExternalNodeRegistry . Add ( MoveTemp ( Key ) , MoveTemp ( RegistryElement ) ) ;
return true ;
2020-07-20 00:05:22 -04:00
}
2020-11-24 15:24:29 -04:00
return false ;
}
2020-07-20 00:05:22 -04:00
2020-11-24 15:24:29 -04:00
bool FMetasoundFrontendRegistryContainer : : GetRegistryKey ( const Metasound : : Frontend : : FNodeRegistryElement & InElement , Metasound : : Frontend : : FNodeRegistryKey & OutKey )
{
2021-01-13 10:48:59 -04:00
if ( InElement . CreateFrontendClass )
2020-07-20 00:05:22 -04:00
{
2021-01-13 10:48:59 -04:00
FMetasoundFrontendClass FrontendClass = InElement . CreateFrontendClass ( ) ;
2020-07-20 00:05:22 -04:00
2021-01-13 10:48:59 -04:00
OutKey = GetRegistryKey ( FrontendClass . Metadata ) ;
2020-11-24 15:24:29 -04:00
return true ;
2020-07-20 00:05:22 -04:00
}
2020-11-24 15:24:29 -04:00
return false ;
}
2020-08-26 14:16:05 -04:00
2021-01-28 19:02:51 -04:00
Metasound : : Frontend : : FNodeRegistryKey FMetasoundFrontendRegistryContainer : : GetRegistryKey ( const FNodeClassMetadata & InNodeMetadata )
2020-11-24 15:24:29 -04:00
{
2021-01-28 19:02:51 -04:00
return MetasoundFrontendRegistryPrivate : : GetRegistryKey ( InNodeMetadata . ClassName . GetFullName ( ) , InNodeMetadata . MajorVersion ) ;
2020-07-20 00:05:22 -04:00
}
2021-01-13 10:48:59 -04:00
Metasound : : Frontend : : FNodeRegistryKey FMetasoundFrontendRegistryContainer : : GetRegistryKey ( const FMetasoundFrontendClassMetadata & InNodeMetadata )
{
2021-01-28 19:02:51 -04:00
return MetasoundFrontendRegistryPrivate : : GetRegistryKey ( InNodeMetadata . ClassName . GetFullName ( ) , InNodeMetadata . Version . Major ) ;
2021-01-13 10:48:59 -04:00
}
bool FMetasoundFrontendRegistryContainer : : GetFrontendClassFromRegistered ( const FMetasoundFrontendClassMetadata & InMetadata , FMetasoundFrontendClass & OutClass )
{
FMetasoundFrontendRegistryContainer * Registry = FMetasoundFrontendRegistryContainer : : Get ( ) ;
if ( ensure ( nullptr ! = Registry ) )
{
Metasound : : Frontend : : FNodeRegistryKey RegistryKey = GetRegistryKey ( InMetadata ) ;
if ( InMetadata . Type = = EMetasoundFrontendClassType : : External )
{
if ( Registry - > ExternalNodeRegistry . Contains ( RegistryKey ) )
{
OutClass = Registry - > ExternalNodeRegistry [ RegistryKey ] . CreateFrontendClass ( ) ;
return true ;
}
}
else if ( InMetadata . Type = = EMetasoundFrontendClassType : : Input )
{
if ( Registry - > DataTypeNodeRegistry . Contains ( RegistryKey ) )
{
OutClass = Registry - > DataTypeNodeRegistry [ RegistryKey ] . Callbacks . CreateFrontendInputClass ( ) ;
return true ;
}
}
else if ( InMetadata . Type = = EMetasoundFrontendClassType : : Output )
{
if ( Registry - > DataTypeNodeRegistry . Contains ( RegistryKey ) )
{
OutClass = Registry - > DataTypeNodeRegistry [ RegistryKey ] . Callbacks . CreateFrontendOutputClass ( ) ;
return true ;
}
}
}
return false ;
}
bool FMetasoundFrontendRegistryContainer : : GetInputNodeClassMetadataForDataType ( const FName & InDataTypeName , FMetasoundFrontendClassMetadata & OutMetadata )
{
if ( FMetasoundFrontendRegistryContainer * Registry = FMetasoundFrontendRegistryContainer : : Get ( ) )
{
if ( Registry - > DataTypeRegistry . Contains ( InDataTypeName ) )
{
OutMetadata = Registry - > DataTypeRegistry [ InDataTypeName ] . Callbacks . CreateFrontendInputClass ( ) . Metadata ;
return true ;
}
}
return false ;
}
bool FMetasoundFrontendRegistryContainer : : GetOutputNodeClassMetadataForDataType ( const FName & InDataTypeName , FMetasoundFrontendClassMetadata & OutMetadata )
{
if ( FMetasoundFrontendRegistryContainer * Registry = FMetasoundFrontendRegistryContainer : : Get ( ) )
{
if ( Registry - > DataTypeRegistry . Contains ( InDataTypeName ) )
{
OutMetadata = Registry - > DataTypeRegistry [ InDataTypeName ] . Callbacks . CreateFrontendOutputClass ( ) . Metadata ;
return true ;
}
}
return false ;
}
2020-08-26 14:16:05 -04:00
bool FMetasoundFrontendRegistryContainer : : RegisterConversionNode ( const FConverterNodeRegistryKey & InNodeKey , const FConverterNodeInfo & InNodeInfo )
{
if ( ! ConverterNodeRegistry . Contains ( InNodeKey ) )
{
ConverterNodeRegistry . Add ( InNodeKey ) ;
}
FConverterNodeRegistryValue & ConverterNodeList = ConverterNodeRegistry [ InNodeKey ] ;
if ( ensureAlways ( ! ConverterNodeList . PotentialConverterNodes . Contains ( InNodeInfo ) ) )
{
ConverterNodeList . PotentialConverterNodes . Add ( InNodeInfo ) ;
return true ;
}
else
{
// If we hit this, someone attempted to add the same converter node to our list multiple times.
return false ;
}
}
2020-07-20 00:05:22 -04:00
TArray < FName > FMetasoundFrontendRegistryContainer : : GetAllValidDataTypes ( )
{
TArray < FName > OutDataTypes ;
for ( auto & DataTypeTuple : DataTypeRegistry )
{
OutDataTypes . Add ( DataTypeTuple . Key ) ;
}
return OutDataTypes ;
}
bool FMetasoundFrontendRegistryContainer : : GetInfoForDataType ( FName InDataType , Metasound : : FDataTypeRegistryInfo & OutInfo )
{
if ( ! DataTypeRegistry . Contains ( InDataType ) )
{
return false ;
}
else
{
OutInfo = DataTypeRegistry [ InDataType ] . Info ;
return true ;
}
}
2021-02-09 14:46:26 -04:00
TSharedPtr < const Metasound : : Frontend : : IEnumDataTypeInterface >
FMetasoundFrontendRegistryContainer : : GetEnumInterfaceForDataType ( FName InDataType ) const
{
if ( const FDataTypeRegistryElement * Element = DataTypeRegistry . Find ( InDataType ) )
{
return Element - > EnumInterface ;
}
return nullptr ;
}