2020-05-22 23:46:09 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# pragma once
2022-06-02 10:50:07 -04:00
# include "MetasoundBuilderInterface.h"
2022-10-10 15:44:28 -04:00
# include "MetasoundBuildError.h"
2021-05-20 19:33:21 -04:00
# include "MetasoundDataReference.h"
2023-01-23 14:24:03 -05:00
# include "MetasoundExecutableOperator.h"
2022-06-02 10:50:07 -04:00
# include "MetasoundFrontendDataTypeTraits.h"
2022-10-10 15:44:28 -04:00
# include "MetasoundNodeConstructorParams.h"
2022-06-02 10:50:07 -04:00
# include "MetasoundLiteral.h"
# include "MetasoundNode.h"
2020-05-22 23:46:09 -04:00
# include "MetasoundNodeInterface.h"
2021-05-28 14:09:45 -04:00
# include "MetasoundOperatorInterface.h"
2022-06-02 10:50:07 -04:00
# include "MetasoundVertexData.h"
# include "UObject/NameTypes.h"
2020-05-22 23:46:09 -04:00
namespace Metasound
{
2023-01-23 14:24:03 -05:00
namespace MetasoundInputNodePrivate
2020-11-04 14:26:37 -04:00
{
2024-02-08 19:25:13 -05:00
class METASOUNDFRONTEND_API FNonExecutableInputOperatorBase : public IOperator
2023-01-23 14:24:03 -05:00
{
public :
2023-05-16 16:02:58 -04:00
virtual void BindInputs ( FInputVertexInterfaceData & InOutVertexData ) override ;
virtual void BindOutputs ( FOutputVertexInterfaceData & InOutVertexData ) override ;
2023-04-05 17:38:47 -04:00
2023-01-23 14:24:03 -05:00
virtual IOperator : : FExecuteFunction GetExecuteFunction ( ) override ;
2023-04-05 17:38:47 -04:00
virtual IOperator : : FPostExecuteFunction GetPostExecuteFunction ( ) override ;
virtual IOperator : : FResetFunction GetResetFunction ( ) override ;
2023-01-23 14:24:03 -05:00
protected :
FNonExecutableInputOperatorBase ( const FVertexName & InVertexName , FAnyDataReference & & InDataRef ) ;
FVertexName VertexName ;
FAnyDataReference DataRef ;
} ;
2023-02-22 17:54:26 -05:00
2023-01-23 14:24:03 -05:00
class METASOUNDFRONTEND_API FNonExecutableInputPassThroughOperator : public FNonExecutableInputOperatorBase
{
public :
template < typename DataType >
FNonExecutableInputPassThroughOperator ( const FVertexName & InVertexName , const TDataReadReference < DataType > & InDataRef )
: FNonExecutableInputOperatorBase ( InVertexName , FAnyDataReference { InDataRef } )
{
}
2023-04-05 17:38:47 -04:00
template < typename DataType >
FNonExecutableInputPassThroughOperator ( const FVertexName & InVertexName , const TDataWriteReference < DataType > & InDataRef )
: FNonExecutableInputPassThroughOperator ( InVertexName , TDataReadReference < DataType > ( InDataRef ) )
{
}
2023-01-23 14:24:03 -05:00
} ;
2023-02-22 17:54:26 -05:00
/** TInputValueOperator provides an input for value references. */
template < typename DataType >
class TInputValueOperator : public FNonExecutableInputOperatorBase
2023-01-23 14:24:03 -05:00
{
public :
2023-02-22 17:54:26 -05:00
/** Construct an TInputValueOperator with the name of the vertex and the
2023-01-23 14:24:03 -05:00
* value reference associated with input .
*/
2023-02-22 17:54:26 -05:00
explicit TInputValueOperator ( const FName & InVertexName , const TDataValueReference < DataType > & InValueRef )
2023-01-23 14:24:03 -05:00
: FNonExecutableInputOperatorBase ( InVertexName , FAnyDataReference { InValueRef } )
{
}
2023-02-22 17:54:26 -05:00
TInputValueOperator ( const FVertexName & InVertexName , const FOperatorSettings & InSettings , const FLiteral & InLiteral )
: FNonExecutableInputOperatorBase ( InVertexName , FAnyDataReference { TDataValueReferenceLiteralFactory < DataType > : : CreateExplicitArgs ( InSettings , InLiteral ) } )
{
}
} ;
2023-01-23 14:24:03 -05:00
template < typename DataType >
2024-02-08 19:25:13 -05:00
class TExecutableInputOperator : public IOperator
2023-01-23 14:24:03 -05:00
{
static_assert ( TExecutableDataType < DataType > : : bIsExecutable , " TExecutableInputOperatorBase should only be used with executable data types " ) ;
2020-11-04 14:26:37 -04:00
public :
using FDataWriteReference = TDataWriteReference < DataType > ;
2024-02-08 19:25:13 -05:00
UE_DEPRECATED ( 5.4 , " The Executable data types will no longer be supported. Please use PostExecutable data types. " )
2023-04-05 17:38:47 -04:00
TExecutableInputOperator ( const FVertexName & InDataReferenceName , TDataWriteReference < DataType > InValue )
2021-03-23 17:55:31 -04:00
: DataReferenceName ( InDataReferenceName )
2023-04-05 17:38:47 -04:00
, InputValue ( InValue )
2024-02-08 19:25:13 -05:00
, OutputValue ( FDataWriteReference : : CreateNew ( * InValue ) )
2020-11-04 14:26:37 -04:00
{
}
2023-05-16 16:02:58 -04:00
virtual void BindInputs ( FInputVertexInterfaceData & InOutVertexData ) override
2020-11-04 14:26:37 -04:00
{
2023-05-16 16:02:58 -04:00
InOutVertexData . BindWriteVertex ( DataReferenceName , InputValue ) ;
}
virtual void BindOutputs ( FOutputVertexInterfaceData & InOutVertexData ) override
{
InOutVertexData . BindReadVertex ( DataReferenceName , OutputValue ) ;
2020-11-04 14:26:37 -04:00
}
virtual FExecuteFunction GetExecuteFunction ( ) override
{
2023-01-23 14:24:03 -05:00
return & Execute ;
}
2024-02-08 19:25:13 -05:00
virtual FExecuteFunction GetPostExecuteFunction ( ) override
{
return nullptr ;
}
2023-02-22 17:54:26 -05:00
virtual FResetFunction GetResetFunction ( ) override
{
2023-04-05 17:38:47 -04:00
return nullptr ;
2023-02-22 17:54:26 -05:00
}
2023-04-05 17:38:47 -04:00
protected :
2023-02-22 17:54:26 -05:00
2023-01-23 14:24:03 -05:00
static void Execute ( IOperator * InOperator )
{
using FExecutableInputOperator = TExecutableInputOperator < DataType > ;
FExecutableInputOperator * DerivedOperator = static_cast < FExecutableInputOperator * > ( InOperator ) ;
check ( nullptr ! = DerivedOperator ) ;
TExecutableDataType < DataType > : : Execute ( * ( DerivedOperator - > InputValue ) , * ( DerivedOperator - > OutputValue ) ) ;
2020-11-04 14:26:37 -04:00
}
2021-09-13 14:13:39 -04:00
FVertexName DataReferenceName ;
2021-03-23 17:55:31 -04:00
2021-03-23 22:43:28 -04:00
FDataWriteReference InputValue ;
FDataWriteReference OutputValue ;
2023-04-05 17:38:47 -04:00
2023-01-23 14:24:03 -05:00
} ;
2020-11-04 14:26:37 -04:00
2022-06-02 10:50:07 -04:00
template < typename DataType >
2023-04-05 17:38:47 -04:00
class TResetableExecutableInputOperator : public TExecutableInputOperator < DataType >
2022-06-02 10:50:07 -04:00
{
2023-01-23 14:24:03 -05:00
public :
using FDataWriteReference = TDataWriteReference < DataType > ;
2023-04-05 17:38:47 -04:00
using FDataWriteReferenceFactory = TDataWriteReferenceLiteralFactory < DataType > ;
2022-06-02 10:50:07 -04:00
2023-04-05 17:38:47 -04:00
TResetableExecutableInputOperator ( const FVertexName & InDataReferenceName , const FOperatorSettings & InSettings , const FLiteral & InLiteral )
: TExecutableInputOperator < DataType > ( InDataReferenceName , FDataWriteReferenceFactory : : CreateExplicitArgs ( InSettings , InLiteral ) )
, Literal ( InLiteral )
2023-01-23 14:24:03 -05:00
{
}
2022-06-02 10:50:07 -04:00
2023-04-05 17:38:47 -04:00
virtual IOperator : : FResetFunction GetResetFunction ( ) override
{
return & Reset ;
}
private :
static void Reset ( IOperator * InOperator , const IOperator : : FResetParams & InParams )
{
using FResetableExecutableInputOperator = TResetableExecutableInputOperator < DataType > ;
FResetableExecutableInputOperator * Operator = static_cast < FResetableExecutableInputOperator * > ( InOperator ) ;
check ( nullptr ! = Operator ) ;
* Operator - > InputValue = TDataTypeLiteralFactory < DataType > : : CreateExplicitArgs ( InParams . OperatorSettings , Operator - > Literal ) ;
* Operator - > OutputValue = * Operator - > InputValue ;
}
FLiteral Literal ;
} ;
template < typename DataType >
2024-02-08 19:25:13 -05:00
class TPostExecutableInputOperator : public IOperator
2023-04-05 17:38:47 -04:00
{
static_assert ( TPostExecutableDataType < DataType > : : bIsPostExecutable , " TPostExecutableInputOperator should only be used with post executable data types " ) ;
static_assert ( ! TExecutableDataType < DataType > : : bIsExecutable , " A data type cannot be Executable and PostExecutable " ) ;
public :
using FDataWriteReference = TDataWriteReference < DataType > ;
TPostExecutableInputOperator ( const FVertexName & InDataReferenceName , TDataWriteReference < DataType > InValue )
: DataReferenceName ( InDataReferenceName )
2023-11-27 12:58:53 -05:00
, DataRef ( InValue )
2023-01-23 14:24:03 -05:00
{
}
2022-06-02 10:50:07 -04:00
2023-05-16 16:02:58 -04:00
virtual void BindInputs ( FInputVertexInterfaceData & InOutVertexData ) override
2023-01-23 14:24:03 -05:00
{
2023-11-27 12:58:53 -05:00
InOutVertexData . BindVertex ( DataReferenceName , DataRef ) ;
2023-05-16 16:02:58 -04:00
}
virtual void BindOutputs ( FOutputVertexInterfaceData & InOutVertexData ) override
{
2024-02-08 19:25:13 -05:00
InOutVertexData . BindVertex ( DataReferenceName , DataRef . GetDataReadReference < DataType > ( ) ) ;
2023-01-23 14:24:03 -05:00
}
virtual FExecuteFunction GetExecuteFunction ( ) override
{
2023-04-05 17:38:47 -04:00
return nullptr ;
}
virtual FPostExecuteFunction GetPostExecuteFunction ( ) override
{
2024-02-08 19:25:13 -05:00
// This condition is checked at runtime as its possible dynamic graphs may reassign ownership
// of underlying data to operate on in post execute. In this case, the expectation is that the
// data reference is now owned by another provider/operator.
if ( DataRef . GetAccessType ( ) = = EDataReferenceAccessType : : Write )
{
return & PostExecute ;
}
else
{
return nullptr ;
}
2023-01-23 14:24:03 -05:00
}
2023-02-22 17:54:26 -05:00
virtual FResetFunction GetResetFunction ( ) override
{
2024-02-08 19:25:13 -05:00
// This condition is checked at runtime as its possible dynamic graphs may reassign ownership
// of underlying data to operate on in post execute. In this case, the expectation is that the
// data reference is now owned by another provider/operator.
if ( DataRef . GetAccessType ( ) = = EDataReferenceAccessType : : Write )
{
return & NoOpReset ;
}
else
{
return nullptr ;
}
2023-02-22 17:54:26 -05:00
}
2023-04-05 17:38:47 -04:00
protected :
2024-02-08 19:25:13 -05:00
static void NoOpReset ( IOperator * InOperator , const IOperator : : FResetParams & InParams )
{
// All post executable nodes must have a reset. This is a special
// case of a non-owning node performing post execute on a data type
// owned by an external system.
}
2023-04-05 17:38:47 -04:00
static void PostExecute ( IOperator * InOperator )
2023-02-22 17:54:26 -05:00
{
2023-04-05 17:38:47 -04:00
using FPostExecutableInputOperator = TPostExecutableInputOperator < DataType > ;
2023-02-22 17:54:26 -05:00
2023-04-05 17:38:47 -04:00
FPostExecutableInputOperator * DerivedOperator = static_cast < FPostExecutableInputOperator * > ( InOperator ) ;
check ( nullptr ! = DerivedOperator ) ;
2023-02-22 17:54:26 -05:00
2024-02-08 19:25:13 -05:00
DataType * Value = DerivedOperator - > DataRef . template GetWritableValue < DataType > ( ) ;
if ( ensure ( Value ! = nullptr ) )
2023-11-27 12:58:53 -05:00
{
2024-02-08 19:25:13 -05:00
TPostExecutableDataType < DataType > : : PostExecute ( * Value ) ;
2023-11-27 12:58:53 -05:00
}
2023-02-22 17:54:26 -05:00
}
2023-01-23 14:24:03 -05:00
FVertexName DataReferenceName ;
2023-11-27 12:58:53 -05:00
FAnyDataReference DataRef ;
2023-01-23 14:24:03 -05:00
} ;
2023-04-05 17:38:47 -04:00
template < typename DataType >
class TResetablePostExecutableInputOperator : public TPostExecutableInputOperator < DataType >
{
public :
using FDataWriteReference = TDataWriteReference < DataType > ;
using FDataWriteReferenceFactory = TDataWriteReferenceLiteralFactory < DataType > ;
2024-02-08 19:25:13 -05:00
using TPostExecutableInputOperator < DataType > : : DataRef ;
2023-04-05 17:38:47 -04:00
TResetablePostExecutableInputOperator ( const FVertexName & InDataReferenceName , const FOperatorSettings & InSettings , const FLiteral & InLiteral )
: TPostExecutableInputOperator < DataType > ( InDataReferenceName , FDataWriteReferenceFactory : : CreateExplicitArgs ( InSettings , InLiteral ) )
, Literal ( InLiteral )
{
}
virtual IOperator : : FResetFunction GetResetFunction ( ) override
{
2024-02-08 19:25:13 -05:00
if ( DataRef . GetAccessType ( ) = = EDataReferenceAccessType : : Write )
{
return & Reset ;
}
else
{
// If DataRef is not writable, reference is assumed to be reset by another owning operator.
return nullptr ;
}
2023-04-05 17:38:47 -04:00
}
private :
static void Reset ( IOperator * InOperator , const IOperator : : FResetParams & InParams )
{
using FResetablePostExecutableInputOperator = TResetablePostExecutableInputOperator < DataType > ;
FResetablePostExecutableInputOperator * Operator = static_cast < FResetablePostExecutableInputOperator * > ( InOperator ) ;
check ( nullptr ! = Operator ) ;
2024-02-08 19:25:13 -05:00
DataType * Value = Operator - > DataRef . template GetWritableValue < DataType > ( ) ;
if ( ensure ( Value ! = nullptr ) )
2023-11-27 12:58:53 -05:00
{
2024-02-08 19:25:13 -05:00
* Value = TDataTypeLiteralFactory < DataType > : : CreateExplicitArgs ( InParams . OperatorSettings , Operator - > Literal ) ;
2023-11-27 12:58:53 -05:00
}
2023-04-05 17:38:47 -04:00
}
FLiteral Literal ;
} ;
/** Non owning input operator that may need execution. */
template < typename DataType , EVertexAccessType VertexAccess = EVertexAccessType : : Reference >
using TNonOwningInputOperator = std : : conditional_t <
TExecutableDataType < DataType > : : bIsExecutable ,
TExecutableInputOperator < DataType > , // Use this input operator if the data type is not owned by the input node but needs execution.
std : : conditional_t <
TPostExecutableDataType < DataType > : : bIsPostExecutable ,
TPostExecutableInputOperator < DataType > , // Use this input operator if the data type is not owned by the input node but needs post execution.
MetasoundInputNodePrivate : : FNonExecutableInputPassThroughOperator // Use this input operator if the data type is not owned by the input node and is not executable, nor post executable.
>
> ;
2023-01-23 14:24:03 -05:00
}
2023-04-05 17:38:47 -04:00
/** Owning input operator that may need execution. */
2023-01-23 14:24:03 -05:00
template < typename DataType , EVertexAccessType VertexAccess = EVertexAccessType : : Reference >
using TInputOperator = std : : conditional_t <
2023-04-05 17:38:47 -04:00
VertexAccess = = EVertexAccessType : : Value | | ( ! TExecutableDataType < DataType > : : bIsExecutable & & ! TPostExecutableDataType < DataType > : : bIsPostExecutable ) ,
MetasoundInputNodePrivate : : TInputValueOperator < DataType > , // Use this input operator if the data type is owned by the input node and is not executable, nor post executable.
2023-01-23 14:24:03 -05:00
std : : conditional_t <
TExecutableDataType < DataType > : : bIsExecutable ,
2023-04-05 17:38:47 -04:00
MetasoundInputNodePrivate : : TResetableExecutableInputOperator < DataType > , // Use this input operator if the data type is owned by the input node and is executable.
MetasoundInputNodePrivate : : TResetablePostExecutableInputOperator < DataType > // Use this input operator if the data type is owned by the input node and is post executable.
2023-01-23 14:24:03 -05:00
>
> ;
/** Choose pass through operator based upon data type and access type */
template < typename DataType , EVertexAccessType VertexAccess = EVertexAccessType : : Reference >
using TPassThroughOperator = std : : conditional_t <
VertexAccess = = EVertexAccessType : : Value ,
2023-02-22 17:54:26 -05:00
MetasoundInputNodePrivate : : TInputValueOperator < DataType > ,
2023-01-23 14:24:03 -05:00
MetasoundInputNodePrivate : : FNonExecutableInputPassThroughOperator
> ;
2021-05-20 19:33:21 -04:00
2023-04-10 17:33:53 -04:00
/** FInputNode represents an input to a metasound graph. */
class METASOUNDFRONTEND_API FInputNode : public FNode
{
static FLazyName ConstructorVariant ;
// Use Variant names to differentiate between normal input nodes and constructor
// input nodes.
static FName GetVariantName ( EVertexAccessType InVertexAccess ) ;
static FVertexInterface CreateVertexInterface ( const FVertexName & InVertexName , const FName & InDataTypeName , EVertexAccessType InVertexAccess , const FLiteral & InLiteral ) ;
protected :
static FVertexInterface CreateDefaultVertexInterface ( const FVertexName & InVertexName , const FName & InDataTypeName , EVertexAccessType InVertexAccess ) ;
public :
2024-01-31 17:59:29 -05:00
static FText GetInputDescription ( ) ;
2023-04-10 17:33:53 -04:00
static FNodeClassMetadata GetNodeMetadata ( const FVertexName & InVertexName , const FName & InDataTypeName , EVertexAccessType InVertexAccess ) ;
/* Construct a TInputNode using the TInputOperatorLiteralFactory<> and moving
* InParam to the TInputOperatorLiteralFactory constructor . */
explicit FInputNode ( FInputNodeConstructorParams & & InParams , const FName & InDataTypeName , EVertexAccessType InVertexAccess , FOperatorFactorySharedRef InFactory ) ;
const FVertexName & GetVertexName ( ) const ;
virtual const FVertexInterface & GetVertexInterface ( ) const override ;
virtual bool SetVertexInterface ( const FVertexInterface & InInterface ) override ;
virtual bool IsVertexInterfaceSupported ( const FVertexInterface & InInterface ) const override ;
virtual TSharedRef < IOperatorFactory , ESPMode : : ThreadSafe > GetDefaultOperatorFactory ( ) const override ;
private :
FVertexName VertexName ;
FVertexInterface Interface ;
FOperatorFactorySharedRef Factory ;
} ;
2020-11-04 14:26:37 -04:00
/** TInputNode represents an input to a metasound graph. */
2022-06-02 10:50:07 -04:00
template < typename DataType , EVertexAccessType VertexAccess = EVertexAccessType : : Reference >
2023-04-10 17:33:53 -04:00
class TInputNode : public FInputNode
2020-05-22 23:46:09 -04:00
{
2022-06-02 10:50:07 -04:00
static constexpr bool bIsConstructorInput = VertexAccess = = EVertexAccessType : : Value ;
static constexpr bool bIsSupportedConstructorInput = TIsConstructorVertexSupported < DataType > : : Value & & bIsConstructorInput ;
static constexpr bool bIsReferenceInput = VertexAccess = = EVertexAccessType : : Reference ;
static constexpr bool bIsSupportedReferenceInput = TLiteralTraits < DataType > : : bIsParsableFromAnyLiteralType & & bIsReferenceInput ;
static constexpr bool bIsSupportedInput = bIsSupportedConstructorInput | | bIsSupportedReferenceInput ;
// Factory for creating input operators.
class FInputNodeOperatorFactory : public IOperatorFactory
{
static constexpr bool bIsReferenceVertexAccess = VertexAccess = = EVertexAccessType : : Reference ;
static constexpr bool bIsValueVertexAccess = VertexAccess = = EVertexAccessType : : Value ;
static_assert ( bIsValueVertexAccess | | bIsReferenceVertexAccess , " Unsupported EVertexAccessType " ) ;
// Choose which data reference type is created based on template parameters
2023-02-22 17:54:26 -05:00
using FDataReference = std : : conditional_t < bIsReferenceVertexAccess , TDataReadReference < DataType > , TDataValueReference < DataType > > ;
using FDataReferenceFactory = std : : conditional_t < bIsReferenceVertexAccess , TDataReadReferenceLiteralFactory < DataType > , TDataValueReferenceLiteralFactory < DataType > > ;
2022-06-02 10:50:07 -04:00
using FPassThroughDataReference = std : : conditional_t < bIsReferenceVertexAccess , TDataReadReference < DataType > , TDataValueReference < DataType > > ;
2023-02-22 17:54:26 -05:00
// Return correct data reference type based on vertex access type for pass through scenario.
FPassThroughDataReference CreatePassThroughDataReference ( const FAnyDataReference & InRef )
2022-06-02 10:50:07 -04:00
{
2023-02-22 17:54:26 -05:00
if constexpr ( bIsReferenceVertexAccess )
2022-06-02 10:50:07 -04:00
{
2023-02-22 17:54:26 -05:00
return InRef . GetDataReadReference < DataType > ( ) ;
2022-06-02 10:50:07 -04:00
}
2023-02-22 17:54:26 -05:00
else if constexpr ( bIsValueVertexAccess )
2022-06-02 10:50:07 -04:00
{
2023-02-22 17:54:26 -05:00
return InRef . GetDataValueReference < DataType > ( ) ;
2022-06-02 10:50:07 -04:00
}
2023-02-22 17:54:26 -05:00
else
2022-06-02 10:50:07 -04:00
{
2023-02-22 17:54:26 -05:00
static_assert ( " Unsupported EVertexAccessType " ) ;
2022-06-02 10:50:07 -04:00
}
2023-02-22 17:54:26 -05:00
}
2020-05-22 23:46:09 -04:00
2020-08-24 10:57:03 -04:00
public :
2023-04-05 17:38:47 -04:00
explicit FInputNodeOperatorFactory ( )
2020-07-20 00:05:22 -04:00
{
}
2022-06-02 10:50:07 -04:00
virtual TUniquePtr < IOperator > CreateOperator ( const FBuildOperatorParams & InParams , FBuildResults & OutResults ) override
2020-06-25 18:06:30 -04:00
{
2023-01-23 14:24:03 -05:00
using namespace MetasoundInputNodePrivate ;
2022-06-02 10:50:07 -04:00
using FInputNodeType = TInputNode < DataType , VertexAccess > ;
2020-06-25 18:06:30 -04:00
2022-06-02 10:50:07 -04:00
const FInputNodeType & InputNode = static_cast < const FInputNodeType & > ( InParams . Node ) ;
const FVertexName & VertexKey = InputNode . GetVertexName ( ) ;
2020-05-22 23:46:09 -04:00
2022-10-12 20:05:22 -04:00
if ( const FAnyDataReference * Ref = InParams . InputData . FindDataReference ( VertexKey ) )
{
2023-04-05 17:38:47 -04:00
if constexpr ( bIsReferenceVertexAccess )
{
if ( EDataReferenceAccessType : : Write = = Ref - > GetAccessType ( ) )
{
return MakeUnique < TNonOwningInputOperator < DataType , VertexAccess > > ( VertexKey , Ref - > GetDataWriteReference < DataType > ( ) ) ;
}
}
2022-10-12 20:05:22 -04:00
// Pass through input value
2023-02-22 17:54:26 -05:00
return MakeUnique < TPassThroughOperator < DataType , VertexAccess > > ( VertexKey , CreatePassThroughDataReference ( * Ref ) ) ;
2022-10-12 20:05:22 -04:00
}
2023-04-05 17:38:47 -04:00
else
{
const FLiteral & Literal = InputNode . GetVertexInterface ( ) . GetInputInterface ( ) [ VertexKey ] . GetDefaultLiteral ( ) ;
// Owned input value
return MakeUnique < TInputOperator < DataType , VertexAccess > > ( VertexKey , InParams . OperatorSettings , Literal ) ;
}
2020-05-22 23:46:09 -04:00
}
2022-06-02 10:50:07 -04:00
} ;
2020-05-22 23:46:09 -04:00
2022-06-02 10:50:07 -04:00
public :
// If true, this node can be instantiated by the Frontend.
static constexpr bool bCanRegister = bIsSupportedInput ;
2023-04-10 17:33:53 -04:00
UE_DEPRECATED ( 5.3 , " Access the default vertex interface from the input node metadata. " )
2023-04-05 17:38:47 -04:00
static FVertexInterface DeclareVertexInterface ( const FVertexName & InVertexName )
{
2023-04-10 17:33:53 -04:00
return CreateDefaultVertexInterface ( InVertexName , GetMetasoundDataTypeName < DataType > ( ) , VertexAccess ) ;
2023-04-05 17:38:47 -04:00
}
2022-06-02 10:50:07 -04:00
static FNodeClassMetadata GetNodeInfo ( const FVertexName & InVertexName )
{
2023-04-10 17:33:53 -04:00
return GetNodeMetadata ( InVertexName , GetMetasoundDataTypeName < DataType > ( ) , VertexAccess ) ;
2022-06-02 10:50:07 -04:00
}
2022-10-10 15:44:28 -04:00
2022-06-02 10:50:07 -04:00
/* Construct a TInputNode using the TInputOperatorLiteralFactory<> and moving
* InParam to the TInputOperatorLiteralFactory constructor . */
2022-10-10 15:44:28 -04:00
explicit TInputNode ( FInputNodeConstructorParams & & InParams )
2023-04-10 17:33:53 -04:00
: FInputNode ( MoveTemp ( InParams ) , GetMetasoundDataTypeName < DataType > ( ) , VertexAccess , MakeShared < FInputNodeOperatorFactory > ( ) )
2022-06-02 10:50:07 -04:00
{
}
2020-05-22 23:46:09 -04:00
} ;
2020-07-22 14:52:03 -04:00
} // namespace Metasound