2021-10-12 21:21:22 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "MetasoundFrontendInputController.h"
# include "Internationalization/Text.h"
# include "MetasoundFrontendController.h"
# include "MetasoundFrontendDocumentAccessPtr.h"
2021-11-18 14:37:34 -05:00
# include "MetasoundFrontendGraphLinter.h"
2021-10-12 21:21:22 -04:00
# include "MetasoundFrontendInvalidController.h"
2024-03-07 17:53:25 -05:00
# include "MetasoundFrontendNodeTemplateRegistry.h"
2021-10-12 21:21:22 -04:00
# include "Misc/Guid.h"
# define LOCTEXT_NAMESPACE "MetasoundFrontendInputController"
namespace Metasound
{
namespace Frontend
{
//
// FBaseInputController
//
FBaseInputController : : FBaseInputController ( const FBaseInputController : : FInitParams & InParams )
: ID ( InParams . ID )
, NodeVertexPtr ( InParams . NodeVertexPtr )
, ClassInputPtr ( InParams . ClassInputPtr )
, GraphPtr ( InParams . GraphPtr )
, OwningNode ( InParams . OwningNode )
{
}
bool FBaseInputController : : IsValid ( ) const
{
return OwningNode - > IsValid ( ) & & ( nullptr ! = NodeVertexPtr . Get ( ) ) & & ( nullptr ! = GraphPtr . Get ( ) ) ;
}
FGuid FBaseInputController : : GetID ( ) const
{
return ID ;
}
const FName & FBaseInputController : : GetDataType ( ) const
{
if ( const FMetasoundFrontendVertex * Vertex = NodeVertexPtr . Get ( ) )
{
return Vertex - > TypeName ;
}
return Invalid : : GetInvalidName ( ) ;
}
const FVertexName & FBaseInputController : : GetName ( ) const
{
if ( const FMetasoundFrontendVertex * Vertex = NodeVertexPtr . Get ( ) )
{
return Vertex - > Name ;
}
return Invalid : : GetInvalidName ( ) ;
}
2022-09-13 21:51:22 -04:00
EMetasoundFrontendVertexAccessType FBaseInputController : : GetVertexAccessType ( ) const
2022-06-02 10:50:07 -04:00
{
2022-09-13 21:51:22 -04:00
EMetasoundFrontendVertexAccessType AccessType = EMetasoundFrontendVertexAccessType : : Unset ;
bool bIsRerouted = false ;
- Fix for attempting to access EngineSubsystem during MetaSound versioning (serialization), which can assert when apparently certain commands in certain contexts can attempt to preload assets prior to the init phase.
- Minor Fix for LocText duplication
#tests BuildCookRun, -game, version MetaSounds assets in editor, PIE
[FYI] bob.tellez
Original CL Desc
-----------------------------------------------------------------
[Backout] - CL33084850
[FYI] Rob.Gay
Original CL Desc
-----------------------------------------------------------------
Version Metasound Document to include all ed data and make all Metasound EdGraph data transient
- Add input template nodes
- Add comment node data to document
- Keep references to member literal data (i.e. knob/slider ranges) in document metadata to ensure continued serialization and flexibility to add more editor-only fields and literal metadata
- Misc builder API updates, bug fixes and migration of controllers to builder API in anticipation of pages
- Sunset non-deterministic guid cvar
#rb phil.popp, helen.yang
[FYI] sondra.moyls
#tests Standard Automated Audio Tests, EngineTests, Offline QA Smoke pass, CPR, etc., extensive MetaSound Editor use, -game MetaSound qa levels, AudioUnitTests
#jira UE-194159
[CL 33102023 by rob gay in ue5-main branch]
2024-04-19 10:09:04 -04:00
PRAGMA_DISABLE_DEPRECATION_WARNINGS
2022-09-13 21:51:22 -04:00
Frontend : : IterateReroutedInputs ( AsShared ( ) , [ this , & bIsRerouted , & AccessType ] ( const FConstInputHandle & ReroutedInput )
2022-06-02 10:50:07 -04:00
{
2022-09-13 21:51:22 -04:00
bIsRerouted = true ;
if ( AccessType ! = EMetasoundFrontendVertexAccessType : : Value )
{
if ( ReroutedInput - > IsValid ( ) )
{
// If ReroutedInput is top-level controller, iterator function is returning self, so just report if set to value.
if ( ReroutedInput - > GetID ( ) = = GetID ( ) & & ReroutedInput - > GetOwningNodeID ( ) = = GetOwningNodeID ( ) )
{
if ( const FMetasoundFrontendClassVertex * ClassInput = ClassInputPtr . Get ( ) )
{
AccessType = ClassInput - > AccessType ;
return ;
}
2024-03-07 17:53:25 -05:00
// Likely template node with no set class input interface, so valid to return unset
AccessType = EMetasoundFrontendVertexAccessType : : Unset ;
return ;
2022-09-13 21:51:22 -04:00
}
const EMetasoundFrontendVertexAccessType RerouteAccessType = ReroutedInput - > GetVertexAccessType ( ) ;
if ( RerouteAccessType = = EMetasoundFrontendVertexAccessType : : Value )
{
AccessType = RerouteAccessType ;
}
}
}
} ) ;
- Fix for attempting to access EngineSubsystem during MetaSound versioning (serialization), which can assert when apparently certain commands in certain contexts can attempt to preload assets prior to the init phase.
- Minor Fix for LocText duplication
#tests BuildCookRun, -game, version MetaSounds assets in editor, PIE
[FYI] bob.tellez
Original CL Desc
-----------------------------------------------------------------
[Backout] - CL33084850
[FYI] Rob.Gay
Original CL Desc
-----------------------------------------------------------------
Version Metasound Document to include all ed data and make all Metasound EdGraph data transient
- Add input template nodes
- Add comment node data to document
- Keep references to member literal data (i.e. knob/slider ranges) in document metadata to ensure continued serialization and flexibility to add more editor-only fields and literal metadata
- Misc builder API updates, bug fixes and migration of controllers to builder API in anticipation of pages
- Sunset non-deterministic guid cvar
#rb phil.popp, helen.yang
[FYI] sondra.moyls
#tests Standard Automated Audio Tests, EngineTests, Offline QA Smoke pass, CPR, etc., extensive MetaSound Editor use, -game MetaSound qa levels, AudioUnitTests
#jira UE-194159
[CL 33102023 by rob gay in ue5-main branch]
2024-04-19 10:09:04 -04:00
PRAGMA_ENABLE_DEPRECATION_WARNINGS
2022-09-13 21:51:22 -04:00
return bIsRerouted ? AccessType : EMetasoundFrontendVertexAccessType : : Reference ;
2022-06-02 10:50:07 -04:00
}
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2021-10-12 21:21:22 -04:00
FText FBaseInputController : : GetDisplayName ( ) const
{
if ( const FMetasoundFrontendClassInput * ClassInput = ClassInputPtr . Get ( ) )
{
2022-01-26 18:11:52 -05:00
return ClassInput - > Metadata . GetDisplayName ( ) ;
2021-10-12 21:21:22 -04:00
}
return Invalid : : GetInvalidText ( ) ;
}
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2021-10-12 21:21:22 -04:00
2021-11-18 14:37:34 -05:00
bool FBaseInputController : : ClearLiteral ( )
{
if ( const FMetasoundFrontendVertex * Vertex = NodeVertexPtr . Get ( ) )
{
OwningNode - > ClearInputLiteral ( Vertex - > VertexID ) ;
}
return false ;
}
2021-10-12 21:21:22 -04:00
const FMetasoundFrontendLiteral * FBaseInputController : : GetLiteral ( ) const
{
if ( const FMetasoundFrontendVertex * Vertex = NodeVertexPtr . Get ( ) )
{
return OwningNode - > GetInputLiteral ( Vertex - > VertexID ) ;
}
return nullptr ;
}
void FBaseInputController : : SetLiteral ( const FMetasoundFrontendLiteral & InLiteral )
{
if ( const FMetasoundFrontendVertex * Vertex = NodeVertexPtr . Get ( ) )
{
2021-11-18 14:37:34 -05:00
OwningNode - > SetInputLiteral ( FMetasoundFrontendVertexLiteral { Vertex - > VertexID , InLiteral } ) ;
2021-10-12 21:21:22 -04:00
}
}
const FMetasoundFrontendLiteral * FBaseInputController : : GetClassDefaultLiteral ( ) const
{
if ( const FMetasoundFrontendClassInput * ClassInput = ClassInputPtr . Get ( ) )
{
2024-07-26 14:23:35 -04:00
return ClassInput - > FindConstDefault ( Frontend : : DefaultPageID ) ;
2021-10-12 21:21:22 -04:00
}
return nullptr ;
}
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2021-10-12 21:21:22 -04:00
const FText & FBaseInputController : : GetTooltip ( ) const
{
if ( const FMetasoundFrontendClassInput * ClassInput = ClassInputPtr . Get ( ) )
{
2022-01-26 18:11:52 -05:00
return ClassInput - > Metadata . GetDescription ( ) ;
2021-10-12 21:21:22 -04:00
}
return Invalid : : GetInvalidText ( ) ;
}
const FMetasoundFrontendVertexMetadata & FBaseInputController : : GetMetadata ( ) const
{
if ( const FMetasoundFrontendClassInput * ClassInput = ClassInputPtr . Get ( ) )
{
return ClassInput - > Metadata ;
}
return Invalid : : GetInvalidVertexMetadata ( ) ;
}
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2021-10-12 21:21:22 -04:00
bool FBaseInputController : : IsConnected ( ) const
{
return ( nullptr ! = FindEdge ( ) ) ;
}
FGuid FBaseInputController : : GetOwningNodeID ( ) const
{
return OwningNode - > GetID ( ) ;
}
FNodeHandle FBaseInputController : : GetOwningNode ( )
{
return OwningNode ;
}
FConstNodeHandle FBaseInputController : : GetOwningNode ( ) const
{
return OwningNode ;
}
FOutputHandle FBaseInputController : : GetConnectedOutput ( )
{
if ( const FMetasoundFrontendEdge * Edge = FindEdge ( ) )
{
// Create output handle from output node.
FGraphHandle Graph = OwningNode - > GetOwningGraph ( ) ;
FNodeHandle OutputNode = Graph - > GetNodeWithID ( Edge - > FromNodeID ) ;
return OutputNode - > GetOutputWithID ( Edge - > FromVertexID ) ;
}
return IOutputController : : GetInvalidHandle ( ) ;
}
FConstOutputHandle FBaseInputController : : GetConnectedOutput ( ) const
{
if ( const FMetasoundFrontendEdge * Edge = FindEdge ( ) )
{
// Create output handle from output node.
FConstGraphHandle Graph = OwningNode - > GetOwningGraph ( ) ;
FConstNodeHandle OutputNode = Graph - > GetNodeWithID ( Edge - > FromNodeID ) ;
return OutputNode - > GetOutputWithID ( Edge - > FromVertexID ) ;
}
return IOutputController : : GetInvalidHandle ( ) ;
}
2021-11-07 23:43:01 -05:00
bool FBaseInputController : : IsConnectionUserModifiable ( ) const
{
2024-03-07 17:53:25 -05:00
FConstNodeHandle Owner = GetOwningNode ( ) ;
if ( Owner - > GetClassMetadata ( ) . GetType ( ) = = EMetasoundFrontendClassType : : Template )
{
const FNodeRegistryKey Key ( GetOwningNode ( ) - > GetClassMetadata ( ) ) ;
const INodeTemplate * Template = INodeTemplateRegistry : : Get ( ) . FindTemplate ( Key ) ;
if ( ensure ( Template ) )
{
return Template - > IsInputConnectionUserModifiable ( ) ;
}
}
2021-11-07 23:43:01 -05:00
return true ;
}
2021-10-12 21:21:22 -04:00
FConnectability FBaseInputController : : CanConnectTo ( const IOutputController & InController ) const
{
FConnectability OutConnectability ;
OutConnectability . Connectable = FConnectability : : EConnectable : : No ;
2021-11-18 14:37:34 -05:00
OutConnectability . Reason = FConnectability : : EReason : : None ;
2021-10-12 21:21:22 -04:00
const FName & DataType = GetDataType ( ) ;
const FName & OtherDataType = InController . GetDataType ( ) ;
if ( DataType = = Invalid : : GetInvalidName ( ) )
{
2021-11-18 14:37:34 -05:00
OutConnectability . Connectable = FConnectability : : EConnectable : : No ;
OutConnectability . Reason = FConnectability : : EReason : : IncompatibleDataTypes ;
2021-10-12 21:21:22 -04:00
}
2022-07-18 17:14:25 -04:00
else if ( ! FMetasoundFrontendClassVertex : : CanConnectVertexAccessTypes ( InController . GetVertexAccessType ( ) , GetVertexAccessType ( ) ) )
2022-06-02 10:50:07 -04:00
{
OutConnectability . Connectable = FConnectability : : EConnectable : : No ;
OutConnectability . Reason = FConnectability : : EReason : : IncompatibleAccessTypes ;
}
2021-11-18 14:37:34 -05:00
else if ( OtherDataType = = DataType )
2021-10-12 21:21:22 -04:00
{
// If data types are equal, connection can happen.
OutConnectability . Connectable = FConnectability : : EConnectable : : Yes ;
2021-11-18 14:37:34 -05:00
OutConnectability . Reason = FConnectability : : EReason : : None ;
}
else
{
// If data types are not equal, check for converter nodes which could
// convert data type.
OutConnectability . PossibleConverterNodeClasses = FRegistry : : Get ( ) - > GetPossibleConverterNodes ( OtherDataType , DataType ) ;
if ( OutConnectability . PossibleConverterNodeClasses . Num ( ) > 0 )
{
OutConnectability . Connectable = FConnectability : : EConnectable : : YesWithConverterNode ;
}
2021-10-12 21:21:22 -04:00
}
2021-11-18 14:37:34 -05:00
// If data types are connectable, check if causes loop.
if ( FConnectability : : EConnectable : : No ! = OutConnectability . Connectable )
2021-10-12 21:21:22 -04:00
{
2021-11-18 14:37:34 -05:00
if ( FGraphLinter : : DoesConnectionCauseLoop ( * this , InController ) )
{
OutConnectability . Connectable = FConnectability : : EConnectable : : No ;
OutConnectability . Reason = FConnectability : : EReason : : CausesLoop ;
}
2021-10-12 21:21:22 -04:00
}
return OutConnectability ;
}
bool FBaseInputController : : Connect ( IOutputController & InController )
{
const FName & DataType = GetDataType ( ) ;
const FName & OtherDataType = InController . GetDataType ( ) ;
if ( DataType = = Invalid : : GetInvalidName ( ) )
{
return false ;
}
2022-06-02 10:50:07 -04:00
2021-10-12 21:21:22 -04:00
if ( FMetasoundFrontendGraph * Graph = GraphPtr . Get ( ) )
{
2022-06-02 10:50:07 -04:00
if ( OtherDataType = = DataType )
2021-10-12 21:21:22 -04:00
{
2022-07-18 17:14:25 -04:00
if ( FMetasoundFrontendClassVertex : : CanConnectVertexAccessTypes ( InController . GetVertexAccessType ( ) , GetVertexAccessType ( ) ) )
2021-10-12 21:21:22 -04:00
{
2022-06-02 10:50:07 -04:00
// Overwrite an existing connection if it exists.
FMetasoundFrontendEdge * Edge = FindEdge ( ) ;
if ( ! Edge )
{
Edge = & Graph - > Edges . AddDefaulted_GetRef ( ) ;
Edge - > ToNodeID = GetOwningNodeID ( ) ;
Edge - > ToVertexID = GetID ( ) ;
}
Edge - > FromNodeID = InController . GetOwningNodeID ( ) ;
Edge - > FromVertexID = InController . GetID ( ) ;
2023-05-02 17:00:45 -04:00
ClearConnectedObjectLiterals ( ) ;
2022-06-02 10:50:07 -04:00
return true ;
2021-10-12 21:21:22 -04:00
}
2022-06-02 10:50:07 -04:00
else
{
2023-05-03 14:17:48 -04:00
UE_LOG ( LogMetaSound , Error , TEXT ( " Cannot connect incompatible vertex access types (Input)%s and (Output)%s. " ) , LexToString ( GetVertexAccessType ( ) ) , LexToString ( InController . GetVertexAccessType ( ) ) ) ;
2022-06-02 10:50:07 -04:00
}
}
else
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Cannot connect incompatible data types %s and %s. " ) , * DataType . ToString ( ) , * OtherDataType . ToString ( ) ) ;
2021-10-12 21:21:22 -04:00
}
}
return false ;
}
bool FBaseInputController : : ConnectWithConverterNode ( IOutputController & InController , const FConverterNodeInfo & InConverterInfo )
{
FGraphHandle OwningGraph = OwningNode - > GetOwningGraph ( ) ;
// Generate the converter node.
FNodeHandle ConverterNode = OwningGraph - > AddNode ( InConverterInfo . NodeKey ) ;
FInputHandle ConverterInput = ConverterNode - > GetInputWithVertexName ( InConverterInfo . PreferredConverterInputPin ) ;
FOutputHandle ConverterOutput = ConverterNode - > GetOutputWithVertexName ( InConverterInfo . PreferredConverterOutputPin ) ;
if ( ! ConverterInput - > IsValid ( ) )
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Converter node [Name: %s] does not support preferred input vertex [Vertex: %s] " ) , * ConverterNode - > GetNodeName ( ) . ToString ( ) , * InConverterInfo . PreferredConverterInputPin . ToString ( ) ) ;
return false ;
}
if ( ! ConverterOutput - > IsValid ( ) )
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Converter node [Name: %s] does not support preferred output vertex [Vertex: %s] " ) , * ConverterNode - > GetNodeName ( ) . ToString ( ) , * InConverterInfo . PreferredConverterOutputPin . ToString ( ) ) ;
return false ;
}
// Connect the output InController to the converter, than connect the converter to this input.
if ( ConverterInput - > Connect ( InController ) & & Connect ( * ConverterOutput ) )
{
return true ;
}
return false ;
}
2024-09-16 15:56:55 -04:00
bool FBaseInputController : : Disconnect ( IOutputController & InController )
2021-10-12 21:21:22 -04:00
{
if ( FMetasoundFrontendGraph * Graph = GraphPtr . Get ( ) )
{
FGuid FromNodeID = InController . GetOwningNodeID ( ) ;
FGuid FromVertexID = InController . GetID ( ) ;
FGuid ToNodeID = GetOwningNodeID ( ) ;
FGuid ToVertexID = GetID ( ) ;
auto IsMatchingEdge = [ & ] ( const FMetasoundFrontendEdge & Edge )
{
return ( Edge . FromNodeID = = FromNodeID ) & & ( Edge . FromVertexID = = FromVertexID ) & & ( Edge . ToNodeID = = ToNodeID ) & & ( Edge . ToVertexID = = ToVertexID ) ;
} ;
2022-05-10 16:51:39 -04:00
const int32 NumRemoved = Graph - > Edges . RemoveAllSwap ( IsMatchingEdge ) ;
# if WITH_EDITOR
auto IsMatchingStyle = [ & ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle )
{
return EdgeStyle . NodeID = = FromNodeID & & InController . GetName ( ) = = EdgeStyle . OutputName ;
} ;
Graph - > Style . EdgeStyles . RemoveAllSwap ( IsMatchingStyle ) ;
# endif // WITH_EDITOR
2021-10-12 21:21:22 -04:00
return NumRemoved > 0 ;
}
return false ;
}
bool FBaseInputController : : Disconnect ( )
{
if ( FMetasoundFrontendGraph * Graph = GraphPtr . Get ( ) )
{
const FGuid NodeID = GetOwningNodeID ( ) ;
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
{
const FName OutputName = GetConnectedOutput ( ) - > GetName ( ) ;
auto IsStyleForThisNode = [ & ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle ) { return EdgeStyle . NodeID = = NodeID & & OutputName = = EdgeStyle . OutputName ; } ;
Graph - > Style . EdgeStyles . RemoveAllSwap ( IsStyleForThisNode ) ;
}
# endif // WITH_EDITORONLY_DATA
2021-10-12 21:21:22 -04:00
FGuid VertexID = GetID ( ) ;
auto EdgeHasMatchingDestination = [ & ] ( const FMetasoundFrontendEdge & Edge )
{
return ( Edge . ToNodeID = = NodeID ) & & ( Edge . ToVertexID = = VertexID ) ;
} ;
2024-09-16 15:56:55 -04:00
const int32 NumRemoved = Graph - > Edges . RemoveAllSwap ( EdgeHasMatchingDestination ) ;
2021-10-12 21:21:22 -04:00
return NumRemoved > 0 ;
}
return false ;
}
2023-05-02 17:00:45 -04:00
void FBaseInputController : : ClearConnectedObjectLiterals ( )
{
FDataTypeRegistryInfo DataTypeInfo ;
if ( IsConnected ( ) )
{
if ( IDataTypeRegistry : : Get ( ) . GetDataTypeInfo ( GetDataType ( ) , DataTypeInfo ) )
{
if ( DataTypeInfo . IsDataTypeProxyParsable ( ) )
{
ClearLiteral ( ) ;
}
}
}
}
2021-10-12 21:21:22 -04:00
const FMetasoundFrontendEdge * FBaseInputController : : FindEdge ( ) const
{
if ( const FMetasoundFrontendGraph * Graph = GraphPtr . Get ( ) )
{
const FGuid NodeID = GetOwningNodeID ( ) ;
FGuid VertexID = GetID ( ) ;
auto EdgeHasMatchingDestination = [ & ] ( const FMetasoundFrontendEdge & Edge )
{
return ( Edge . ToNodeID = = NodeID ) & & ( Edge . ToVertexID = = VertexID ) ;
} ;
return Graph - > Edges . FindByPredicate ( EdgeHasMatchingDestination ) ;
}
return nullptr ;
}
FMetasoundFrontendEdge * FBaseInputController : : FindEdge ( )
{
if ( FMetasoundFrontendGraph * Graph = GraphPtr . Get ( ) )
{
const FGuid NodeID = GetOwningNodeID ( ) ;
FGuid VertexID = GetID ( ) ;
auto EdgeHasMatchingDestination = [ & ] ( const FMetasoundFrontendEdge & Edge )
{
return ( Edge . ToNodeID = = NodeID ) & & ( Edge . ToVertexID = = VertexID ) ;
} ;
return Graph - > Edges . FindByPredicate ( EdgeHasMatchingDestination ) ;
}
return nullptr ;
}
FDocumentAccess FBaseInputController : : ShareAccess ( )
{
FDocumentAccess Access ;
Access . ConstVertex = NodeVertexPtr ;
Access . ConstClassInput = ClassInputPtr ;
Access . Graph = GraphPtr ;
Access . ConstGraph = GraphPtr ;
return Access ;
}
FConstDocumentAccess FBaseInputController : : ShareAccess ( ) const
{
FConstDocumentAccess Access ;
Access . ConstVertex = NodeVertexPtr ;
Access . ConstClassInput = ClassInputPtr ;
Access . ConstGraph = GraphPtr ;
return Access ;
}
//
// FOutputNodeInputController
//
FOutputNodeInputController : : FOutputNodeInputController ( const FOutputNodeInputController : : FInitParams & InParams )
: FBaseInputController ( { InParams . ID , InParams . NodeVertexPtr , InParams . ClassInputPtr , InParams . GraphPtr , InParams . OwningNode } )
, OwningGraphClassOutputPtr ( InParams . OwningGraphClassOutputPtr )
{
}
bool FOutputNodeInputController : : IsValid ( ) const
{
return FBaseInputController : : IsValid ( ) & & ( nullptr ! = OwningGraphClassOutputPtr . Get ( ) ) ;
}
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2021-10-12 21:21:22 -04:00
FText FOutputNodeInputController : : GetDisplayName ( ) const
{
if ( const FMetasoundFrontendClassOutput * OwningOutput = OwningGraphClassOutputPtr . Get ( ) )
{
if ( const FMetasoundFrontendClassInput * ClassInput = ClassInputPtr . Get ( ) )
{
// If there the ClassInput exists, combine the variable name and class input name.
// of the variable should be added to the names of the vertices.
2022-01-26 18:11:52 -05:00
CachedDisplayName = FText : : Format ( LOCTEXT ( " OutputNodeInputControllerFormat " , " {1} {0} " ) , OwningOutput - > Metadata . GetDisplayName ( ) , ClassInput - > Metadata . GetDisplayName ( ) ) ;
2021-10-12 21:21:22 -04:00
}
else
{
// If there is not ClassInput, then use the variable name.
2022-01-26 18:11:52 -05:00
CachedDisplayName = OwningOutput - > Metadata . GetDisplayName ( ) ;
2021-10-12 21:21:22 -04:00
}
}
return CachedDisplayName ;
}
const FText & FOutputNodeInputController : : GetTooltip ( ) const
{
if ( const FMetasoundFrontendClassOutput * OwningOutput = OwningGraphClassOutputPtr . Get ( ) )
{
2022-01-26 18:11:52 -05:00
return OwningOutput - > Metadata . GetDescription ( ) ;
2021-10-12 21:21:22 -04:00
}
return Invalid : : GetInvalidText ( ) ;
}
const FMetasoundFrontendVertexMetadata & FOutputNodeInputController : : GetMetadata ( ) const
{
if ( const FMetasoundFrontendClassOutput * OwningOutput = OwningGraphClassOutputPtr . Get ( ) )
{
return OwningOutput - > Metadata ;
}
return Invalid : : GetInvalidVertexMetadata ( ) ;
}
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2021-10-12 21:21:22 -04:00
void FOutputNodeInputController : : SetName ( const FVertexName & InName )
{
if ( FMetasoundFrontendVertex * Vertex = ConstCastAccessPtr < FVertexAccessPtr > ( NodeVertexPtr ) . Get ( ) )
{
Vertex - > Name = InName ;
}
}
2022-07-18 17:14:25 -04:00
EMetasoundFrontendVertexAccessType FOutputNodeInputController : : GetVertexAccessType ( ) const
{
return OwningGraphClassOutputPtr . Get ( ) - > AccessType ;
}
2021-10-12 21:21:22 -04:00
FDocumentAccess FOutputNodeInputController : : ShareAccess ( )
{
FDocumentAccess Access = FBaseInputController : : ShareAccess ( ) ;
Access . ConstClassOutput = OwningGraphClassOutputPtr ;
return Access ;
}
FConstDocumentAccess FOutputNodeInputController : : ShareAccess ( ) const
{
FConstDocumentAccess Access = FBaseInputController : : ShareAccess ( ) ;
Access . ConstClassOutput = OwningGraphClassOutputPtr ;
return Access ;
}
//
// FInputNodeInputController
//
FInputNodeInputController : : FInputNodeInputController ( const FInputNodeInputController : : FInitParams & InParams )
: FBaseInputController ( { InParams . ID , InParams . NodeVertexPtr , InParams . ClassInputPtr , InParams . GraphPtr , InParams . OwningNode } )
, OwningGraphClassInputPtr ( InParams . OwningGraphClassInputPtr )
{
}
bool FInputNodeInputController : : IsValid ( ) const
{
return FBaseInputController : : IsValid ( ) & & ( nullptr ! = OwningGraphClassInputPtr . Get ( ) ) ;
}
2022-02-10 15:07:39 -05:00
# if WITH_EDITOR
2021-10-12 21:21:22 -04:00
FText FInputNodeInputController : : GetDisplayName ( ) const
{
if ( const FMetasoundFrontendClassInput * OwningInput = OwningGraphClassInputPtr . Get ( ) )
{
2022-01-26 18:11:52 -05:00
return OwningInput - > Metadata . GetDisplayName ( ) ;
2021-10-12 21:21:22 -04:00
}
return Invalid : : GetInvalidText ( ) ;
}
const FText & FInputNodeInputController : : GetTooltip ( ) const
{
if ( const FMetasoundFrontendClassInput * OwningInput = OwningGraphClassInputPtr . Get ( ) )
{
2022-01-26 18:11:52 -05:00
return OwningInput - > Metadata . GetDescription ( ) ;
2021-10-12 21:21:22 -04:00
}
return Invalid : : GetInvalidText ( ) ;
}
const FMetasoundFrontendVertexMetadata & FInputNodeInputController : : GetMetadata ( ) const
{
if ( const FMetasoundFrontendClassInput * OwningInput = OwningGraphClassInputPtr . Get ( ) )
{
return OwningInput - > Metadata ;
}
return Invalid : : GetInvalidVertexMetadata ( ) ;
}
2022-02-10 15:07:39 -05:00
# endif // WITH_EDITOR
2021-10-12 21:21:22 -04:00
void FInputNodeInputController : : SetName ( const FVertexName & InName )
{
if ( FMetasoundFrontendVertex * Vertex = ConstCastAccessPtr < FVertexAccessPtr > ( NodeVertexPtr ) . Get ( ) )
{
Vertex - > Name = InName ;
}
}
2022-07-18 17:14:25 -04:00
EMetasoundFrontendVertexAccessType FInputNodeInputController : : GetVertexAccessType ( ) const
{
return OwningGraphClassInputPtr . Get ( ) - > AccessType ;
}
2021-10-12 21:21:22 -04:00
2021-11-07 23:43:01 -05:00
bool FInputNodeInputController : : IsConnectionUserModifiable ( ) const
{
// Inputs to input nodes on a graph cannot be connected by the user
// because they must be exposed externally from the graph.
return false ;
}
2021-10-12 21:21:22 -04:00
FConnectability FInputNodeInputController : : CanConnectTo ( const IOutputController & InController ) const
{
static const FConnectability Connectability = { FConnectability : : EConnectable : : No } ;
return Connectability ;
}
bool FInputNodeInputController : : Connect ( IOutputController & InController )
{
return false ;
}
bool FInputNodeInputController : : ConnectWithConverterNode ( IOutputController & InController , const FConverterNodeInfo & InNodeClassName )
{
return false ;
}
2021-11-07 23:43:01 -05:00
FVariableInputController : : FVariableInputController ( const FInitParams & InParams )
: FBaseInputController ( InParams )
{
}
bool FVariableInputController : : IsConnectionUserModifiable ( ) const
{
// Variable connections are managed by the graph and cannot be modified
// by the user.
return false ;
}
2021-10-12 21:21:22 -04:00
}
}
# undef LOCTEXT_NAMESPACE