2023-03-07 17:01:52 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "MetasoundFrontendDocumentBuilder.h"
2024-08-13 14:58:36 -04:00
# include "Algo/AllOf.h"
2023-03-07 17:01:52 -05:00
# include "Algo/AnyOf.h"
# include "Algo/Find.h"
2023-05-30 14:39:48 -04:00
# include "Algo/ForEach.h"
2023-03-07 17:01:52 -05:00
# include "Algo/NoneOf.h"
2023-03-13 17:23:05 -04:00
# include "Algo/Sort.h"
2023-03-07 17:01:52 -05:00
# include "Algo/Transform.h"
2024-10-01 20:11:53 -04:00
# include "AudioParameter.h"
2023-03-13 17:23:05 -04:00
# include "Interfaces/MetasoundFrontendInterfaceBindingRegistry.h"
# include "Interfaces/MetasoundFrontendInterfaceRegistry.h"
2023-03-07 17:01:52 -05:00
# include "MetasoundAssetBase.h"
# include "MetasoundAssetManager.h"
# include "MetasoundDocumentInterface.h"
2023-05-30 14:39:48 -04:00
# include "MetasoundFrontendController.h"
- 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
# include "MetasoundFrontendDataTypeRegistry.h"
2023-03-07 17:01:52 -05:00
# include "MetasoundFrontendDocumentCache.h"
# include "MetasoundFrontendDocument.h"
2023-09-05 17:54:02 -04:00
# include "MetasoundFrontendDocumentIdGenerator.h"
2023-06-16 17:48:20 -04:00
# include "MetasoundFrontendDocumentModifyDelegates.h"
- 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
# include "MetasoundFrontendDocumentVersioning.h"
2023-09-05 17:54:02 -04:00
# include "MetasoundFrontendNodeTemplateRegistry.h"
2023-03-07 17:01:52 -05:00
# include "MetasoundFrontendRegistries.h"
2023-10-12 16:37:45 -04:00
# include "MetasoundFrontendRegistryKey.h"
2023-03-07 17:01:52 -05:00
# include "MetasoundFrontendSearchEngine.h"
# include "MetasoundFrontendTransform.h"
# include "MetasoundTrace.h"
- 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
# include "MetasoundVariableNodes.h"
# include "NodeTemplates/MetasoundFrontendNodeTemplateInput.h"
2023-03-07 17:01:52 -05:00
# include UE_INLINE_GENERATED_CPP_BY_NAME(MetasoundFrontendDocumentBuilder)
namespace Metasound : : Frontend
{
namespace DocumentBuilderPrivate
{
- 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
bool FindInputRegistryClass ( FName TypeName , EMetasoundFrontendVertexAccessType AccessType , FMetasoundFrontendClass & OutClass )
{
switch ( AccessType )
{
case EMetasoundFrontendVertexAccessType : : Value :
{
return IDataTypeRegistry : : Get ( ) . GetFrontendConstructorInputClass ( TypeName , OutClass ) ;
}
break ;
case EMetasoundFrontendVertexAccessType : : Reference :
{
return IDataTypeRegistry : : Get ( ) . GetFrontendInputClass ( TypeName , OutClass ) ;
}
break ;
case EMetasoundFrontendVertexAccessType : : Unset :
default :
{
checkNoEntry ( ) ;
}
break ;
}
return false ;
}
bool FindOutputRegistryClass ( FName TypeName , EMetasoundFrontendVertexAccessType AccessType , FMetasoundFrontendClass & OutClass )
{
switch ( AccessType )
{
case EMetasoundFrontendVertexAccessType : : Value :
{
return IDataTypeRegistry : : Get ( ) . GetFrontendConstructorOutputClass ( TypeName , OutClass ) ;
}
break ;
case EMetasoundFrontendVertexAccessType : : Reference :
{
return IDataTypeRegistry : : Get ( ) . GetFrontendOutputClass ( TypeName , OutClass ) ;
}
break ;
case EMetasoundFrontendVertexAccessType : : Unset :
default :
{
checkNoEntry ( ) ;
}
break ;
}
return false ;
}
2024-10-01 20:11:53 -04:00
bool NameContainsInterfaceNamespace ( FName VertexName , FMetasoundFrontendInterface * OutInterface )
{
using namespace Metasound : : Frontend ;
FName InterfaceNamespace ;
FName ParamName ;
Audio : : FParameterPath : : SplitName ( VertexName , InterfaceNamespace , ParamName ) ;
FMetasoundFrontendInterface FoundInterface ;
if ( ! InterfaceNamespace . IsNone ( ) & & ISearchEngine : : Get ( ) . FindInterfaceWithHighestVersion ( InterfaceNamespace , FoundInterface ) )
{
if ( OutInterface )
{
* OutInterface = MoveTemp ( FoundInterface ) ;
}
return true ;
}
if ( OutInterface )
{
* OutInterface = { } ;
}
return false ;
}
bool IsInterfaceInput ( FName InputName , FName TypeName , FMetasoundFrontendInterface * OutInterface )
{
FMetasoundFrontendInterface Interface ;
if ( NameContainsInterfaceNamespace ( InputName , & Interface ) )
{
auto IsInput = [ & InputName , & TypeName ] ( const FMetasoundFrontendClassInput & InterfaceInput )
{
return InputName = = InterfaceInput . Name & & InterfaceInput . TypeName = = TypeName ;
} ;
if ( Interface . Inputs . ContainsByPredicate ( IsInput ) )
{
if ( OutInterface )
{
* OutInterface = MoveTemp ( Interface ) ;
}
return true ;
}
}
if ( OutInterface )
{
* OutInterface = { } ;
}
return false ;
}
bool IsInterfaceOutput ( FName OutputName , FName TypeName , FMetasoundFrontendInterface * OutInterface )
{
FMetasoundFrontendInterface Interface ;
if ( NameContainsInterfaceNamespace ( OutputName , & Interface ) )
{
auto IsOutput = [ & OutputName , & TypeName ] ( const FMetasoundFrontendClassInput & InterfaceOutput )
{
return OutputName = = InterfaceOutput . Name & & InterfaceOutput . TypeName = = TypeName ;
} ;
if ( Interface . Outputs . ContainsByPredicate ( IsOutput ) )
{
if ( OutInterface )
{
* OutInterface = MoveTemp ( Interface ) ;
}
return true ;
}
}
if ( OutInterface )
{
* OutInterface = { } ;
}
return false ;
}
2023-03-13 17:23:05 -04:00
bool TryGetInterfaceBoundEdges (
const FGuid & InFromNodeID ,
2023-06-22 14:51:42 -04:00
const TSet < FMetasoundFrontendVersion > & InFromNodeInterfaces ,
2023-03-13 17:23:05 -04:00
const FGuid & InToNodeID ,
2023-06-22 14:51:42 -04:00
const TSet < FMetasoundFrontendVersion > & InToNodeInterfaces ,
2023-03-13 17:23:05 -04:00
TSet < FNamedEdge > & OutNamedEdges )
{
OutNamedEdges . Reset ( ) ;
TSet < FName > InputNames ;
2023-06-22 14:51:42 -04:00
for ( const FMetasoundFrontendVersion & InputInterfaceVersion : InToNodeInterfaces )
2023-03-13 17:23:05 -04:00
{
TArray < const FInterfaceBindingRegistryEntry * > BindingEntries ;
if ( IInterfaceBindingRegistry : : Get ( ) . FindInterfaceBindingEntries ( InputInterfaceVersion , BindingEntries ) )
{
Algo : : Sort ( BindingEntries , [ ] ( const FInterfaceBindingRegistryEntry * A , const FInterfaceBindingRegistryEntry * B )
{
check ( A ) ;
check ( B ) ;
return A - > GetBindingPriority ( ) < B - > GetBindingPriority ( ) ;
} ) ;
// Bindings are sorted in registry with earlier entries being higher priority to apply connections,
// so earlier listed connections are selected over potential collisions with later entries.
for ( const FInterfaceBindingRegistryEntry * BindingEntry : BindingEntries )
{
check ( BindingEntry ) ;
2023-06-22 14:51:42 -04:00
if ( InFromNodeInterfaces . Contains ( BindingEntry - > GetOutputInterfaceVersion ( ) ) )
2023-03-13 17:23:05 -04:00
{
for ( const FMetasoundFrontendInterfaceVertexBinding & VertexBinding : BindingEntry - > GetVertexBindings ( ) )
{
if ( ! InputNames . Contains ( VertexBinding . InputName ) )
{
InputNames . Add ( VertexBinding . InputName ) ;
OutNamedEdges . Add ( FNamedEdge { InFromNodeID , VertexBinding . OutputName , InToNodeID , VertexBinding . InputName } ) ;
}
}
}
}
}
} ;
return true ;
}
2023-09-15 11:47:57 -04:00
void SetNodeAndVertexNames ( FMetasoundFrontendNode & InOutNode , const FMetasoundFrontendClassVertex & InVertex )
2023-03-07 17:01:52 -05:00
{
InOutNode . Name = InVertex . Name ;
// Set name on related vertices of input node
auto IsVertexWithTypeName = [ & InVertex ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . TypeName = = InVertex . TypeName ; } ;
if ( FMetasoundFrontendVertex * InputVertex = InOutNode . Interface . Inputs . FindByPredicate ( IsVertexWithTypeName ) )
{
InputVertex - > Name = InVertex . Name ;
}
else
{
2023-05-26 15:52:39 -04:00
UE_LOG ( LogMetaSound , Error , TEXT ( " Node associated with graph vertex of type '%s' does not contain input vertex of matching type. " ) , * InVertex . TypeName . ToString ( ) ) ;
2023-03-07 17:01:52 -05:00
}
if ( FMetasoundFrontendVertex * OutputVertex = InOutNode . Interface . Outputs . FindByPredicate ( IsVertexWithTypeName ) )
{
OutputVertex - > Name = InVertex . Name ;
}
else
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Node associated with graph vertex of type '%s' does not contain output vertex of matching type. " ) , * InVertex . TypeName . ToString ( ) ) ;
}
}
2023-05-10 20:28:39 -04:00
2023-09-15 11:47:57 -04:00
void SetDefaultLiteralOnInputNode ( FMetasoundFrontendNode & InOutNode , const FMetasoundFrontendClassInput & InClassInput )
{
// Set the default literal on the nodes inputs so that it gets passed to the instantiated TInputNode on a live
// auditioned MetaSound
auto IsVertexWithName = [ & Name = InClassInput . Name ] ( const FMetasoundFrontendVertex & InVertex )
{
return InVertex . Name = = Name ;
} ;
if ( const FMetasoundFrontendVertex * InputVertex = InOutNode . Interface . Inputs . FindByPredicate ( IsVertexWithName ) )
{
auto IsVertexLiteralWithVertexID = [ & VertexID = InputVertex - > VertexID ] ( const FMetasoundFrontendVertexLiteral & VertexLiteral )
{
return VertexLiteral . VertexID = = VertexID ;
} ;
if ( FMetasoundFrontendVertexLiteral * VertexLiteral = InOutNode . InputLiterals . FindByPredicate ( IsVertexLiteralWithVertexID ) )
{
// Update existing literal default value with value from class input.
2024-07-26 14:23:35 -04:00
const FMetasoundFrontendLiteral & DefaultLiteral = InClassInput . FindConstDefaultChecked ( Frontend : : DefaultPageID ) ;
VertexLiteral - > Value = DefaultLiteral ;
2023-09-15 11:47:57 -04:00
}
else
{
// Add literal default value with value from class input.
2024-07-26 14:23:35 -04:00
const FMetasoundFrontendLiteral & DefaultLiteral = InClassInput . FindConstDefaultChecked ( Frontend : : DefaultPageID ) ;
InOutNode . InputLiterals . Add ( FMetasoundFrontendVertexLiteral { InputVertex - > VertexID , DefaultLiteral } ) ;
2023-09-15 11:47:57 -04:00
}
}
else
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Input node associated with graph input vertex of name '%s' does not contain input vertex with matching name. " ) , * InClassInput . Name . ToString ( ) ) ;
}
}
2023-05-10 20:28:39 -04:00
class FModifyInterfacesImpl
{
public :
2023-09-05 17:54:02 -04:00
FModifyInterfacesImpl ( FMetasoundFrontendDocument & InDocument , FModifyInterfaceOptions & & InOptions )
2023-05-10 20:28:39 -04:00
: Options ( MoveTemp ( InOptions ) )
2023-09-05 17:54:02 -04:00
, Document ( InDocument )
2023-05-10 20:28:39 -04:00
{
for ( const FMetasoundFrontendInterface & FromInterface : Options . InterfacesToRemove )
{
InputsToRemove . Append ( FromInterface . Inputs ) ;
OutputsToRemove . Append ( FromInterface . Outputs ) ;
}
for ( const FMetasoundFrontendInterface & ToInterface : Options . InterfacesToAdd )
{
2023-09-05 17:54:02 -04:00
Algo : : Transform ( ToInterface . Inputs , InputsToAdd , [ this , & ToInterface ] ( const FMetasoundFrontendClassInput & Input )
2023-05-10 20:28:39 -04:00
{
FMetasoundFrontendClassInput NewInput = Input ;
2023-09-05 17:54:02 -04:00
NewInput . NodeID = FDocumentIDGenerator : : Get ( ) . CreateNodeID ( Document ) ;
NewInput . VertexID = FDocumentIDGenerator : : Get ( ) . CreateVertexID ( Document ) ;
2023-05-10 20:28:39 -04:00
return FInputInterfacePair { MoveTemp ( NewInput ) , & ToInterface } ;
} ) ;
2023-09-05 17:54:02 -04:00
Algo : : Transform ( ToInterface . Outputs , OutputsToAdd , [ this , & ToInterface ] ( const FMetasoundFrontendClassOutput & Output )
2023-05-10 20:28:39 -04:00
{
FMetasoundFrontendClassOutput NewOutput = Output ;
2023-09-05 17:54:02 -04:00
NewOutput . NodeID = FDocumentIDGenerator : : Get ( ) . CreateNodeID ( Document ) ;
NewOutput . VertexID = FDocumentIDGenerator : : Get ( ) . CreateVertexID ( Document ) ;
2023-05-10 20:28:39 -04:00
return FOutputInterfacePair { MoveTemp ( NewOutput ) , & ToInterface } ;
} ) ;
}
// Iterate in reverse to allow removal from `InputsToAdd`
for ( int32 AddIndex = InputsToAdd . Num ( ) - 1 ; AddIndex > = 0 ; AddIndex - - )
{
const FMetasoundFrontendClassVertex & VertexToAdd = InputsToAdd [ AddIndex ] . Key ;
const int32 RemoveIndex = InputsToRemove . IndexOfByPredicate ( [ & ] ( const FMetasoundFrontendClassVertex & VertexToRemove )
{
if ( VertexToAdd . TypeName ! = VertexToRemove . TypeName )
{
return false ;
}
if ( Options . NamePairingFunction )
{
return Options . NamePairingFunction ( VertexToAdd . Name , VertexToRemove . Name ) ;
}
FName ParamA ;
FName ParamB ;
FName Namespace ;
VertexToAdd . SplitName ( Namespace , ParamA ) ;
VertexToRemove . SplitName ( Namespace , ParamB ) ;
return ParamA = = ParamB ;
} ) ;
if ( INDEX_NONE ! = RemoveIndex )
{
PairedInputs . Add ( FVertexPair { InputsToRemove [ RemoveIndex ] , InputsToAdd [ AddIndex ] . Key } ) ;
2024-02-19 16:51:58 -05:00
InputsToRemove . RemoveAtSwap ( RemoveIndex , EAllowShrinking : : No ) ;
InputsToAdd . RemoveAtSwap ( AddIndex , EAllowShrinking : : No ) ;
2023-05-10 20:28:39 -04:00
}
}
// Iterate in reverse to allow removal from `OutputsToAdd`
for ( int32 AddIndex = OutputsToAdd . Num ( ) - 1 ; AddIndex > = 0 ; AddIndex - - )
{
const FMetasoundFrontendClassVertex & VertexToAdd = OutputsToAdd [ AddIndex ] . Key ;
const int32 RemoveIndex = OutputsToRemove . IndexOfByPredicate ( [ & ] ( const FMetasoundFrontendClassVertex & VertexToRemove )
{
if ( VertexToAdd . TypeName ! = VertexToRemove . TypeName )
{
return false ;
}
if ( Options . NamePairingFunction )
{
return Options . NamePairingFunction ( VertexToAdd . Name , VertexToRemove . Name ) ;
}
FName ParamA ;
FName ParamB ;
FName Namespace ;
VertexToAdd . SplitName ( Namespace , ParamA ) ;
VertexToRemove . SplitName ( Namespace , ParamB ) ;
return ParamA = = ParamB ;
} ) ;
if ( INDEX_NONE ! = RemoveIndex )
{
PairedOutputs . Add ( FVertexPair { OutputsToRemove [ RemoveIndex ] , OutputsToAdd [ AddIndex ] . Key } ) ;
OutputsToRemove . RemoveAtSwap ( RemoveIndex ) ;
OutputsToAdd . RemoveAtSwap ( AddIndex ) ;
}
}
}
private :
bool AddMissingVertices ( FMetaSoundFrontendDocumentBuilder & OutBuilder ) const
{
if ( ! InputsToAdd . IsEmpty ( ) | | ! OutputsToAdd . IsEmpty ( ) )
{
for ( const FInputInterfacePair & Pair : InputsToAdd )
{
OutBuilder . AddGraphInput ( Pair . Key ) ;
}
for ( const FOutputInterfacePair & Pair : OutputsToAdd )
{
OutBuilder . AddGraphOutput ( Pair . Key ) ;
}
return true ;
}
return false ;
}
bool RemoveUnsupportedVertices ( FMetaSoundFrontendDocumentBuilder & OutBuilder ) const
{
2023-08-02 14:39:50 -04:00
bool bDidEdit = false ;
for ( const TPair < FMetasoundFrontendClassInput , const FMetasoundFrontendInterface * > & Pair : InputsToAdd )
{
if ( OutBuilder . RemoveGraphInput ( Pair . Key . Name ) )
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Removed existing targeted input '%s' to avoid name collision/member data descrepancies while modifying interface(s). Desired edges may have been removed as a result. " ) , * Pair . Key . Name . ToString ( ) ) ;
bDidEdit = true ;
}
}
for ( const TPair < FMetasoundFrontendClassOutput , const FMetasoundFrontendInterface * > & Pair : OutputsToAdd )
{
if ( OutBuilder . RemoveGraphOutput ( Pair . Key . Name ) )
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Removed existing targeted output '%s' to avoid name collision/member data descrepancies while modifying interface(s). Desired edges may have been removed as a result. " ) , * Pair . Key . Name . ToString ( ) ) ;
bDidEdit = true ;
}
}
2023-05-10 20:28:39 -04:00
if ( ! InputsToRemove . IsEmpty ( ) | | ! OutputsToRemove . IsEmpty ( ) )
{
// Remove unsupported inputs
for ( const FMetasoundFrontendClassVertex & InputToRemove : InputsToRemove )
{
2023-08-02 14:39:50 -04:00
if ( OutBuilder . RemoveGraphInput ( InputToRemove . Name ) )
{
bDidEdit = true ;
}
else
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Failed to remove existing input '%s', which was an expected member of a removed interface. " ) , * InputToRemove . Name . ToString ( ) ) ;
}
2023-05-10 20:28:39 -04:00
}
// Remove unsupported outputs
for ( const FMetasoundFrontendClassVertex & OutputToRemove : OutputsToRemove )
{
2023-08-02 14:39:50 -04:00
if ( OutBuilder . RemoveGraphOutput ( OutputToRemove . Name ) )
{
bDidEdit = true ;
}
else
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Failed to remove existing output '%s', which was an expected member of a removed interface. " ) , * OutputToRemove . Name . ToString ( ) ) ;
}
2023-05-10 20:28:39 -04:00
}
return true ;
}
return false ;
}
bool SwapPairedVertices ( FMetaSoundFrontendDocumentBuilder & OutBuilder ) const
{
bool bDidEdit = false ;
for ( const FVertexPair & PairedInput : PairedInputs )
{
2023-06-26 19:29:25 -04:00
const bool bSwapped = OutBuilder . SwapGraphInput ( PairedInput . Get < 0 > ( ) , PairedInput . Get < 1 > ( ) ) ;
bDidEdit | = bSwapped ;
2023-05-10 20:28:39 -04:00
}
for ( const FVertexPair & PairedOutput : PairedOutputs )
{
2023-06-26 19:29:25 -04:00
const bool bSwapped = OutBuilder . SwapGraphOutput ( PairedOutput . Get < 0 > ( ) , PairedOutput . Get < 1 > ( ) ) ;
bDidEdit | = bSwapped ;
2023-05-10 20:28:39 -04:00
}
return bDidEdit ;
}
# if WITH_EDITORONLY_DATA
void UpdateAddedVertexNodePositions (
EMetasoundFrontendClassType ClassType ,
const FMetaSoundFrontendDocumentBuilder & InBuilder ,
TSet < FName > & AddedNames ,
TFunctionRef < int32 ( const FVertexName & ) > InGetSortOrder ,
2024-05-20 14:35:03 -04:00
const FVector2D & InitOffset ,
2023-05-10 20:28:39 -04:00
TArrayView < FMetasoundFrontendNode > OutNodes )
{
// Add graph member nodes by sort order
TSortedMap < int32 , FMetasoundFrontendNode * > SortOrderToNode ;
for ( FMetasoundFrontendNode & Node : OutNodes )
{
if ( const FMetasoundFrontendClass * Class = InBuilder . FindDependency ( Node . ClassID ) )
{
if ( Class - > Metadata . GetType ( ) = = ClassType )
{
const int32 Index = InGetSortOrder ( Node . Name ) ;
SortOrderToNode . Add ( Index , & Node ) ;
}
}
}
// Prime the first location as an offset prior to an existing location (as provided by a swapped member)
// to avoid placing away from user's active area if possible.
2024-05-20 14:35:03 -04:00
FVector2D NextLocation = InitOffset ;
2023-05-10 20:28:39 -04:00
{
int32 NumBeforeDefined = 1 ;
for ( const TPair < int32 , FMetasoundFrontendNode * > & Pair : SortOrderToNode )
{
const FMetasoundFrontendNode * Node = Pair . Value ;
const FName NodeName = Node - > Name ;
if ( AddedNames . Contains ( NodeName ) )
{
NumBeforeDefined + + ;
}
else
{
const TMap < FGuid , FVector2D > & Locations = Node - > Style . Display . Locations ;
if ( ! Locations . IsEmpty ( ) )
{
for ( const TPair < FGuid , FVector2D > & Location : Locations )
{
NextLocation = Location . Value - ( NumBeforeDefined * DisplayStyle : : NodeLayout : : DefaultOffsetY ) ;
break ;
}
break ;
}
}
}
}
2024-10-01 20:11:53 -04:00
// Iterate through sorted map in sequence, slotting in new locations after
// existing swapped nodes with predefined locations relative to one another.
2023-05-10 20:28:39 -04:00
for ( TPair < int32 , FMetasoundFrontendNode * > & Pair : SortOrderToNode )
{
FMetasoundFrontendNode * Node = Pair . Value ;
const FName NodeName = Node - > Name ;
if ( AddedNames . Contains ( NodeName ) )
{
2024-10-01 20:11:53 -04:00
bool bAddedLocation = false ;
for ( TPair < FGuid , FVector2D > & LocationPair : Node - > Style . Display . Locations )
{
bAddedLocation = true ;
LocationPair . Value = NextLocation ;
}
if ( ! bAddedLocation )
{
Node - > Style . Display . Locations . Add ( FGuid : : NewGuid ( ) , NextLocation ) ;
}
2023-05-10 20:28:39 -04:00
NextLocation + = DisplayStyle : : NodeLayout : : DefaultOffsetY ;
}
else
{
for ( const TPair < FGuid , FVector2D > & Location : Node - > Style . Display . Locations )
{
NextLocation = Location . Value + DisplayStyle : : NodeLayout : : DefaultOffsetY ;
}
}
}
}
# endif // WITH_EDITORONLY_DATA
public :
2023-09-05 17:54:02 -04:00
bool Execute ( FMetaSoundFrontendDocumentBuilder & OutBuilder , FDocumentModifyDelegates & OutDelegates )
2023-05-10 20:28:39 -04:00
{
bool bDidEdit = false ;
for ( const FMetasoundFrontendInterface & Interface : Options . InterfacesToRemove )
{
2023-09-05 17:54:02 -04:00
if ( Document . Interfaces . Contains ( Interface . Version ) )
2023-05-10 20:28:39 -04:00
{
2023-06-16 17:48:20 -04:00
OutDelegates . InterfaceDelegates . OnRemovingInterface . Broadcast ( Interface ) ;
2023-05-10 20:28:39 -04:00
bDidEdit = true ;
# if WITH_EDITORONLY_DATA
2023-09-05 17:54:02 -04:00
Document . Metadata . ModifyContext . AddInterfaceModified ( Interface . Version . Name ) ;
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITORONLY_DATA
2023-09-05 17:54:02 -04:00
Document . Interfaces . Remove ( Interface . Version ) ;
2023-05-10 20:28:39 -04:00
}
}
for ( const FMetasoundFrontendInterface & Interface : Options . InterfacesToAdd )
{
bool bAlreadyInSet = false ;
2023-09-05 17:54:02 -04:00
Document . Interfaces . Add ( Interface . Version , & bAlreadyInSet ) ;
2023-05-10 20:28:39 -04:00
if ( ! bAlreadyInSet )
{
2023-06-16 17:48:20 -04:00
OutDelegates . InterfaceDelegates . OnInterfaceAdded . Broadcast ( Interface ) ;
2023-05-10 20:28:39 -04:00
bDidEdit = true ;
# if WITH_EDITORONLY_DATA
2023-09-05 17:54:02 -04:00
Document . Metadata . ModifyContext . AddInterfaceModified ( Interface . Version . Name ) ;
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITORONLY_DATA
}
}
bDidEdit | = RemoveUnsupportedVertices ( OutBuilder ) ;
bDidEdit | = SwapPairedVertices ( OutBuilder ) ;
const bool bAddedVertices = AddMissingVertices ( OutBuilder ) ;
bDidEdit | = bAddedVertices ;
if ( bDidEdit )
{
OutBuilder . RemoveUnusedDependencies ( ) ;
}
# if WITH_EDITORONLY_DATA
- 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
if ( bAddedVertices & & Options . bSetDefaultNodeLocations & & ! IsRunningCookCommandlet ( ) )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
TArray < FMetasoundFrontendNode > & Nodes = Graph . Nodes ;
// Sort/Place Inputs
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
TSet < FName > NamesToSort ;
Algo : : Transform ( InputsToAdd , NamesToSort , [ ] ( const FInputInterfacePair & Pair ) { return Pair . Key . Name ; } ) ;
auto GetInputSortOrder = [ & OutBuilder ] ( const FVertexName & InVertexName )
{
const FMetasoundFrontendClassInput * Input = OutBuilder . FindGraphInput ( InVertexName ) ;
checkf ( Input , TEXT ( " Input must exist by this point of modifying the document's interfaces and respective members " ) ) ;
return Input - > Metadata . SortOrderIndex ;
} ;
UpdateAddedVertexNodePositions ( EMetasoundFrontendClassType : : Input , OutBuilder , NamesToSort , GetInputSortOrder , FVector2D : : Zero ( ) , Nodes ) ;
}
2023-05-10 20:28:39 -04:00
2024-08-21 18:37:59 -04:00
// Sort/Place Outputs
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
TSet < FName > NamesToSort ;
Algo : : Transform ( OutputsToAdd , NamesToSort , [ ] ( const FOutputInterfacePair & OutputInterfacePair ) { return OutputInterfacePair . Key . Name ; } ) ;
auto GetOutputSortOrder = [ & OutBuilder ] ( const FVertexName & InVertexName )
{
const FMetasoundFrontendClassOutput * Output = OutBuilder . FindGraphOutput ( InVertexName ) ;
checkf ( Output , TEXT ( " Output must exist by this point of modifying the document's interfaces and respective members " ) ) ;
return Output - > Metadata . SortOrderIndex ;
} ;
UpdateAddedVertexNodePositions ( EMetasoundFrontendClassType : : Output , OutBuilder , NamesToSort , GetOutputSortOrder , 3 * DisplayStyle : : NodeLayout : : DefaultOffsetX , Nodes ) ;
}
} ) ;
2023-05-10 20:28:39 -04:00
}
# endif // WITH_EDITORONLY_DATA
return bDidEdit ;
}
const FModifyInterfaceOptions Options ;
2023-09-05 17:54:02 -04:00
private :
FMetasoundFrontendDocument & Document ;
2023-05-10 20:28:39 -04:00
using FVertexPair = TTuple < FMetasoundFrontendClassVertex , FMetasoundFrontendClassVertex > ;
TArray < FVertexPair > PairedInputs ;
TArray < FVertexPair > PairedOutputs ;
using FInputInterfacePair = TPair < FMetasoundFrontendClassInput , const FMetasoundFrontendInterface * > ;
using FOutputInterfacePair = TPair < FMetasoundFrontendClassOutput , const FMetasoundFrontendInterface * > ;
TArray < FInputInterfacePair > InputsToAdd ;
TArray < FOutputInterfacePair > OutputsToAdd ;
TArray < FMetasoundFrontendClassInput > InputsToRemove ;
TArray < FMetasoundFrontendClassOutput > OutputsToRemove ;
} ;
2023-03-07 17:01:52 -05:00
} // namespace DocumentBuilderPrivate
2023-05-10 20:28:39 -04:00
2023-07-27 19:43:47 -04:00
FString LexToString ( const EInvalidEdgeReason & InReason )
{
switch ( InReason )
{
case EInvalidEdgeReason : : None :
return TEXT ( " No reason " ) ;
case EInvalidEdgeReason : : MismatchedAccessType :
return TEXT ( " Mismatched Access Type " ) ;
case EInvalidEdgeReason : : MismatchedDataType :
return TEXT ( " Mismatched DataType " ) ;
case EInvalidEdgeReason : : MissingInput :
return TEXT ( " Missing Input " ) ;
case EInvalidEdgeReason : : MissingOutput :
return TEXT ( " Missing Output " ) ;
default :
return TEXT ( " COUNT " ) ;
}
static_assert ( static_cast < uint32 > ( EInvalidEdgeReason : : COUNT ) = = 5 , " Potential missing case coverage for EInvalidEdgeReason " ) ;
}
2023-05-10 20:28:39 -04:00
FModifyInterfaceOptions : : FModifyInterfaceOptions ( const TArray < FMetasoundFrontendInterface > & InInterfacesToRemove , const TArray < FMetasoundFrontendInterface > & InInterfacesToAdd )
: InterfacesToRemove ( InInterfacesToRemove )
, InterfacesToAdd ( InInterfacesToAdd )
{
}
2023-06-16 17:48:20 -04:00
FModifyInterfaceOptions : : FModifyInterfaceOptions ( TArray < FMetasoundFrontendInterface > & & InInterfacesToRemove , TArray < FMetasoundFrontendInterface > & & InInterfacesToAdd )
: InterfacesToRemove ( MoveTemp ( InInterfacesToRemove ) )
, InterfacesToAdd ( MoveTemp ( InInterfacesToAdd ) )
{
}
2023-05-10 20:28:39 -04:00
FModifyInterfaceOptions : : FModifyInterfaceOptions ( const TArray < FMetasoundFrontendVersion > & InInterfaceVersionsToRemove , const TArray < FMetasoundFrontendVersion > & InInterfaceVersionsToAdd )
{
Algo : : Transform ( InInterfaceVersionsToRemove , InterfacesToRemove , [ ] ( const FMetasoundFrontendVersion & Version )
{
FMetasoundFrontendInterface Interface ;
const bool bFromInterfaceFound = IInterfaceRegistry : : Get ( ) . FindInterface ( GetInterfaceRegistryKey ( Version ) , Interface ) ;
if ( ! ensureAlways ( bFromInterfaceFound ) )
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Failed to find interface '%s' to remove " ) , * Version . ToString ( ) ) ;
}
return Interface ;
} ) ;
Algo : : Transform ( InInterfaceVersionsToAdd , InterfacesToAdd , [ ] ( const FMetasoundFrontendVersion & Version )
{
FMetasoundFrontendInterface Interface ;
const bool bToInterfaceFound = IInterfaceRegistry : : Get ( ) . FindInterface ( GetInterfaceRegistryKey ( Version ) , Interface ) ;
if ( ! ensureAlways ( bToInterfaceFound ) )
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Failed to find interface '%s' to add " ) , * Version . ToString ( ) ) ;
}
return Interface ;
} ) ;
}
2023-03-07 17:01:52 -05:00
} // namespace Metasound::Frontend
2024-05-08 14:53:53 -04:00
UMetaSoundBuilderDocument & UMetaSoundBuilderDocument : : Create ( const UClass & InMetaSoundUClass )
2023-09-05 17:54:02 -04:00
{
UMetaSoundBuilderDocument * DocObject = NewObject < UMetaSoundBuilderDocument > ( ) ;
2024-05-08 14:53:53 -04:00
check ( DocObject ) ;
DocObject - > MetaSoundUClass = & InMetaSoundUClass ;
2023-09-05 17:54:02 -04:00
return * DocObject ;
}
UMetaSoundBuilderDocument & UMetaSoundBuilderDocument : : Create ( const IMetaSoundDocumentInterface & InDocToCopy )
{
UMetaSoundBuilderDocument * DocObject = NewObject < UMetaSoundBuilderDocument > ( ) ;
2024-05-08 14:53:53 -04:00
check ( DocObject ) ;
2023-09-22 15:01:07 -04:00
DocObject - > Document = InDocToCopy . GetConstDocument ( ) ;
2023-09-05 17:54:02 -04:00
DocObject - > MetaSoundUClass = InDocToCopy . GetBaseMetaSoundUClass ( ) ;
2024-05-08 14:53:53 -04:00
DocObject - > BuilderUClass = InDocToCopy . GetBuilderUClass ( ) ;
2023-09-05 17:54:02 -04:00
return * DocObject ;
}
- 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
bool UMetaSoundBuilderDocument : : ConformObjectToDocument ( )
{
return false ;
}
2023-12-15 13:21:12 -05:00
FTopLevelAssetPath UMetaSoundBuilderDocument : : GetAssetPathChecked ( ) const
{
FTopLevelAssetPath Path ;
2024-01-08 17:02:57 -05:00
ensureAlwaysMsgf ( Path . TrySetPath ( this ) , TEXT ( " Failed to set TopLevelAssetPath from transient MetaSound '%s'. MetaSound must be highest level object in package. " ) , * GetPathName ( ) ) ;
ensureAlwaysMsgf ( Path . IsValid ( ) , TEXT ( " Failed to set TopLevelAssetPath from MetaSound '%s'. This may be caused by calling this function when the asset is being destroyed. " ) , * GetPathName ( ) ) ;
2023-12-15 13:21:12 -05:00
return Path ;
}
2023-09-22 15:01:07 -04:00
const FMetasoundFrontendDocument & UMetaSoundBuilderDocument : : GetConstDocument ( ) const
2023-09-05 17:54:02 -04:00
{
return Document ;
}
const UClass & UMetaSoundBuilderDocument : : GetBaseMetaSoundUClass ( ) const
{
checkf ( MetaSoundUClass , TEXT ( " BaseMetaSoundUClass must be set upon creation of UMetaSoundBuilderDocument instance " ) ) ;
return * MetaSoundUClass ;
}
2024-05-08 14:53:53 -04:00
const UClass & UMetaSoundBuilderDocument : : GetBuilderUClass ( ) const
{
checkf ( BuilderUClass , TEXT ( " BuilderUClass must be set upon creation of UMetaSoundBuilderDocument instance " ) ) ;
return * BuilderUClass ;
}
2024-04-24 10:36:28 -04:00
bool UMetaSoundBuilderDocument : : IsActivelyBuilding ( ) const
{
return true ;
}
2023-09-05 17:54:02 -04:00
FMetasoundFrontendDocument & UMetaSoundBuilderDocument : : GetDocument ( )
{
return Document ;
}
2023-09-22 15:01:07 -04:00
void UMetaSoundBuilderDocument : : OnBeginActiveBuilder ( )
{
// Nothing to do here. UMetaSoundBuilderDocuments are always being used by builders
}
void UMetaSoundBuilderDocument : : OnFinishActiveBuilder ( )
{
// Nothing to do here. UMetaSoundBuilderDocuments are always being used by builders
}
- 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
FMetaSoundFrontendDocumentBuilder : : FMetaSoundFrontendDocumentBuilder ( TScriptInterface < IMetaSoundDocumentInterface > InDocumentInterface , TSharedPtr < Metasound : : Frontend : : FDocumentModifyDelegates > InDocumentDelegates , bool bPrimeCache )
: DocumentInterface ( InDocumentInterface )
2023-06-16 17:48:20 -04:00
{
- 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
BeginBuilding ( InDocumentDelegates , bPrimeCache ) ;
2023-06-16 17:48:20 -04:00
}
2023-09-22 15:01:07 -04:00
FMetaSoundFrontendDocumentBuilder : : ~ FMetaSoundFrontendDocumentBuilder ( )
{
FinishBuilding ( ) ;
}
2023-03-07 17:01:52 -05:00
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClass * FMetaSoundFrontendDocumentBuilder : : AddDependency ( const FMetasoundFrontendClass & InClass )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2023-03-07 17:01:52 -05:00
const FMetasoundFrontendClass * Dependency = nullptr ;
FMetasoundFrontendClass NewDependency = InClass ;
2023-06-16 17:48:20 -04:00
// All 'Graph' dependencies are listed as 'External' from the perspective of the owning document.
2023-03-07 17:01:52 -05:00
// This makes them implementation agnostic to accommodate nativization of assets.
2023-06-16 17:48:20 -04:00
if ( NewDependency . Metadata . GetType ( ) = = EMetasoundFrontendClassType : : Graph )
{
NewDependency . Metadata . SetType ( EMetasoundFrontendClassType : : External ) ;
}
2023-09-05 17:54:02 -04:00
NewDependency . ID = FDocumentIDGenerator : : Get ( ) . CreateClassID ( Document ) ;
2023-03-07 17:01:52 -05:00
Dependency = & Document . Dependencies . Emplace_GetRef ( MoveTemp ( NewDependency ) ) ;
const int32 NewIndex = Document . Dependencies . Num ( ) - 1 ;
2023-06-16 17:48:20 -04:00
DocumentDelegates - > OnDependencyAdded . Broadcast ( NewIndex ) ;
2023-03-07 17:01:52 -05:00
return Dependency ;
}
2024-06-18 16:47:21 -04:00
void FMetaSoundFrontendDocumentBuilder : : AddEdge ( FMetasoundFrontendEdge & & InNewEdge , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
- 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
# if DO_CHECK
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2024-09-10 10:26:02 -04:00
checkf ( ! EdgeCache . IsNodeInputConnected ( InNewEdge . ToNodeID , InNewEdge . ToVertexID ) , TEXT ( " Failed to add edge in MetaSound Builder: Destination input already connected " ) ) ;
- 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
2024-06-18 16:47:21 -04:00
const EInvalidEdgeReason Reason = IsValidEdge ( InNewEdge , & PageID ) ;
- 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
checkf ( Reason = = Metasound : : Frontend : : EInvalidEdgeReason : : None , TEXT ( " Attempted call to AddEdge in MetaSound Builder where edge is invalid: %s. " ) , * LexToString ( Reason ) ) ;
}
# endif // DO_CHECK
2023-03-07 17:01:52 -05:00
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( PageID ) ;
2023-07-27 19:43:47 -04:00
Graph . Edges . Add ( MoveTemp ( InNewEdge ) ) ;
const int32 NewIndex = Graph . Edges . Num ( ) - 1 ;
2024-06-18 16:47:21 -04:00
DocumentDelegates - > FindEdgeDelegatesChecked ( PageID ) . OnEdgeAdded . Broadcast ( NewIndex ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : AddNamedEdges ( const TSet < Metasound : : Frontend : : FNamedEdge > & EdgesToMake , TArray < const FMetasoundFrontendEdge * > * OutNewEdges , bool bReplaceExistingConnections , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( PageID ) ;
2023-03-07 17:01:52 -05:00
if ( OutNewEdges )
{
OutNewEdges - > Reset ( ) ;
}
bool bSuccess = true ;
2023-07-27 19:43:47 -04:00
struct FNewEdgeData
{
FMetasoundFrontendEdge NewEdge ;
const FMetasoundFrontendVertex * OutputVertex = nullptr ;
const FMetasoundFrontendVertex * InputVertex = nullptr ;
} ;
TArray < FNewEdgeData > EdgesToAdd ;
2023-03-13 17:23:05 -04:00
for ( const FNamedEdge & Edge : EdgesToMake )
2023-03-07 17:01:52 -05:00
{
2023-03-13 17:23:05 -04:00
const FMetasoundFrontendVertex * OutputVertex = NodeCache . FindOutputVertex ( Edge . OutputNodeID , Edge . OutputName ) ;
const FMetasoundFrontendVertex * InputVertex = NodeCache . FindInputVertex ( Edge . InputNodeID , Edge . InputName ) ;
2023-03-07 17:01:52 -05:00
if ( OutputVertex & & InputVertex )
{
2023-03-13 17:23:05 -04:00
FMetasoundFrontendEdge NewEdge = { Edge . OutputNodeID , OutputVertex - > VertexID , Edge . InputNodeID , InputVertex - > VertexID } ;
2023-07-27 19:43:47 -04:00
const EInvalidEdgeReason InvalidEdgeReason = IsValidEdge ( NewEdge ) ;
if ( InvalidEdgeReason = = EInvalidEdgeReason : : None )
2023-03-07 17:01:52 -05:00
{
2023-07-27 19:43:47 -04:00
EdgesToAdd . Add ( FNewEdgeData { MoveTemp ( NewEdge ) , OutputVertex , InputVertex } ) ;
2023-03-07 17:01:52 -05:00
}
else
{
bSuccess = false ;
2023-07-27 19:43:47 -04:00
UE_LOG ( LogMetaSound , Error , TEXT ( " Failed to add connections between MetaSound output '%s' and input '%s': '%s'. " ) , * Edge . OutputName . ToString ( ) , * Edge . InputName . ToString ( ) , * LexToString ( InvalidEdgeReason ) ) ;
2023-03-07 17:01:52 -05:00
}
}
}
2024-06-18 16:47:21 -04:00
const TArray < FMetasoundFrontendEdge > & Edges = Graph . Edges ;
2023-06-26 15:42:30 -04:00
const int32 LastIndex = Edges . Num ( ) - 1 ;
2023-07-27 19:43:47 -04:00
for ( FNewEdgeData & EdgeToAdd : EdgesToAdd )
2023-03-07 17:01:52 -05:00
{
2023-07-27 19:43:47 -04:00
if ( bReplaceExistingConnections )
{
# if !NO_LOGGING
const FMetasoundFrontendNode * OldOutputNode = nullptr ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * OldOutputVertex = FindNodeOutputConnectedToNodeInput ( EdgeToAdd . NewEdge . ToNodeID , EdgeToAdd . NewEdge . ToVertexID , & OldOutputNode , & PageID ) ;
2023-07-27 19:43:47 -04:00
# endif // !NO_LOGGING
2024-06-18 16:47:21 -04:00
const bool bRemovedEdge = RemoveEdgeToNodeInput ( EdgeToAdd . NewEdge . ToNodeID , EdgeToAdd . NewEdge . ToVertexID , & PageID ) ;
2023-07-27 19:43:47 -04:00
# if !NO_LOGGING
if ( bRemovedEdge )
{
checkf ( OldOutputNode , TEXT ( " MetaSound edge was removed from output but output node not found. " ) ) ;
checkf ( OldOutputVertex , TEXT ( " MetaSound edge was removed from output but output vertex not found. " ) ) ;
const FMetasoundFrontendNode * InputNode = FindNode ( EdgeToAdd . NewEdge . ToNodeID ) ;
checkf ( InputNode , TEXT ( " Edge was deemed valid but input parent node is missing " ) ) ;
const FMetasoundFrontendNode * OutputNode = FindNode ( EdgeToAdd . NewEdge . FromNodeID ) ;
checkf ( OutputNode , TEXT ( " Edge was deemed valid but output parent node is missing " ) ) ;
UE_LOG ( LogMetaSound , Verbose , TEXT ( " Removed connection from node output '%s:%s' to node '%s:%s' in order to connect to node output '%s:%s' " ) ,
* OldOutputNode - > Name . ToString ( ) ,
* OldOutputVertex - > Name . ToString ( ) ,
* InputNode - > Name . ToString ( ) ,
* EdgeToAdd . InputVertex - > Name . ToString ( ) ,
* OutputNode - > Name . ToString ( ) ,
* EdgeToAdd . OutputVertex - > Name . ToString ( ) ) ;
}
# endif // !NO_LOGGING
2024-06-18 16:47:21 -04:00
AddEdge ( MoveTemp ( EdgeToAdd . NewEdge ) , & PageID ) ;
2023-07-27 19:43:47 -04:00
}
2024-06-18 16:47:21 -04:00
else if ( ! IsNodeInputConnected ( EdgeToAdd . NewEdge . ToNodeID , EdgeToAdd . NewEdge . ToVertexID , & PageID ) )
2023-07-27 19:43:47 -04:00
{
2024-06-18 16:47:21 -04:00
AddEdge ( MoveTemp ( EdgeToAdd . NewEdge ) , & PageID ) ;
2023-07-27 19:43:47 -04:00
}
else
2023-03-07 17:01:52 -05:00
{
bSuccess = false ;
2023-07-27 19:43:47 -04:00
# if !NO_LOGGING
FMetasoundFrontendEdge EdgeToRemove ;
2024-06-18 16:47:21 -04:00
if ( const int32 * EdgeIndex = DocumentCache - > GetEdgeCache ( PageID ) . FindEdgeIndexToNodeInput ( EdgeToAdd . NewEdge . ToNodeID , EdgeToAdd . NewEdge . ToVertexID ) )
2023-07-27 19:43:47 -04:00
{
2024-05-29 15:33:29 -04:00
EdgeToRemove = Graph . Edges [ * EdgeIndex ] ;
2023-07-27 19:43:47 -04:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * Input = FindNodeInput ( EdgeToAdd . NewEdge . ToNodeID , EdgeToAdd . NewEdge . ToVertexID , & PageID ) ;
2023-07-27 19:43:47 -04:00
checkf ( Input , TEXT ( " Prior loop to check edge validity should protect against missing input vertex " ) ) ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * Output = FindNodeOutput ( EdgeToAdd . NewEdge . FromNodeID , EdgeToAdd . NewEdge . FromVertexID , & PageID ) ;
2023-07-27 19:43:47 -04:00
checkf ( Input , TEXT ( " Prior loop to check edge validity should protect against missing output vertex " ) ) ;
UE_LOG ( LogMetaSound , Warning , TEXT ( " Connection between MetaSound output '%s' and input '%s' not added: Input already connected to '%s'. " ) , * Output - > Name . ToString ( ) , * Input - > Name . ToString ( ) , * Output - > Name . ToString ( ) ) ;
# endif // !NO_LOGGING
2023-03-07 17:01:52 -05:00
}
}
2023-06-26 15:42:30 -04:00
if ( OutNewEdges )
{
for ( int32 Index = LastIndex + 1 ; Index < Edges . Num ( ) ; + + Index )
{
OutNewEdges - > Add ( & Edges [ Index ] ) ;
}
}
2023-03-07 17:01:52 -05:00
return bSuccess ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : AddEdgesByNodeClassInterfaceBindings ( const FGuid & InFromNodeID , const FGuid & InToNodeID , bool bReplaceExistingConnections , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-10-19 17:47:21 -04:00
TSet < FMetasoundFrontendVersion > FromInterfaceVersions ;
TSet < FMetasoundFrontendVersion > ToInterfaceVersions ;
2024-06-18 16:47:21 -04:00
if ( FindNodeClassInterfaces ( InFromNodeID , FromInterfaceVersions , PageID ) & & FindNodeClassInterfaces ( InToNodeID , ToInterfaceVersions , PageID ) )
2023-03-07 17:01:52 -05:00
{
2023-03-13 17:23:05 -04:00
TSet < FNamedEdge > NamedEdges ;
2023-10-19 17:47:21 -04:00
if ( DocumentBuilderPrivate : : TryGetInterfaceBoundEdges ( InFromNodeID , FromInterfaceVersions , InToNodeID , ToInterfaceVersions , NamedEdges ) )
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
return AddNamedEdges ( NamedEdges , nullptr , bReplaceExistingConnections , & PageID ) ;
2023-03-07 17:01:52 -05:00
}
}
2023-03-13 17:23:05 -04:00
return false ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : AddEdgesFromMatchingInterfaceNodeOutputsToGraphOutputs ( const FGuid & InNodeID , TArray < const FMetasoundFrontendEdge * > & OutEdgesCreated , bool bReplaceExistingConnections , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
METASOUND_TRACE_CPUPROFILER_EVENT_SCOPE ( FMetaSoundFrontendDocumentBuilder : : AddEdgesFromMatchingInterfaceNodeOutputsToGraphOutputs ) ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-03-07 17:01:52 -05:00
OutEdgesCreated . Reset ( ) ;
2023-10-19 17:47:21 -04:00
TSet < FMetasoundFrontendVersion > NodeInterfaces ;
2024-06-18 16:47:21 -04:00
if ( ! FindNodeClassInterfaces ( InNodeID , NodeInterfaces , PageID ) )
2023-03-07 17:01:52 -05:00
{
2023-10-19 17:47:21 -04:00
// Did not find any node interfaces
2023-03-07 17:01:52 -05:00
return false ;
}
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
const IDocumentGraphInterfaceCache & InterfaceCache = DocumentCache - > GetInterfaceCache ( ) ;
2024-05-29 15:33:29 -04:00
const TSet < FMetasoundFrontendVersion > CommonInterfaces = NodeInterfaces . Intersect ( GetDocumentChecked ( ) . Interfaces ) ;
2023-03-07 17:01:52 -05:00
2023-03-13 17:23:05 -04:00
TSet < FNamedEdge > EdgesToMake ;
2023-03-07 17:01:52 -05:00
for ( const FMetasoundFrontendVersion & Version : CommonInterfaces )
{
const FInterfaceRegistryKey InterfaceKey = GetInterfaceRegistryKey ( Version ) ;
if ( const IInterfaceRegistryEntry * RegistryEntry = IInterfaceRegistry : : Get ( ) . FindInterfaceRegistryEntry ( InterfaceKey ) )
{
2023-06-16 17:48:20 -04:00
Algo : : Transform ( RegistryEntry - > GetInterface ( ) . Outputs , EdgesToMake , [ this , & NodeCache , & InterfaceCache , InNodeID ] ( const FMetasoundFrontendClassOutput & Output )
2023-03-07 17:01:52 -05:00
{
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendGraph & Graph = FindConstBuildGraphChecked ( ) ;
2023-03-07 17:01:52 -05:00
const FMetasoundFrontendVertex * NodeVertex = NodeCache . FindOutputVertex ( InNodeID , Output . Name ) ;
check ( NodeVertex ) ;
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClassOutput * OutputClass = InterfaceCache . FindOutput ( Output . Name ) ;
check ( OutputClass ) ;
const FMetasoundFrontendNode * OutputNode = NodeCache . FindNode ( OutputClass - > NodeID ) ;
2023-03-07 17:01:52 -05:00
check ( OutputNode ) ;
const TArray < FMetasoundFrontendVertex > & Inputs = OutputNode - > Interface . Inputs ;
check ( ! Inputs . IsEmpty ( ) ) ;
return FNamedEdge { InNodeID , NodeVertex - > Name , OutputNode - > GetID ( ) , Inputs . Last ( ) . Name } ;
} ) ;
}
}
2024-06-18 16:47:21 -04:00
return AddNamedEdges ( EdgesToMake , & OutEdgesCreated , bReplaceExistingConnections , & PageID ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : AddEdgesFromMatchingInterfaceNodeInputsToGraphInputs ( const FGuid & InNodeID , TArray < const FMetasoundFrontendEdge * > & OutEdgesCreated , bool bReplaceExistingConnections , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
METASOUND_TRACE_CPUPROFILER_EVENT_SCOPE ( FMetaSoundFrontendDocumentBuilder : : AddEdgesFromMatchingInterfaceNodeInputsToGraphInputs ) ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-03-07 17:01:52 -05:00
OutEdgesCreated . Reset ( ) ;
2023-10-19 17:47:21 -04:00
TSet < FMetasoundFrontendVersion > NodeInterfaces ;
2024-06-18 16:47:21 -04:00
if ( ! FindNodeClassInterfaces ( InNodeID , NodeInterfaces , PageID ) )
2023-03-07 17:01:52 -05:00
{
2023-10-19 17:47:21 -04:00
// Did not find any node interfaces
2023-03-07 17:01:52 -05:00
return false ;
}
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
const IDocumentGraphInterfaceCache & InterfaceCache = DocumentCache - > GetInterfaceCache ( ) ;
2024-05-29 15:33:29 -04:00
const TSet < FMetasoundFrontendVersion > CommonInterfaces = NodeInterfaces . Intersect ( GetDocumentChecked ( ) . Interfaces ) ;
2023-03-07 17:01:52 -05:00
2023-03-13 17:23:05 -04:00
TSet < FNamedEdge > EdgesToMake ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindConstGraphChecked ( PageID ) ;
2023-03-07 17:01:52 -05:00
for ( const FMetasoundFrontendVersion & Version : CommonInterfaces )
{
const FInterfaceRegistryKey InterfaceKey = GetInterfaceRegistryKey ( Version ) ;
if ( const IInterfaceRegistryEntry * RegistryEntry = IInterfaceRegistry : : Get ( ) . FindInterfaceRegistryEntry ( InterfaceKey ) )
{
2024-06-18 16:47:21 -04:00
Algo : : Transform ( RegistryEntry - > GetInterface ( ) . Inputs , EdgesToMake , [ this , & Graph , & NodeCache , & InterfaceCache , InNodeID ] ( const FMetasoundFrontendClassInput & Input )
2023-03-07 17:01:52 -05:00
{
2023-06-26 15:42:30 -04:00
const FMetasoundFrontendVertex * NodeVertex = NodeCache . FindInputVertex ( InNodeID , Input . Name ) ;
2023-03-07 17:01:52 -05:00
check ( NodeVertex ) ;
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClassInput * InputClass = InterfaceCache . FindInput ( Input . Name ) ;
check ( InputClass ) ;
const FMetasoundFrontendNode * InputNode = NodeCache . FindNode ( InputClass - > NodeID ) ;
2023-03-07 17:01:52 -05:00
check ( InputNode ) ;
const TArray < FMetasoundFrontendVertex > & Outputs = InputNode - > Interface . Outputs ;
check ( ! Outputs . IsEmpty ( ) ) ;
2023-06-26 15:42:30 -04:00
return FNamedEdge { InputNode - > GetID ( ) , Outputs . Last ( ) . Name , InNodeID , NodeVertex - > Name } ;
2023-03-07 17:01:52 -05:00
} ) ;
}
}
2024-06-18 16:47:21 -04:00
return AddNamedEdges ( EdgesToMake , & OutEdgesCreated , bReplaceExistingConnections , & PageID ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : AddGraphInput ( const FMetasoundFrontendClassInput & InClassInput , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
checkf ( InClassInput . NodeID . IsValid ( ) , TEXT ( " Unassigned NodeID when adding graph input " ) ) ;
checkf ( InClassInput . VertexID . IsValid ( ) , TEXT ( " Unassigned VertexID when adding graph input " ) ) ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-03-07 17:01:52 -05:00
if ( InClassInput . TypeName . IsNone ( ) )
{
UE_LOG ( LogMetaSound , Error , TEXT ( " TypeName unset when attempting to add class input '%s' " ) , * InClassInput . Name . ToString ( ) ) ;
return nullptr ;
}
2023-06-16 17:48:20 -04:00
else if ( const FMetasoundFrontendClassInput * Input = DocumentCache - > GetInterfaceCache ( ) . FindInput ( InClassInput . Name ) )
2023-03-07 17:01:52 -05:00
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Attempting to add MetaSound graph input '%s' when input with name already exists " ) , * InClassInput . Name . ToString ( ) ) ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * OutputNode = DocumentCache - > GetNodeCache ( PageID ) . FindNode ( Input - > NodeID ) ;
2023-06-16 17:48:20 -04:00
check ( OutputNode ) ;
return OutputNode ;
2023-03-07 17:01:52 -05:00
}
2023-08-11 19:55:12 -04:00
else if ( ! IDataTypeRegistry : : Get ( ) . IsRegistered ( InClassInput . TypeName ) )
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Cannot add MetaSound graph input '%s' with unregistered TypeName '%s' " ) , * InClassInput . Name . ToString ( ) , * InClassInput . TypeName . ToString ( ) ) ;
return nullptr ;
}
2023-03-07 17:01:52 -05:00
FMetasoundFrontendClass Class ;
- 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
if ( DocumentBuilderPrivate : : FindInputRegistryClass ( InClassInput . TypeName , InClassInput . AccessType , Class ) )
2023-03-07 17:01:52 -05:00
{
if ( ! FindDependency ( Class . Metadata ) )
{
2023-06-16 17:48:20 -04:00
AddDependency ( Class ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
- 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
auto FinalizeNode = [ this , & InClassInput ] ( FMetasoundFrontendNode & InOutNode , const Metasound : : Frontend : : FNodeRegistryKey & )
2023-03-07 17:01:52 -05:00
{
2023-09-15 11:47:57 -04:00
// Sets the name of the node an vertices on the node to match the class vertex name
DocumentBuilderPrivate : : SetNodeAndVertexNames ( InOutNode , InClassInput ) ;
// Set the default literal on the nodes inputs so that it gets passed to the instantiated TInputNode on a live
// auditioned MetaSound.
DocumentBuilderPrivate : : SetDefaultLiteralOnInputNode ( InOutNode , InClassInput ) ;
2023-03-07 17:01:52 -05:00
} ;
2024-05-29 15:33:29 -04:00
2024-10-01 20:11:53 -04:00
# if WITH_EDITORONLY_DATA
bool bIsRequired = false ;
FMetasoundFrontendInterface Interface ;
if ( DocumentBuilderPrivate : : IsInterfaceInput ( InClassInput . Name , InClassInput . TypeName , & Interface ) )
{
FText RequiredText ;
bIsRequired = Interface . IsMemberInputRequired ( InClassInput . Name , RequiredText ) ;
}
# endif // WITH_EDITORONLY_DATA
2024-05-29 15:33:29 -04:00
// Must add input node to all paged graphs to maintain API parity for all page implementations
FMetasoundFrontendNode * NewNode = nullptr ;
2024-06-18 16:47:21 -04:00
RootGraph . IterateGraphPages ( [ & ] ( const FMetasoundFrontendGraph & Graph )
2023-03-07 17:01:52 -05:00
{
2024-05-29 15:33:29 -04:00
constexpr int32 * NewNodeIndex = nullptr ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendNode * NewPageNode = AddNodeInternal ( Class . Metadata , FinalizeNode , Graph . PageID , InClassInput . NodeID , NewNodeIndex ) ;
if ( Graph . PageID = = PageID )
2024-05-29 15:33:29 -04:00
{
NewNode = NewPageNode ;
}
2024-10-01 20:11:53 -04:00
# if WITH_EDITORONLY_DATA
if ( bIsRequired )
{
// LocationGuid corresponds with the assigned editor graph node guid when dynamically created.
// This is added if this is an interface member that is required to force page to create visual
// representation that can inform the user of its required state.
FGuid LocationGuid = FDocumentIDGenerator : : Get ( ) . CreateVertexID ( Document ) ;
2024-10-01 20:13:09 -04:00
SetNodeLocation ( InClassInput . NodeID , FVector2D : : ZeroVector , & LocationGuid , & Graph . PageID ) ;
2024-10-01 20:11:53 -04:00
}
# endif // WITH_EDITORONLY_DATA
2023-09-15 11:47:57 -04:00
// Remove the default literal on the node added during the "FinalizeNode" call. This matches how
// nodes are serialized in editor. The default literals are only stored on the FMetasoundFrontendClassInputs.
2024-05-29 15:33:29 -04:00
NewPageNode - > InputLiterals . Reset ( ) ;
} ) ;
2023-09-15 11:47:57 -04:00
2024-05-29 15:33:29 -04:00
if ( NewNode )
{
2023-06-16 17:48:20 -04:00
const int32 NewIndex = RootGraph . Interface . Inputs . Num ( ) ;
2023-03-07 17:01:52 -05:00
FMetasoundFrontendClassInput & NewInput = RootGraph . Interface . Inputs . Add_GetRef ( InClassInput ) ;
if ( ! NewInput . VertexID . IsValid ( ) )
{
2023-09-05 17:54:02 -04:00
NewInput . VertexID = FDocumentIDGenerator : : Get ( ) . CreateVertexID ( Document ) ;
2023-03-07 17:01:52 -05:00
}
2023-05-10 20:28:39 -04:00
2023-06-16 17:48:20 -04:00
DocumentDelegates - > InterfaceDelegates . OnInputAdded . Broadcast ( NewIndex ) ;
2023-05-10 20:28:39 -04:00
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddMemberIDModified ( InClassInput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
2023-03-07 17:01:52 -05:00
return NewNode ;
}
}
return nullptr ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : AddGraphOutput ( const FMetasoundFrontendClassOutput & InClassOutput , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
checkf ( InClassOutput . NodeID . IsValid ( ) , TEXT ( " Unassigned NodeID when adding graph output " ) ) ;
checkf ( InClassOutput . VertexID . IsValid ( ) , TEXT ( " Unassigned VertexID when adding graph output " ) ) ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-03-07 17:01:52 -05:00
if ( InClassOutput . TypeName . IsNone ( ) )
{
UE_LOG ( LogMetaSound , Error , TEXT ( " TypeName unset when attempting to add class output '%s' " ) , * InClassOutput . Name . ToString ( ) ) ;
return nullptr ;
}
2023-08-02 14:39:50 -04:00
else if ( const FMetasoundFrontendClassOutput * Output = DocumentCache - > GetInterfaceCache ( ) . FindOutput ( InClassOutput . Name ) )
2023-03-07 17:01:52 -05:00
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Attempting to add MetaSound graph output '%s' when output with name already exists " ) , * InClassOutput . Name . ToString ( ) ) ;
2024-06-18 16:47:21 -04:00
return DocumentCache - > GetNodeCache ( PageID ) . FindNode ( Output - > NodeID ) ;
2023-03-07 17:01:52 -05:00
}
2023-08-11 19:55:12 -04:00
else if ( ! IDataTypeRegistry : : Get ( ) . IsRegistered ( InClassOutput . TypeName ) )
{
UE_LOG ( LogMetaSound , Error , TEXT ( " Cannot add MetaSound graph output '%s' with unregistered TypeName '%s' " ) , * InClassOutput . Name . ToString ( ) , * InClassOutput . TypeName . ToString ( ) ) ;
return nullptr ;
}
2023-03-07 17:01:52 -05:00
FMetasoundFrontendClass Class ;
- 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
if ( DocumentBuilderPrivate : : FindOutputRegistryClass ( InClassOutput . TypeName , InClassOutput . AccessType , Class ) )
2023-03-07 17:01:52 -05:00
{
if ( ! FindDependency ( Class . Metadata ) )
{
2023-06-16 17:48:20 -04:00
AddDependency ( Class ) ;
2023-03-07 17:01:52 -05:00
}
auto FinalizeNode = [ & InClassOutput ] ( FMetasoundFrontendNode & InOutNode , const Metasound : : Frontend : : FNodeRegistryKey & )
{
2023-09-15 11:47:57 -04:00
DocumentBuilderPrivate : : SetNodeAndVertexNames ( InOutNode , InClassOutput ) ;
2023-03-07 17:01:52 -05:00
} ;
2024-06-18 16:47:21 -04:00
2024-10-01 20:11:53 -04:00
# if WITH_EDITORONLY_DATA
bool bIsRequired = false ;
FMetasoundFrontendInterface Interface ;
if ( DocumentBuilderPrivate : : IsInterfaceOutput ( InClassOutput . Name , InClassOutput . TypeName , & Interface ) )
{
FText RequiredText ;
bIsRequired = Interface . IsMemberOutputRequired ( InClassOutput . Name , RequiredText ) ;
}
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bool bAddedNodes = true ;
FMetasoundFrontendNode * NewNodeToReturn = nullptr ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
{
FMetasoundFrontendNode * NewNode = AddNodeInternal ( Class . Metadata , FinalizeNode , Graph . PageID , InClassOutput . NodeID ) ;
if ( Graph . PageID = = PageID )
{
NewNodeToReturn = NewNode ;
}
2024-10-01 20:11:53 -04:00
# if WITH_EDITORONLY_DATA
if ( bIsRequired )
{
// LocationGuid corresponds with the assigned editor graph node guid when dynamically created.
// This is added if this is an interface member that is required to force page to create visual
// representation that can inform the user of its required state.
FGuid LocationGuid = FDocumentIDGenerator : : Get ( ) . CreateVertexID ( Document ) ;
2024-10-01 20:13:09 -04:00
SetNodeLocation ( InClassOutput . NodeID , FVector2D : : ZeroVector , & LocationGuid , & Graph . PageID ) ;
2024-10-01 20:11:53 -04:00
}
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bAddedNodes & = NewNode ! = nullptr ;
} ) ;
if ( bAddedNodes )
2023-03-07 17:01:52 -05:00
{
2023-06-16 17:48:20 -04:00
const int32 NewIndex = RootGraph . Interface . Outputs . Num ( ) ;
2023-03-07 17:01:52 -05:00
FMetasoundFrontendClassOutput & NewOutput = RootGraph . Interface . Outputs . Add_GetRef ( InClassOutput ) ;
if ( ! NewOutput . VertexID . IsValid ( ) )
{
- 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
NewOutput . VertexID = FDocumentIDGenerator : : Get ( ) . CreateVertexID ( Document ) ;
2023-03-07 17:01:52 -05:00
}
2023-05-10 20:28:39 -04:00
2023-06-16 17:48:20 -04:00
DocumentDelegates - > InterfaceDelegates . OnOutputAdded . Broadcast ( NewIndex ) ;
2023-05-10 20:28:39 -04:00
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddMemberIDModified ( InClassOutput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
check ( NewNodeToReturn ) ;
return NewNodeToReturn ;
2023-03-07 17:01:52 -05:00
}
return nullptr ;
}
bool FMetaSoundFrontendDocumentBuilder : : AddInterface ( FName InterfaceName )
{
using namespace Metasound : : Frontend ;
FMetasoundFrontendInterface Interface ;
if ( ISearchEngine : : Get ( ) . FindInterfaceWithHighestVersion ( InterfaceName , Interface ) )
{
2024-05-29 15:33:29 -04:00
if ( GetDocumentChecked ( ) . Interfaces . Contains ( Interface . Version ) )
2023-03-07 17:01:52 -05:00
{
2023-04-04 19:14:26 -04:00
UE_LOG ( LogMetaSound , VeryVerbose , TEXT ( " MetaSound interface '%s' already found on document. MetaSoundBuilder skipping add request. " ) , * InterfaceName . ToString ( ) ) ;
2023-03-07 17:01:52 -05:00
return true ;
}
2023-05-10 20:28:39 -04:00
const FTopLevelAssetPath BuilderClassPath = GetBuilderClassPath ( ) ;
2023-04-04 19:14:26 -04:00
const FInterfaceRegistryKey Key = GetInterfaceRegistryKey ( Interface . Version ) ;
if ( const IInterfaceRegistryEntry * Entry = IInterfaceRegistry : : Get ( ) . FindInterfaceRegistryEntry ( Key ) )
{
2023-04-06 16:32:00 -04:00
const FMetasoundFrontendInterfaceUClassOptions * ClassOptions = Entry - > GetInterface ( ) . FindClassOptions ( BuilderClassPath ) ;
2023-04-04 19:14:26 -04:00
if ( ClassOptions & & ! ClassOptions - > bIsModifiable )
{
2023-04-06 16:32:00 -04:00
UE_LOG ( LogMetaSound , Error , TEXT ( " DocumentBuilder failed to add MetaSound Interface '%s' to document: is not set to be modifiable for given UClass '%s' " ) , * InterfaceName . ToString ( ) , * BuilderClassPath . ToString ( ) ) ;
2023-04-04 19:14:26 -04:00
return false ;
}
2023-06-16 17:48:20 -04:00
TArray < FMetasoundFrontendInterface > InterfacesToAdd ;
InterfacesToAdd . Add ( Entry - > GetInterface ( ) ) ;
FModifyInterfaceOptions Options ( { } , MoveTemp ( InterfacesToAdd ) ) ;
2023-07-18 15:24:34 -04:00
return ModifyInterfaces ( MoveTemp ( Options ) ) ;
2023-03-07 17:01:52 -05:00
}
}
return false ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : AddGraphNode ( const FMetasoundFrontendGraphClass & InGraphClass , FGuid InNodeID , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
2023-10-12 16:37:45 -04:00
auto FinalizeNode = [ ] ( FMetasoundFrontendNode & InOutNode , const Metasound : : Frontend : : FNodeRegistryKey & ClassKey )
2023-03-07 17:01:52 -05:00
{
# if WITH_EDITOR
using namespace Metasound : : Frontend ;
// Cache the asset name on the node if it node is reference to asset-defined graph.
2024-09-10 10:26:02 -04:00
const FTopLevelAssetPath Path = IMetaSoundAssetManager : : GetChecked ( ) . FindAssetPath ( FAssetKey ( ClassKey . ClassName , ClassKey . Version ) ) ;
if ( Path . IsValid ( ) )
2023-03-07 17:01:52 -05:00
{
2024-09-10 10:26:02 -04:00
InOutNode . Name = Path . GetAssetName ( ) ;
2024-05-08 14:53:53 -04:00
return ;
2023-03-07 17:01:52 -05:00
}
2023-10-12 16:37:45 -04:00
InOutNode . Name = ClassKey . ClassName . GetFullName ( ) ;
2023-03-07 17:01:52 -05:00
# endif // WITH_EDITOR
} ;
// Dependency is considered "External" when looked up or added on another graph
FMetasoundFrontendClassMetadata NewClassMetadata = InGraphClass . Metadata ;
NewClassMetadata . SetType ( EMetasoundFrontendClassType : : External ) ;
if ( ! FindDependency ( NewClassMetadata ) )
{
2023-06-16 17:48:20 -04:00
AddDependency ( InGraphClass ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
constexpr int32 * NewNodeIndex = nullptr ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
return AddNodeInternal ( NewClassMetadata , FinalizeNode , PageID , InNodeID , NewNodeIndex ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : AddNodeByClassName ( const FMetasoundFrontendClassName & InClassName , int32 InMajorVersion , FGuid InNodeID , const FGuid * InPageID )
2023-06-16 17:48:20 -04:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
FMetasoundFrontendClass RegisteredClass ;
if ( ISearchEngine : : Get ( ) . FindClassWithHighestMinorVersion ( InClassName , InMajorVersion , RegisteredClass ) )
{
2023-06-22 14:51:42 -04:00
const EMetasoundFrontendClassType ClassType = RegisteredClass . Metadata . GetType ( ) ;
if ( ClassType ! = EMetasoundFrontendClassType : : External & & ClassType ! = EMetasoundFrontendClassType : : Graph )
{
UE_LOG ( LogMetaSound , Warning , TEXT ( " Failed to add new node by class name '%s': Class is restricted type '%s' that cannot be added via this function. " ) ,
* InClassName . ToString ( ) ,
LexToString ( ClassType ) ) ;
return nullptr ;
}
2023-06-16 17:48:20 -04:00
// Dependency is considered "External" when looked up or added as a dependency to a graph
RegisteredClass . Metadata . SetType ( EMetasoundFrontendClassType : : External ) ;
const FMetasoundFrontendClass * Dependency = FindDependency ( RegisteredClass . Metadata ) ;
if ( ! Dependency )
{
Dependency = AddDependency ( RegisteredClass ) ;
}
if ( Dependency )
{
2024-06-18 16:47:21 -04:00
auto FinalizeNode = [ ] ( const FMetasoundFrontendNode & Node , const Metasound : : Frontend : : FNodeRegistryKey & ClassKey ) { return Node . Name ; } ;
constexpr int32 * NewNodeIndex = nullptr ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
return AddNodeInternal ( Dependency - > Metadata , FinalizeNode , PageID , InNodeID , NewNodeIndex ) ;
2023-06-16 17:48:20 -04:00
}
}
2023-09-01 13:19:23 -04:00
UE_LOG ( LogMetaSound , Warning , TEXT ( " Failed to add new node by class name '%s' and major version '%d': Class not found " ) , * InClassName . ToString ( ) , InMajorVersion ) ;
2023-06-16 17:48:20 -04:00
return nullptr ;
}
2024-08-02 16:25:37 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : AddNodeByTemplate ( const Metasound : : Frontend : : INodeTemplate & InTemplate , FNodeTemplateGenerateInterfaceParams Params , FGuid InNodeID , const FGuid * InPageID )
- 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
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
const FMetasoundFrontendClass & TemplateClass = InTemplate . GetFrontendClass ( ) ;
checkf ( TemplateClass . Metadata . GetType ( ) = = EMetasoundFrontendClassType : : Template , TEXT ( " INodeTemplate ClassType must always be 'Template' " ) ) ;
const FMetasoundFrontendClass * Dependency = FindDependency ( TemplateClass . Metadata ) ;
if ( ! Dependency )
{
Dependency = AddDependency ( TemplateClass ) ;
}
check ( Dependency ) ;
auto FinalizeNodeFunction = [ ] ( const FMetasoundFrontendNode & Node , const Metasound : : Frontend : : FNodeRegistryKey & ClassKey )
{
return Node . Name ;
} ;
2024-06-18 16:47:21 -04:00
constexpr int32 * NewNodeIndex = nullptr ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendNode * NewNode = AddNodeInternal ( Dependency - > Metadata , FinalizeNodeFunction , PageID , InNodeID , NewNodeIndex ) ;
- 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
check ( NewNode ) ;
NewNode - > Interface = InTemplate . GenerateNodeInterface ( MoveTemp ( Params ) ) ;
return NewNode ;
}
2024-06-18 16:47:21 -04:00
FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : AddNodeInternal ( const FMetasoundFrontendClassMetadata & InClassMetadata , FFinalizeNodeFunctionRef FinalizeNode , const FGuid & InPageID , FGuid InNodeID , int32 * NewNodeIndex )
2023-03-07 17:01:52 -05:00
{
METASOUND_TRACE_CPUPROFILER_EVENT_SCOPE ( FMetaSoundFrontendDocumentBuilder : : AddNodeInternal ) ;
using namespace Metasound : : Frontend ;
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey ClassKey = FNodeRegistryKey ( InClassMetadata ) ;
2023-03-07 17:01:52 -05:00
if ( const FMetasoundFrontendClass * Dependency = DocumentCache - > FindDependency ( ClassKey ) )
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( InPageID ) ;
2023-03-07 17:01:52 -05:00
TArray < FMetasoundFrontendNode > & Nodes = Graph . Nodes ;
FMetasoundFrontendNode & Node = Nodes . Emplace_GetRef ( * Dependency ) ;
Node . UpdateID ( InNodeID ) ;
FinalizeNode ( Node , ClassKey ) ;
2024-06-18 16:47:21 -04:00
const int32 NewIndex = Nodes . Num ( ) - 1 ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( InPageID ) ;
DocumentDelegates - > FindNodeDelegatesChecked ( InPageID ) . OnNodeAdded . Broadcast ( NewIndex ) ;
2024-05-29 15:33:29 -04:00
2024-06-18 16:47:21 -04:00
if ( NewNodeIndex )
{
* NewNodeIndex = NewIndex ;
}
- 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
2023-05-10 20:28:39 -04:00
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
Document . Metadata . ModifyContext . AddNodeIDModified ( InNodeID ) ;
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
2023-03-07 17:01:52 -05:00
return & Node ;
}
return nullptr ;
}
2024-07-15 13:25:53 -04:00
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & FMetaSoundFrontendDocumentBuilder : : AddGraphPage ( const FGuid & InPageID , bool bDuplicateLastGraph , bool bSetAsBuildGraph )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & ToReturn = GetDocumentChecked ( ) . RootGraph . AddGraphPage ( InPageID , bDuplicateLastGraph ) ;
DocumentDelegates - > AddPageDelegates ( InPageID ) ;
if ( bSetAsBuildGraph )
{
SetBuildPageID ( InPageID ) ;
}
return ToReturn ;
}
2024-07-15 13:25:53 -04:00
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : CanAddEdge ( const FMetasoundFrontendEdge & InEdge , const FGuid * InPageID ) const
{
using namespace Metasound : : Frontend ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-03-07 17:01:52 -05:00
if ( ! EdgeCache . IsNodeInputConnected ( InEdge . ToNodeID , InEdge . ToVertexID ) )
{
2024-06-18 16:47:21 -04:00
return IsValidEdge ( InEdge , InPageID ) = = EInvalidEdgeReason : : None ;
2023-03-07 17:01:52 -05:00
}
return false ;
}
2024-05-29 15:33:29 -04:00
void FMetaSoundFrontendDocumentBuilder : : ClearDocument ( TSharedRef < Metasound : : Frontend : : FDocumentModifyDelegates > ModifyDelegates )
2023-05-10 20:28:39 -04:00
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Doc = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & GraphClass = Doc . RootGraph ;
2024-06-27 14:21:49 -04:00
GraphClass . Interface . Inputs . Empty ( ) ;
GraphClass . Interface . Outputs . Empty ( ) ;
# if WITH_EDITOR
GraphClass . Interface . SetInputStyle ( { } ) ;
GraphClass . Interface . SetOutputStyle ( { } ) ;
# endif // WITH_EDITOR
2024-08-19 17:06:23 -04:00
GraphClass . PresetOptions . InputsInheritingDefault . Empty ( ) ;
2024-05-29 15:33:29 -04:00
GraphClass . PresetOptions . bIsPreset = false ;
2024-07-15 13:25:53 -04:00
// Removing graph pages is not necessary when editor only data is not available as graph mutation
// is only supported in builds with editor data loaded. Otherwise, anything calling ClearDocument
// should only be a transient, non serialized asset graph which does not support page mutation.
# if WITH_EDITORONLY_DATA
2024-08-19 17:06:23 -04:00
constexpr bool bClearDefaultGraph = true ;
ResetGraphPages ( bClearDefaultGraph ) ;
2024-07-15 13:25:53 -04:00
# else // !WITH_EDITORONLY_DATA
UObject & DocObject = CastDocumentObjectChecked < UObject > ( ) ;
checkf ( ! DocObject . IsAsset ( ) , TEXT ( " Cannot call clear document on asset '%s': builder API does not support document mutation on serialized objects without editor data loaded " ) , * GetDebugName ( ) ) ;
2024-08-19 17:06:23 -04:00
GraphClass . IterateGraphPages ( [ ] ( FMetasoundFrontendGraph & Graph )
{
Graph . Nodes . Empty ( ) ;
Graph . Edges . Empty ( ) ;
Graph . Variables . Empty ( ) ;
} ) ;
2024-07-15 13:25:53 -04:00
# endif // !WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
2024-08-19 17:06:23 -04:00
GraphClass . Interface . Inputs . Empty ( ) ;
GraphClass . Interface . Outputs . Empty ( ) ;
GraphClass . Interface . Environment . Empty ( ) ;
2024-05-29 15:33:29 -04:00
2024-06-27 14:21:49 -04:00
Doc . Interfaces . Empty ( ) ;
Doc . Dependencies . Empty ( ) ;
# if WITH_EDITORONLY_DATA
Doc . Metadata . MemberMetadata . Empty ( ) ;
# endif // WITH_EDITORONLY_DATA
- 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
Reload ( ModifyDelegates ) ;
}
# if WITH_EDITORONLY_DATA
bool FMetaSoundFrontendDocumentBuilder : : ClearMemberMetadata ( const FGuid & InMemberID )
{
2024-05-29 15:33:29 -04:00
return GetDocumentChecked ( ) . Metadata . MemberMetadata . Remove ( InMemberID ) > 0 ;
- 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
}
# endif // WITH_EDITORONLY_DATA
bool FMetaSoundFrontendDocumentBuilder : : ConformGraphInputNodeToClass ( const FMetasoundFrontendClassInput & GraphInput )
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendClass Class ;
const bool bClassFound = DocumentBuilderPrivate : : FindInputRegistryClass ( GraphInput . TypeName , GraphInput . AccessType , Class ) ;
if ( ensureAlways ( bClassFound ) )
- 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
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
const FMetasoundFrontendClass * Dependency = FindDependency ( Class . Metadata ) ;
if ( ! Dependency )
- 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
{
2024-06-18 16:47:21 -04:00
Dependency = AddDependency ( Class ) ;
}
- 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
2024-06-18 16:47:21 -04:00
if ( ensureAlways ( Dependency ) )
{
Document . RootGraph . IterateGraphPages ( [ this , & Document , & Dependency , & GraphInput ] ( FMetasoundFrontendGraph & Graph )
- 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
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
if ( const int32 * NodeIndexPtr = NodeCache . FindNodeIndex ( GraphInput . NodeID ) )
{
TArray < FMetasoundFrontendNode > & Nodes = Graph . Nodes ;
FMetasoundFrontendNode & Node = Nodes [ * NodeIndexPtr ] ;
FNodeModifyDelegates & NodeDelegates = DocumentDelegates - > FindNodeDelegatesChecked ( Graph . PageID ) ;
const int32 RemovalIndex = * NodeIndexPtr ; // Have to cache as next delegate broadcast invalidates index pointer
NodeDelegates . OnRemoveSwappingNode . Broadcast ( RemovalIndex , Nodes . Num ( ) - 1 ) ;
FMetasoundFrontendNode NewNode = MoveTemp ( Node ) ;
Nodes . RemoveAtSwap ( RemovalIndex , EAllowShrinking : : No ) ;
NewNode . ClassID = Dependency - > ID ;
NewNode . Interface . Inputs . Last ( ) . TypeName = GraphInput . TypeName ;
NewNode . Interface . Outputs . Last ( ) . TypeName = GraphInput . TypeName ;
- 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
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
Document . Metadata . ModifyContext . AddNodeIDModified ( NewNode . GetID ( ) ) ;
- 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
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
// Set the default literal on the nodes inputs so that it gets passed to the instantiated TInputNode on a live
// auditioned MetaSound.
DocumentBuilderPrivate : : SetDefaultLiteralOnInputNode ( NewNode , GraphInput ) ;
- 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
2024-06-18 16:47:21 -04:00
FMetasoundFrontendNode & NewNodeRef = Nodes . Add_GetRef ( MoveTemp ( NewNode ) ) ;
NodeDelegates . OnNodeAdded . Broadcast ( Nodes . Num ( ) - 1 ) ;
- 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
2024-06-18 16:47:21 -04:00
// Remove the default literal on the node added during the "FinalizeNode" call. This matches how
// nodes are serialized in editor. The default literals are only stored on the FMetasoundFrontendClassInputs.
NewNodeRef . InputLiterals . Reset ( ) ;
}
} ) ;
- 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
2024-06-18 16:47:21 -04:00
RemoveUnusedDependencies ( ) ;
return true ;
- 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
}
}
return false ;
}
bool FMetaSoundFrontendDocumentBuilder : : ConformGraphOutputNodeToClass ( const FMetasoundFrontendClassOutput & GraphOutput )
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendClass Class ;
const bool bClassFound = DocumentBuilderPrivate : : FindOutputRegistryClass ( GraphOutput . TypeName , GraphOutput . AccessType , Class ) ;
if ( ensureAlways ( bClassFound ) )
- 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
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
const FMetasoundFrontendClass * Dependency = FindDependency ( Class . Metadata ) ;
if ( ! Dependency )
- 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
{
2024-06-18 16:47:21 -04:00
Dependency = AddDependency ( Class ) ;
}
- 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
2024-06-18 16:47:21 -04:00
if ( ensureAlways ( Dependency ) )
{
Document . RootGraph . IterateGraphPages ( [ this , & Document , & Dependency , & GraphOutput ] ( FMetasoundFrontendGraph & Graph )
- 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
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
if ( const int32 * NodeIndexPtr = NodeCache . FindNodeIndex ( GraphOutput . NodeID ) )
{
TArray < FMetasoundFrontendNode > & Nodes = Graph . Nodes ;
FMetasoundFrontendNode & Node = Nodes [ * NodeIndexPtr ] ;
FNodeModifyDelegates & NodeDelegates = DocumentDelegates - > FindNodeDelegatesChecked ( Graph . PageID ) ;
const int32 RemovalIndex = * NodeIndexPtr ; // Have to cache as next delegate broadcast invalidates index pointer
NodeDelegates . OnRemoveSwappingNode . Broadcast ( RemovalIndex , Nodes . Num ( ) - 1 ) ;
FMetasoundFrontendNode NewNode = MoveTemp ( Node ) ;
Nodes . RemoveAtSwap ( RemovalIndex , EAllowShrinking : : No ) ;
NewNode . ClassID = Dependency - > ID ;
NewNode . Interface . Inputs . Last ( ) . TypeName = GraphOutput . TypeName ;
NewNode . Interface . Outputs . Last ( ) . TypeName = GraphOutput . TypeName ;
- 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
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
Document . Metadata . ModifyContext . AddNodeIDModified ( NewNode . GetID ( ) ) ;
- 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
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
Nodes . Add ( MoveTemp ( NewNode ) ) ;
NodeDelegates . OnNodeAdded . Broadcast ( Nodes . Num ( ) - 1 ) ;
}
} ) ;
- 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
2024-06-18 16:47:21 -04:00
RemoveUnusedDependencies ( ) ;
return true ;
- 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
}
}
return false ;
2023-05-30 14:39:48 -04:00
}
2023-09-13 20:11:49 -04:00
bool FMetaSoundFrontendDocumentBuilder : : ContainsDependencyOfType ( EMetasoundFrontendClassType ClassType ) const
{
return DocumentCache - > ContainsDependencyOfType ( ClassType ) ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : ContainsEdge ( const FMetasoundFrontendEdge & InEdge , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( InPageID ? * InPageID : BuildPageID ) ;
2023-03-07 17:01:52 -05:00
return EdgeCache . ContainsEdge ( InEdge ) ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : ContainsNode ( const FGuid & InNodeID , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( InPageID ? * InPageID : BuildPageID ) ;
2023-03-07 17:01:52 -05:00
return NodeCache . ContainsNode ( InNodeID ) ;
}
bool FMetaSoundFrontendDocumentBuilder : : ConvertFromPreset ( )
{
using namespace Metasound : : Frontend ;
2023-05-30 14:39:48 -04:00
if ( IsPreset ( ) )
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2023-05-30 14:39:48 -04:00
FMetasoundFrontendGraphClass & RootGraphClass = Document . RootGraph ;
FMetasoundFrontendGraphClassPresetOptions & PresetOptions = RootGraphClass . PresetOptions ;
PresetOptions . bIsPreset = false ;
2023-03-07 17:01:52 -05:00
# if WITH_EDITOR
2024-05-29 15:33:29 -04:00
FMetasoundFrontendGraphStyle & Style = FindBuildGraphChecked ( ) . Style ;
2023-05-30 14:39:48 -04:00
Style . bIsGraphEditable = true ;
2023-03-07 17:01:52 -05:00
# endif // WITH_EDITOR
2023-05-30 14:39:48 -04:00
return true ;
}
return 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
bool FMetaSoundFrontendDocumentBuilder : : ConvertToPreset ( const FMetasoundFrontendDocument & InReferencedDocument , TSharedRef < Metasound : : Frontend : : FDocumentModifyDelegates > ModifyDelegates )
2023-05-30 14:39:48 -04:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
ClearDocument ( ModifyDelegates ) ;
2023-05-30 14:39:48 -04:00
2024-05-29 15:33:29 -04:00
FMetasoundFrontendGraphClass & PresetAssetRootGraph = GetDocumentChecked ( ) . RootGraph ;
PresetAssetRootGraph . IterateGraphPages ( [ ] ( FMetasoundFrontendGraph & PresetAssetGraph )
{
2023-05-30 14:39:48 -04:00
# if WITH_EDITORONLY_DATA
2024-05-29 15:33:29 -04:00
PresetAssetGraph . Style . bIsGraphEditable = false ;
2023-05-30 14:39:48 -04:00
# endif // WITH_EDITORONLY_DATA
2024-05-29 15:33:29 -04:00
} ) ;
2023-05-30 14:39:48 -04:00
// Mark all inputs as inherited by default
{
2024-05-29 15:33:29 -04:00
PresetAssetRootGraph . PresetOptions . InputsInheritingDefault . Reset ( ) ;
- 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
auto GetInputName = [ ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name ; } ;
2024-05-29 15:33:29 -04:00
Algo : : Transform ( PresetAssetRootGraph . Interface . Inputs , PresetAssetRootGraph . PresetOptions . InputsInheritingDefault , GetInputName ) ;
- 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
PresetAssetRootGraph . PresetOptions . bIsPreset = true ;
}
2023-05-30 14:39:48 -04:00
2024-07-26 14:23:35 -04:00
// Apply root graph transform
2023-05-30 14:39:48 -04:00
FRebuildPresetRootGraph RebuildPresetRootGraph ( InReferencedDocument ) ;
2024-05-29 15:33:29 -04:00
if ( RebuildPresetRootGraph . Transform ( GetDocumentChecked ( ) ) )
2023-05-30 14:39:48 -04:00
{
- 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
DocumentInterface - > ConformObjectToDocument ( ) ;
// TL/DR: Have to reload and assign delegates here due to the rebuild preset transform still being implemented via controllers.
// Onces its reimplemented with the builder API, this can be removed.
//
// The invalidate cache call when accessing the mutable document handle from within the transform unfortunately doesn't reach this
// builder's cache indirectly as converting to preset can be called by transient builders that are not registered with the MetaSound
// builder subsystem.
Reload ( ModifyDelegates ) ;
2023-05-30 14:39:48 -04:00
return true ;
}
2024-01-30 18:13:20 -05:00
2023-05-30 14:39:48 -04:00
return false ;
2023-03-07 17:01:52 -05:00
}
2024-07-26 14:23:35 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : DuplicateGraphInput ( const FMetasoundFrontendClassInput & InClassInput , const FName InName , const FGuid * InPageID )
2024-06-18 16:47:21 -04:00
{
2024-07-26 14:23:35 -04:00
using namespace Metasound ;
2024-06-18 16:47:21 -04:00
2024-07-26 14:23:35 -04:00
Frontend : : FDocumentIDGenerator & IDGenerator = Frontend : : FDocumentIDGenerator : : Get ( ) ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendDocument & Doc = GetConstDocumentChecked ( ) ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendClassInput ClassInput = InClassInput ;
ClassInput . NodeID = IDGenerator . CreateNodeID ( Doc ) ;
ClassInput . VertexID = IDGenerator . CreateVertexID ( Doc ) ;
# if WITH_EDITORONLY_DATA
ClassInput . Metadata . SetDisplayName ( FText : : GetEmpty ( ) ) ;
# endif // WITH_EDITORONLY_DATA
ClassInput . Name = InName ;
return AddGraphInput ( ClassInput , & PageID ) ;
}
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : DuplicateGraphOutput ( const FMetasoundFrontendClassOutput & InClassOutput , const FName InName , const FGuid * InPageID )
{
using namespace Metasound : : Frontend ;
FDocumentIDGenerator & IDGenerator = FDocumentIDGenerator : : Get ( ) ;
const FMetasoundFrontendDocument & Doc = GetConstDocumentChecked ( ) ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendClassOutput ClassOutput = InClassOutput ;
ClassOutput . NodeID = IDGenerator . CreateNodeID ( Doc ) ;
ClassOutput . VertexID = IDGenerator . CreateVertexID ( Doc ) ;
# if WITH_EDITORONLY_DATA
ClassOutput . Metadata . SetDisplayName ( FText : : GetEmpty ( ) ) ;
# endif // WITH_EDITORONLY_DATA
ClassOutput . Name = InName ;
return AddGraphOutput ( ClassOutput , & PageID ) ;
}
2024-09-16 15:56:55 -04:00
FMetasoundFrontendGraph & FMetaSoundFrontendDocumentBuilder : : FindBuildGraphChecked ( ) const
2024-05-29 15:33:29 -04:00
{
return GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( BuildPageID ) ;
}
const FMetasoundFrontendGraph & FMetaSoundFrontendDocumentBuilder : : FindConstBuildGraphChecked ( ) const
{
return GetConstDocumentChecked ( ) . RootGraph . FindConstGraphChecked ( BuildPageID ) ;
}
2023-03-07 17:01:52 -05:00
bool FMetaSoundFrontendDocumentBuilder : : FindDeclaredInterfaces ( TArray < const Metasound : : Frontend : : IInterfaceRegistryEntry * > & OutInterfaces ) const
{
2024-05-29 15:33:29 -04:00
return FindDeclaredInterfaces ( GetConstDocumentChecked ( ) , OutInterfaces ) ;
2023-03-07 17:01:52 -05:00
}
bool FMetaSoundFrontendDocumentBuilder : : FindDeclaredInterfaces ( const FMetasoundFrontendDocument & InDocument , TArray < const Metasound : : Frontend : : IInterfaceRegistryEntry * > & OutInterfaces )
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
bool bInterfacesFound = true ;
Algo : : Transform ( InDocument . Interfaces , OutInterfaces , [ & bInterfacesFound ] ( const FMetasoundFrontendVersion & Version )
{
const FInterfaceRegistryKey InterfaceKey = GetInterfaceRegistryKey ( Version ) ;
const IInterfaceRegistryEntry * RegistryEntry = IInterfaceRegistry : : Get ( ) . FindInterfaceRegistryEntry ( InterfaceKey ) ;
if ( ! RegistryEntry )
{
bInterfacesFound = false ;
UE_LOG ( LogMetaSound , Warning , TEXT ( " No registered interface matching interface version on document [InterfaceVersion:%s] " ) , * Version . ToString ( ) ) ;
}
return RegistryEntry ;
} ) ;
return bInterfacesFound ;
}
const FMetasoundFrontendClass * FMetaSoundFrontendDocumentBuilder : : FindDependency ( const FGuid & InClassID ) const
{
return DocumentCache - > FindDependency ( InClassID ) ;
}
const FMetasoundFrontendClass * FMetaSoundFrontendDocumentBuilder : : FindDependency ( const FMetasoundFrontendClassMetadata & InMetadata ) const
{
using namespace Metasound : : Frontend ;
checkf ( InMetadata . GetType ( ) ! = EMetasoundFrontendClassType : : Graph ,
TEXT ( " Dependencies are never listed as 'Graph' types. Graphs are considered 'External' from the perspective of the parent document to allow for nativization. " ) ) ;
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey RegistryKey = FNodeRegistryKey ( InMetadata ) ;
2023-03-07 17:01:52 -05:00
return DocumentCache - > FindDependency ( RegistryKey ) ;
}
2024-06-18 16:47:21 -04:00
TArray < const FMetasoundFrontendEdge * > FMetaSoundFrontendDocumentBuilder : : FindEdges ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-09-05 17:54:02 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( InPageID ? * InPageID : BuildPageID ) ;
2023-09-05 17:54:02 -04:00
return EdgeCache . FindEdges ( InNodeID , InVertexID ) ;
}
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
const FMetasoundFrontendEdgeStyle * FMetaSoundFrontendDocumentBuilder : : FindConstEdgeStyle ( const FGuid & InNodeID , FName OutputName , const FGuid * InPageID ) const
{
auto IsEdgeStyle = [ & InNodeID , & OutputName ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle )
{
return EdgeStyle . NodeID = = InNodeID & & EdgeStyle . OutputName = = OutputName ;
} ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
const FMetasoundFrontendGraph & Graph = Document . RootGraph . FindConstGraphChecked ( PageID ) ;
return Graph . Style . EdgeStyles . FindByPredicate ( IsEdgeStyle ) ;
}
FMetasoundFrontendEdgeStyle * FMetaSoundFrontendDocumentBuilder : : FindEdgeStyle ( const FGuid & InNodeID , FName OutputName , const FGuid * InPageID )
{
auto IsEdgeStyle = [ & InNodeID , & OutputName ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle )
{
return EdgeStyle . NodeID = = InNodeID & & EdgeStyle . OutputName = = OutputName ;
} ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( PageID ) ;
return Graph . Style . EdgeStyles . FindByPredicate ( IsEdgeStyle ) ;
}
FMetasoundFrontendEdgeStyle & FMetaSoundFrontendDocumentBuilder : : FindOrAddEdgeStyle ( const FGuid & InNodeID , FName OutputName , const FGuid * InPageID )
{
if ( FMetasoundFrontendEdgeStyle * Style = FindEdgeStyle ( InNodeID , OutputName , InPageID ) )
{
return * Style ;
}
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( PageID ) ;
FMetasoundFrontendEdgeStyle & EdgeStyle = Graph . Style . EdgeStyles . AddDefaulted_GetRef ( ) ;
checkf ( ContainsNode ( InNodeID ) , TEXT ( " Cannot add edge style for node that does not exist " ) ) ;
EdgeStyle . NodeID = InNodeID ;
EdgeStyle . OutputName = OutputName ;
return EdgeStyle ;
}
2024-08-21 18:37:59 -04:00
const FMetaSoundFrontendGraphComment * FMetaSoundFrontendDocumentBuilder : : FindGraphComment ( const FGuid & InCommentID , const FGuid * InPageID ) const
2024-01-31 15:02:39 -05:00
{
2024-08-21 18:37:59 -04:00
check ( InCommentID . IsValid ( ) ) ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
const TMap < FGuid , FMetaSoundFrontendGraphComment > & Comments = Document . RootGraph . FindConstGraphChecked ( PageID ) . Style . Comments ;
2024-01-31 15:02:39 -05:00
return Comments . Find ( InCommentID ) ;
}
2024-08-21 18:37:59 -04:00
FMetaSoundFrontendGraphComment * FMetaSoundFrontendDocumentBuilder : : FindGraphComment ( const FGuid & InCommentID , const FGuid * InPageID )
2024-01-31 15:02:39 -05:00
{
2024-08-21 18:37:59 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TMap < FGuid , FMetaSoundFrontendGraphComment > & Comments = Document . RootGraph . FindGraphChecked ( PageID ) . Style . Comments ;
2024-01-31 15:02:39 -05:00
return Comments . Find ( InCommentID ) ;
}
2024-09-16 15:56:55 -04:00
# endif // WITH_EDITORONLY_DATA
2024-01-31 15:02:39 -05:00
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : FindInterfaceInputNodes ( FName InterfaceName , TArray < const FMetasoundFrontendNode * > & OutInputs , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
OutInputs . Reset ( ) ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-03-07 17:01:52 -05:00
FMetasoundFrontendInterface Interface ;
2024-06-18 16:47:21 -04:00
const TSet < FMetasoundFrontendVersion > & Interfaces = GetConstDocumentChecked ( ) . Interfaces ;
2023-03-07 17:01:52 -05:00
if ( ISearchEngine : : Get ( ) . FindInterfaceWithHighestVersion ( InterfaceName , Interface ) )
{
2024-06-18 16:47:21 -04:00
if ( Interfaces . Contains ( Interface . Version ) )
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
const IDocumentGraphInterfaceCache & InterfaceCache = DocumentCache - > GetInterfaceCache ( ) ;
2023-03-07 17:01:52 -05:00
TArray < const FMetasoundFrontendNode * > InterfaceInputs ;
for ( const FMetasoundFrontendClassInput & Input : Interface . Inputs )
{
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClassInput * ClassInput = InterfaceCache . FindInput ( Input . Name ) ;
if ( ! ClassInput )
2023-03-07 17:01:52 -05:00
{
2023-06-16 17:48:20 -04:00
return false ;
}
if ( const FMetasoundFrontendNode * Node = NodeCache . FindNode ( ClassInput - > NodeID ) )
{
InterfaceInputs . Add ( Node ) ;
2023-03-07 17:01:52 -05:00
}
else
{
return false ;
}
}
OutInputs = MoveTemp ( InterfaceInputs ) ;
return true ;
}
}
return false ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : FindInterfaceOutputNodes ( FName InterfaceName , TArray < const FMetasoundFrontendNode * > & OutOutputs , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
OutOutputs . Reset ( ) ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2023-03-07 17:01:52 -05:00
FMetasoundFrontendInterface Interface ;
2024-06-18 16:47:21 -04:00
const TSet < FMetasoundFrontendVersion > & Interfaces = GetConstDocumentChecked ( ) . Interfaces ;
2023-03-07 17:01:52 -05:00
if ( ISearchEngine : : Get ( ) . FindInterfaceWithHighestVersion ( InterfaceName , Interface ) )
{
2024-06-18 16:47:21 -04:00
if ( Interfaces . Contains ( Interface . Version ) )
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
const IDocumentGraphInterfaceCache & InterfaceCache = DocumentCache - > GetInterfaceCache ( ) ;
2023-03-07 17:01:52 -05:00
TArray < const FMetasoundFrontendNode * > InterfaceOutputs ;
for ( const FMetasoundFrontendClassOutput & Output : Interface . Outputs )
{
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClassOutput * ClassOutput = InterfaceCache . FindOutput ( Output . Name ) ;
if ( ! ClassOutput )
2023-03-07 17:01:52 -05:00
{
2023-06-16 17:48:20 -04:00
return false ;
}
if ( const FMetasoundFrontendNode * Node = NodeCache . FindNode ( ClassOutput - > NodeID ) )
{
InterfaceOutputs . Add ( Node ) ;
2023-03-07 17:01:52 -05:00
}
else
{
return false ;
}
}
OutOutputs = MoveTemp ( InterfaceOutputs ) ;
return true ;
}
}
return false ;
}
2023-05-10 20:28:39 -04:00
const FMetasoundFrontendClassInput * FMetaSoundFrontendDocumentBuilder : : FindGraphInput ( FName InputName ) const
{
2023-06-16 17:48:20 -04:00
return DocumentCache - > GetInterfaceCache ( ) . FindInput ( InputName ) ;
2023-05-10 20:28:39 -04:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : FindGraphInputNode ( FName InputName , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2023-06-16 17:48:20 -04:00
if ( const FMetasoundFrontendClassInput * InputClass = FindGraphInput ( InputName ) )
{
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
return NodeCache . FindNode ( InputClass - > NodeID ) ;
}
return nullptr ;
2023-03-07 17:01:52 -05:00
}
2023-05-10 20:28:39 -04:00
const FMetasoundFrontendClassOutput * FMetaSoundFrontendDocumentBuilder : : FindGraphOutput ( FName OutputName ) const
{
2023-06-16 17:48:20 -04:00
return DocumentCache - > GetInterfaceCache ( ) . FindOutput ( OutputName ) ;
2023-05-10 20:28:39 -04:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : FindGraphOutputNode ( FName OutputName , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2023-06-16 17:48:20 -04:00
if ( const FMetasoundFrontendClassOutput * OutputClass = FindGraphOutput ( OutputName ) )
{
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
return NodeCache . FindNode ( OutputClass - > NodeID ) ;
}
return nullptr ;
2023-03-07 17:01:52 -05:00
}
2024-08-19 17:06:23 -04:00
const FMetasoundFrontendVariable * FMetaSoundFrontendDocumentBuilder : : FindGraphVariable ( FName VariableName , const FGuid * InPageID ) const
{
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
const FMetasoundFrontendGraph & Graph = Document . RootGraph . FindConstGraphChecked ( PageID ) ;
auto MatchesName = [ & VariableName ] ( const FMetasoundFrontendVariable & Variable ) { return Variable . Name = = VariableName ; } ;
return Graph . Variables . FindByPredicate ( MatchesName ) ;
}
- 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
# if WITH_EDITOR
UMetaSoundFrontendMemberMetadata * FMetaSoundFrontendDocumentBuilder : : FindMemberMetadata ( const FGuid & InMemberID )
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
- 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
TMap < FGuid , TObjectPtr < UMetaSoundFrontendMemberMetadata > > & LiteralMetadata = Document . Metadata . MemberMetadata ;
TObjectPtr < UMetaSoundFrontendMemberMetadata > ToReturn = LiteralMetadata . FindRef ( InMemberID ) ;
return ToReturn ;
}
# endif // WITH_EDITOR
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : FindNode ( const FGuid & InNodeID , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-03-07 17:01:52 -05:00
return NodeCache . FindNode ( InNodeID ) ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : FindNodeClassInterfaces ( const FGuid & InNodeID , TSet < FMetasoundFrontendVersion > & OutInterfaces , const FGuid & InPageID ) const
2023-03-07 17:01:52 -05:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( InPageID ) ;
2023-03-07 17:01:52 -05:00
if ( const FMetasoundFrontendNode * Node = NodeCache . FindNode ( InNodeID ) )
{
if ( const FMetasoundFrontendClass * NodeClass = DocumentCache - > FindDependency ( Node - > ClassID ) )
{
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey NodeClassRegistryKey = FNodeRegistryKey ( NodeClass - > Metadata ) ;
2023-10-19 17:47:21 -04:00
return FMetasoundFrontendRegistryContainer : : Get ( ) - > FindImplementedInterfacesFromRegistered ( NodeClassRegistryKey , OutInterfaces ) ;
2023-03-07 17:01:52 -05:00
}
}
2023-10-19 17:47:21 -04:00
return false ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * FMetaSoundFrontendDocumentBuilder : : FindNodeInput ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
return NodeCache . FindInputVertex ( InNodeID , InVertexID ) ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * FMetaSoundFrontendDocumentBuilder : : FindNodeInput ( const FGuid & InNodeID , FName InVertexName , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
return NodeCache . FindInputVertex ( InNodeID , InVertexName ) ;
}
2024-08-13 14:58:36 -04:00
const TArray < FMetasoundFrontendClassInputDefault > * FMetaSoundFrontendDocumentBuilder : : FindNodeClassInputDefaults ( const FGuid & InNodeID , FName InVertexName , const FGuid * InPageID ) const
{
using namespace Metasound ;
if ( const FMetasoundFrontendNode * Node = FindNode ( InNodeID , InPageID ) )
{
if ( const FMetasoundFrontendClass * Class = FindDependency ( Node - > ClassID ) )
{
const EMetasoundFrontendClassType ClassType = Class - > Metadata . GetType ( ) ;
switch ( ClassType )
{
case EMetasoundFrontendClassType : : External :
{
auto MatchesName = [ & InVertexName ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = InVertexName ; } ;
if ( const FMetasoundFrontendClassInput * Input = Class - > Interface . Inputs . FindByPredicate ( MatchesName ) )
{
return & Input - > GetDefaults ( ) ;
}
}
break ;
case EMetasoundFrontendClassType : : Input :
case EMetasoundFrontendClassType : : Output :
case EMetasoundFrontendClassType : : Literal :
{
return & Class - > Interface . Inputs . Last ( ) . GetDefaults ( ) ;
}
break ;
case EMetasoundFrontendClassType : : Variable :
case EMetasoundFrontendClassType : : VariableDeferredAccessor :
case EMetasoundFrontendClassType : : VariableAccessor :
case EMetasoundFrontendClassType : : VariableMutator :
{
using namespace VariableNames ;
auto IsDataInput = [ ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = METASOUND_GET_PARAM_NAME ( InputData ) ; } ;
if ( const FMetasoundFrontendClassInput * Input = Class - > Interface . Inputs . FindByPredicate ( IsDataInput ) )
{
return & Input - > GetDefaults ( ) ;
}
}
break ;
case EMetasoundFrontendClassType : : Template :
{
const Frontend : : FNodeRegistryKey Key = Frontend : : FNodeRegistryKey ( Class - > Metadata ) ;
const Frontend : : INodeTemplate * Template = Frontend : : INodeTemplateRegistry : : Get ( ) . FindTemplate ( Key ) ;
check ( Template ) ;
const FGuid PageID = InPageID ? * InPageID : Frontend : : DefaultPageID ;
return Template - > FindNodeClassInputDefaults ( * this , PageID , InNodeID , InVertexName ) ;
}
break ;
case EMetasoundFrontendClassType : : Graph :
case EMetasoundFrontendClassType : : Invalid :
default :
{
checkNoEntry ( ) ;
}
break ;
}
}
}
return nullptr ;
}
const FMetasoundFrontendVertexLiteral * FMetaSoundFrontendDocumentBuilder : : FindNodeInputDefault ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
{
if ( const FMetasoundFrontendNode * Node = FindNode ( InNodeID , InPageID ) )
{
auto VertexLiteralMatchesID = [ & InVertexID ] ( const FMetasoundFrontendVertexLiteral & VertexLiteral )
{
return VertexLiteral . VertexID = = InVertexID ;
} ;
return Node - > InputLiterals . FindByPredicate ( VertexLiteralMatchesID ) ;
}
return nullptr ;
}
const FMetasoundFrontendVertexLiteral * FMetaSoundFrontendDocumentBuilder : : FindNodeInputDefault ( const FGuid & InNodeID , FName InVertexName , const FGuid * InPageID ) const
{
using namespace Metasound : : Frontend ;
if ( const FMetasoundFrontendVertex * Vertex = FindNodeInput ( InNodeID , InVertexName , InPageID ) )
{
return FindNodeInputDefault ( InNodeID , Vertex - > VertexID , InPageID ) ;
}
return nullptr ;
}
2024-06-18 16:47:21 -04:00
TArray < const FMetasoundFrontendVertex * > FMetaSoundFrontendDocumentBuilder : : FindNodeInputs ( const FGuid & InNodeID , FName TypeName , const FGuid * InPageID ) const
2023-06-22 14:51:42 -04:00
{
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
return DocumentCache - > GetNodeCache ( PageID ) . FindNodeInputs ( InNodeID , TypeName ) ;
2023-06-22 14:51:42 -04:00
}
2024-06-18 16:47:21 -04:00
TArray < const FMetasoundFrontendVertex * > FMetaSoundFrontendDocumentBuilder : : FindNodeInputsConnectedToNodeOutput ( const FGuid & InOutputNodeID , const FGuid & InOutputVertexID , TArray < const FMetasoundFrontendNode * > * ConnectedInputNodes , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
2023-07-27 19:43:47 -04:00
2024-01-30 18:13:20 -05:00
if ( ConnectedInputNodes )
{
ConnectedInputNodes - > Reset ( ) ;
}
2023-07-27 19:43:47 -04:00
TArray < const FMetasoundFrontendVertex * > Inputs ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & Graph = Document . RootGraph . FindConstGraphChecked ( PageID ) ;
2023-09-05 17:54:02 -04:00
const TArrayView < const int32 > Indices = EdgeCache . FindEdgeIndicesFromNodeOutput ( InOutputNodeID , InOutputVertexID ) ;
2024-05-29 15:33:29 -04:00
Algo : : Transform ( Indices , Inputs , [ & Graph , & Document , & NodeCache , & ConnectedInputNodes ] ( const int32 & Index )
2023-07-27 19:43:47 -04:00
{
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendEdge & Edge = Graph . Edges [ Index ] ;
2023-09-05 17:54:02 -04:00
if ( ConnectedInputNodes )
2023-07-27 19:43:47 -04:00
{
2023-09-05 17:54:02 -04:00
ConnectedInputNodes - > Add ( NodeCache . FindNode ( Edge . ToNodeID ) ) ;
}
return NodeCache . FindInputVertex ( Edge . ToNodeID , Edge . ToVertexID ) ;
} ) ;
2023-07-27 19:43:47 -04:00
return Inputs ;
}
2024-06-18 16:47:21 -04:00
FMetasoundFrontendNode * FMetaSoundFrontendDocumentBuilder : : FindNodeInternal ( const FGuid & InNodeID , const FGuid * InPageID )
2024-01-31 15:02:39 -05:00
{
using namespace Metasound : : Frontend ;
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2024-01-31 15:02:39 -05:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
return & Graph . Nodes [ * NodeIndex ] ;
2024-01-31 15:02:39 -05:00
}
return nullptr ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * FMetaSoundFrontendDocumentBuilder : : FindNodeOutput ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
return NodeCache . FindOutputVertex ( InNodeID , InVertexID ) ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * FMetaSoundFrontendDocumentBuilder : : FindNodeOutput ( const FGuid & InNodeID , FName InVertexName , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
return NodeCache . FindOutputVertex ( InNodeID , InVertexName ) ;
}
2024-06-18 16:47:21 -04:00
TArray < const FMetasoundFrontendVertex * > FMetaSoundFrontendDocumentBuilder : : FindNodeOutputs ( const FGuid & InNodeID , FName TypeName , const FGuid * InPageID ) const
2023-06-22 14:51:42 -04:00
{
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
return DocumentCache - > GetNodeCache ( PageID ) . FindNodeOutputs ( InNodeID , TypeName ) ;
2023-06-22 14:51:42 -04:00
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * FMetaSoundFrontendDocumentBuilder : : FindNodeOutputConnectedToNodeInput ( const FGuid & InInputNodeID , const FGuid & InInputVertexID , const FMetasoundFrontendNode * * ConnectedOutputNode , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
if ( const int32 * Index = EdgeCache . FindEdgeIndexToNodeInput ( InInputNodeID , InInputVertexID ) )
{
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendEdge & Edge = Document . RootGraph . FindConstGraphChecked ( PageID ) . Edges [ * Index ] ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
if ( ConnectedOutputNode )
{
( * ConnectedOutputNode ) = NodeCache . FindNode ( Edge . FromNodeID ) ;
}
return NodeCache . FindOutputVertex ( Edge . FromNodeID , Edge . FromVertexID ) ;
}
if ( ConnectedOutputNode )
{
* ConnectedOutputNode = nullptr ;
}
return nullptr ;
}
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
2024-08-21 18:37:59 -04:00
FMetaSoundFrontendGraphComment & FMetaSoundFrontendDocumentBuilder : : FindOrAddGraphComment ( const FGuid & InCommentID , const FGuid * InPageID )
2024-01-31 15:02:39 -05:00
{
check ( InCommentID . IsValid ( ) ) ;
2024-08-21 18:37:59 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TMap < FGuid , FMetaSoundFrontendGraphComment > & Comments = Document . RootGraph . FindGraphChecked ( PageID ) . Style . Comments ;
2024-01-31 15:02:39 -05:00
return Comments . FindOrAdd ( InCommentID ) ;
}
2024-09-16 15:56:55 -04:00
# endif // WITH_EDITORONLY_DATA
2024-01-31 15:02:39 -05:00
2024-05-08 14:53:53 -04:00
FMetasoundFrontendClassName FMetaSoundFrontendDocumentBuilder : : GenerateNewClassName ( )
{
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
FMetasoundFrontendClassMetadata & Metadata = GetDocumentChecked ( ) . RootGraph . Metadata ;
2024-05-08 14:53:53 -04:00
const FMetasoundFrontendClassName NewClassName ( FName ( ) , FName ( * FGuid : : NewGuid ( ) . ToString ( ) ) , FName ( ) ) ;
Metadata . SetClassName ( NewClassName ) ;
return NewClassName ;
}
2023-05-10 20:28:39 -04:00
const FTopLevelAssetPath FMetaSoundFrontendDocumentBuilder : : GetBuilderClassPath ( ) const
{
IMetaSoundDocumentInterface * Interface = DocumentInterface . GetInterface ( ) ;
checkf ( Interface , TEXT ( " Failed to return class path; interface must always be valid while builder is operating on MetaSound UObject! " ) ) ;
return Interface - > GetBaseMetaSoundUClass ( ) . GetClassPathName ( ) ;
}
2024-05-29 15:33:29 -04:00
const FMetasoundFrontendDocument & FMetaSoundFrontendDocumentBuilder : : GetConstDocumentChecked ( ) const
2024-05-08 14:53:53 -04:00
{
2024-05-29 15:33:29 -04:00
return GetConstDocumentInterfaceChecked ( ) . GetConstDocument ( ) ;
}
const IMetaSoundDocumentInterface & FMetaSoundFrontendDocumentBuilder : : GetConstDocumentInterfaceChecked ( ) const
{
const IMetaSoundDocumentInterface * Interface = DocumentInterface . GetInterface ( ) ;
checkf ( Interface , TEXT ( " Failed to return document; interface must always be valid while builder is operating on MetaSound UObject! " ) ) ;
return * Interface ;
2024-05-08 14:53:53 -04:00
}
2023-09-07 11:11:22 -04:00
const FString FMetaSoundFrontendDocumentBuilder : : GetDebugName ( ) const
{
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
UObject & MetaSoundObject = CastDocumentObjectChecked < UObject > ( ) ;
return MetaSoundObject . GetPathName ( ) ;
2023-03-07 17:01:52 -05:00
}
const FMetasoundFrontendDocument & FMetaSoundFrontendDocumentBuilder : : GetDocument ( ) const
{
2024-05-29 15:33:29 -04:00
const IMetaSoundDocumentInterface * Interface = DocumentInterface . GetInterface ( ) ;
checkf ( Interface , TEXT ( " Failed to return document; interface must always be valid while builder is operating on MetaSound UObject! " ) ) ;
return Interface - > GetConstDocument ( ) ;
}
FMetasoundFrontendDocument & FMetaSoundFrontendDocumentBuilder : : GetDocumentChecked ( ) const
{
return GetDocumentInterfaceChecked ( ) . GetDocument ( ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
Metasound : : Frontend : : FDocumentModifyDelegates & FMetaSoundFrontendDocumentBuilder : : GetDocumentDelegates ( )
2023-06-16 17:48:20 -04:00
{
return * DocumentDelegates ;
}
2023-04-04 19:14:26 -04:00
const IMetaSoundDocumentInterface & FMetaSoundFrontendDocumentBuilder : : GetDocumentInterface ( ) const
{
2024-05-29 15:33:29 -04:00
const IMetaSoundDocumentInterface * Interface = DocumentInterface . GetInterface ( ) ;
checkf ( Interface , TEXT ( " Failed to return document; interface must always be valid while builder is operating on MetaSound UObject! " ) ) ;
2023-04-04 19:14:26 -04:00
return * Interface ;
}
2024-05-29 15:33:29 -04:00
IMetaSoundDocumentInterface & FMetaSoundFrontendDocumentBuilder : : GetDocumentInterfaceChecked ( ) const
{
IMetaSoundDocumentInterface * Interface = DocumentInterface . GetInterface ( ) ;
checkf ( Interface , TEXT ( " Failed to return document; interface must always be valid while builder is operating on MetaSound UObject! " ) ) ;
return * Interface ;
}
2024-06-18 16:47:21 -04:00
TArray < const FMetasoundFrontendNode * > FMetaSoundFrontendDocumentBuilder : : GetGraphInputTemplateNodes ( FName InInputName , const FGuid * InPageID )
{
using namespace Metasound : : Frontend ;
TArray < const FMetasoundFrontendNode * > TemplateNodes ;
const FGuid PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendGraphClass & RootGraph = GetDocumentChecked ( ) . RootGraph ;
if ( const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( InInputName ) )
{
const FMetasoundFrontendClassInput & InputClass = RootGraph . Interface . Inputs [ * Index ] ;
const FMetasoundFrontendGraph & Graph = RootGraph . FindConstGraphChecked ( PageID ) ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
if ( const FMetasoundFrontendNode * InputNode = NodeCache . FindNode ( InputClass . NodeID ) )
{
const FGuid OutputVertexID = InputNode - > Interface . Outputs . Last ( ) . VertexID ;
const TArray < const FMetasoundFrontendEdge * > ConnectedEdges = EdgeCache . FindEdges ( InputClass . NodeID , OutputVertexID ) ;
for ( const FMetasoundFrontendEdge * Edge : ConnectedEdges )
{
check ( Edge ) ;
if ( const int32 * ConnectedNodeIndex = NodeCache . FindNodeIndex ( Edge - > ToNodeID ) )
{
const FMetasoundFrontendNode & ConnectedNode = Graph . Nodes [ * ConnectedNodeIndex ] ;
if ( const FMetasoundFrontendClass * ConnectedNodeClass = FindDependency ( ConnectedNode . ClassID ) )
{
if ( ConnectedNodeClass - > Metadata . GetClassName ( ) = = FInputNodeTemplate : : ClassName )
{
TemplateNodes . Add ( & ConnectedNode ) ;
}
}
}
}
}
}
return TemplateNodes ;
}
2024-05-29 15:33:29 -04:00
FMetasoundAssetBase & FMetaSoundFrontendDocumentBuilder : : GetMetasoundAsset ( ) const
- 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
{
using namespace Metasound : : Frontend ;
UObject * Object = DocumentInterface . GetObject ( ) ;
check ( Object ) ;
FMetasoundAssetBase * Asset = IMetaSoundAssetManager : : GetChecked ( ) . GetAsAsset ( * Object ) ;
check ( Asset ) ;
return * Asset ;
}
2024-09-04 17:35:04 -04:00
FMetasoundAssetBase * FMetaSoundFrontendDocumentBuilder : : GetReferencedPresetAsset ( ) const
{
using namespace Metasound : : Frontend ;
if ( ! IsPreset ( ) )
{
return nullptr ;
}
// Find the single external node which is the referenced preset asset,
// and find the asset with its registry key
auto FindExternalNode = [ this ] ( const FMetasoundFrontendNode & Node )
{
const FMetasoundFrontendClass * Class = FindDependency ( Node . ClassID ) ;
check ( Class ) ;
return Class - > Metadata . GetType ( ) = = EMetasoundFrontendClassType : : External ;
} ;
const FMetasoundFrontendNode * Node = FindConstBuildGraphChecked ( ) . Nodes . FindByPredicate ( FindExternalNode ) ;
if ( Node ! = nullptr )
{
const FMetasoundFrontendClass * NodeClass = FindDependency ( Node - > ClassID ) ;
check ( NodeClass ) ;
2024-09-10 10:26:02 -04:00
const FAssetKey NodeAssetKey ( NodeClass - > Metadata ) ;
const TArray < FMetasoundAssetBase * > ReferencedAssets = GetMetasoundAsset ( ) . GetReferencedAssets ( ) ;
for ( FMetasoundAssetBase * RefAsset : ReferencedAssets )
{
TScriptInterface < IMetaSoundDocumentInterface > RefDocInterface = RefAsset - > GetOwningAsset ( ) ;
if ( RefDocInterface . GetObject ( ) ! = nullptr )
{
const FAssetKey AssetKey ( RefDocInterface - > GetConstDocument ( ) . RootGraph . Metadata ) ;
if ( AssetKey = = NodeAssetKey )
{
return RefAsset ;
}
}
}
2024-09-04 17:35:04 -04:00
}
return nullptr ;
}
2024-05-29 15:33:29 -04:00
const FGuid & FMetaSoundFrontendDocumentBuilder : : GetBuildPageID ( ) const
- 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
{
2024-05-29 15:33:29 -04:00
return BuildPageID ;
- 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
}
2024-06-18 16:47:21 -04:00
EMetasoundFrontendVertexAccessType FMetaSoundFrontendDocumentBuilder : : GetNodeInputAccessType ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-09-07 11:11:22 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-09-07 11:11:22 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & Graph = GetConstDocumentChecked ( ) . RootGraph . FindConstGraphChecked ( PageID ) ;
2023-09-07 11:11:22 -04:00
const FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
auto IsVertexID = [ & InVertexID ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . VertexID = = InVertexID ; } ;
if ( const FMetasoundFrontendClass * Class = DocumentCache - > FindDependency ( Node . ClassID ) )
{
const EMetasoundFrontendClassType ClassType = Class - > Metadata . GetType ( ) ;
switch ( ClassType )
{
case EMetasoundFrontendClassType : : Template :
{
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey Key = FNodeRegistryKey ( Class - > Metadata ) ;
2023-09-07 11:11:22 -04:00
const INodeTemplate * Template = INodeTemplateRegistry : : Get ( ) . FindTemplate ( Key ) ;
2023-10-12 16:37:45 -04:00
if ( ensureMsgf ( Template , TEXT ( " Failed to find MetaSound node template registered with key '%s' " ) , * Key . ToString ( ) ) )
2023-09-07 11:11:22 -04:00
{
if ( Template - > IsInputAccessTypeDynamic ( ) )
{
2024-06-27 18:32:11 -04:00
return Template - > GetNodeInputAccessType ( * this , PageID , InNodeID , InVertexID ) ;
2023-09-07 11:11:22 -04:00
}
}
}
break ;
case EMetasoundFrontendClassType : : Output :
{
const FMetasoundFrontendClassInput & ClassInput = Class - > Interface . Inputs . Last ( ) ;
return ClassInput . AccessType ;
}
default :
break ;
}
static_assert ( static_cast < uint32 > ( EMetasoundFrontendClassType : : Invalid ) = = 10 , " Potential missing case coverage for EMetasoundFrontendClassType " ) ;
if ( const FMetasoundFrontendVertex * Vertex = Node . Interface . Inputs . FindByPredicate ( IsVertexID ) )
{
auto IsClassInput = [ VertexName = Vertex - > Name ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = VertexName ; } ;
if ( const FMetasoundFrontendClassInput * ClassInput = Class - > Interface . Inputs . FindByPredicate ( IsClassInput ) )
{
return ClassInput - > AccessType ;
}
}
}
}
return EMetasoundFrontendVertexAccessType : : Unset ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendLiteral * FMetaSoundFrontendDocumentBuilder : : GetNodeInputClassDefault ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-09-07 11:11:22 -04:00
{
2024-07-26 14:23:35 -04:00
using namespace Metasound ;
2023-09-07 11:11:22 -04:00
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
2024-07-26 14:23:35 -04:00
const Frontend : : IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-09-07 11:11:22 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
const FMetasoundFrontendNode & Node = Document . RootGraph . FindConstGraphChecked ( PageID ) . Nodes [ * NodeIndex ] ;
2023-09-07 11:11:22 -04:00
auto IsVertexID = [ & InVertexID ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . VertexID = = InVertexID ; } ;
if ( const FMetasoundFrontendVertex * Vertex = Node . Interface . Inputs . FindByPredicate ( IsVertexID ) )
{
if ( const FMetasoundFrontendClass * Class = DocumentCache - > FindDependency ( Node . ClassID ) )
{
2023-09-11 17:33:43 -04:00
const EMetasoundFrontendClassType ClassType = Class - > Metadata . GetType ( ) ;
switch ( ClassType )
2023-09-07 11:11:22 -04:00
{
2023-09-11 17:33:43 -04:00
case EMetasoundFrontendClassType : : Output :
{
const FMetasoundFrontendClassInput & ClassInput = Class - > Interface . Inputs . Last ( ) ;
2024-07-26 14:23:35 -04:00
return ClassInput . FindConstDefault ( Frontend : : DefaultPageID ) ;
2023-09-11 17:33:43 -04:00
}
break ;
default :
{
auto IsClassInput = [ VertexName = Vertex - > Name ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = VertexName ; } ;
if ( const FMetasoundFrontendClassInput * ClassInput = Class - > Interface . Inputs . FindByPredicate ( IsClassInput ) )
{
2024-07-26 14:23:35 -04:00
return ClassInput - > FindConstDefault ( Frontend : : DefaultPageID ) ;
2023-09-11 17:33:43 -04:00
}
static_assert ( static_cast < uint32 > ( EMetasoundFrontendClassType : : Invalid ) = = 10 , " Potential missing case coverage for EMetasoundFrontendClassType "
" (default may not be sufficient for newly added class types) " ) ;
}
break ;
2023-09-07 11:11:22 -04:00
}
2024-01-31 15:02:39 -05:00
static_assert ( static_cast < uint32 > ( EMetasoundFrontendClassType : : Invalid ) = = 10 , " Potential missing case coverage for EMetasoundFrontendClassType " ) ;
2023-09-07 11:11:22 -04:00
}
}
}
return nullptr ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendLiteral * FMetaSoundFrontendDocumentBuilder : : GetNodeInputDefault ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-06-16 17:48:20 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & Graph = GetConstDocumentChecked ( ) . RootGraph . FindConstGraphChecked ( PageID ) ;
const FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
2023-06-16 17:48:20 -04:00
auto IsVertex = [ & InVertexID ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . VertexID = = InVertexID ; } ;
const int32 VertexIndex = Node . Interface . Inputs . IndexOfByPredicate ( IsVertex ) ;
if ( VertexIndex ! = INDEX_NONE )
{
const FMetasoundFrontendVertex & NodeInput = Node . Interface . Inputs [ VertexIndex ] ;
auto IsLiteral = [ & InVertexID ] ( const FMetasoundFrontendVertexLiteral & Literal ) { return Literal . VertexID = = InVertexID ; } ;
const int32 LiteralIndex = Node . InputLiterals . IndexOfByPredicate ( IsLiteral ) ;
if ( LiteralIndex ! = INDEX_NONE )
{
return & Node . InputLiterals [ LiteralIndex ] . Value ;
}
}
}
return nullptr ;
}
2024-06-18 16:47:21 -04:00
EMetasoundFrontendVertexAccessType FMetaSoundFrontendDocumentBuilder : : GetNodeOutputAccessType ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-06-16 17:48:20 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendGraph & Graph = GetConstDocumentChecked ( ) . RootGraph . FindConstGraphChecked ( PageID ) ;
const FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
2023-09-07 11:11:22 -04:00
if ( const FMetasoundFrontendClass * Class = DocumentCache - > FindDependency ( Node . ClassID ) )
2023-06-16 17:48:20 -04:00
{
2023-09-07 11:11:22 -04:00
const EMetasoundFrontendClassType ClassType = Class - > Metadata . GetType ( ) ;
switch ( ClassType )
2023-06-16 17:48:20 -04:00
{
2023-09-07 11:11:22 -04:00
case EMetasoundFrontendClassType : : Template :
2023-06-16 17:48:20 -04:00
{
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey Key = FNodeRegistryKey ( Class - > Metadata ) ;
2023-09-07 11:11:22 -04:00
const INodeTemplate * Template = INodeTemplateRegistry : : Get ( ) . FindTemplate ( Key ) ;
2023-10-12 16:37:45 -04:00
if ( ensureMsgf ( Template , TEXT ( " Failed to find MetaSound node template registered with key '%s' " ) , * Key . ToString ( ) ) )
2023-09-07 11:11:22 -04:00
{
if ( Template - > IsOutputAccessTypeDynamic ( ) )
{
2024-06-27 18:32:11 -04:00
return Template - > GetNodeOutputAccessType ( * this , PageID , InNodeID , InVertexID ) ;
2023-09-07 11:11:22 -04:00
}
}
}
break ;
case EMetasoundFrontendClassType : : Input :
{
const FMetasoundFrontendClassOutput & ClassOutput = Class - > Interface . Outputs . Last ( ) ;
return ClassOutput . AccessType ;
}
default :
break ;
}
static_assert ( static_cast < uint32 > ( EMetasoundFrontendClassType : : Invalid ) = = 10 , " Potential missing case coverage for EMetasoundFrontendClassType " ) ;
auto IsVertexID = [ & InVertexID ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . VertexID = = InVertexID ; } ;
if ( const FMetasoundFrontendVertex * Vertex = Node . Interface . Outputs . FindByPredicate ( IsVertexID ) )
{
auto IsClassInput = [ VertexName = Vertex - > Name ] ( const FMetasoundFrontendClassInput & Output ) { return Output . Name = = VertexName ; } ;
if ( const FMetasoundFrontendClassOutput * ClassOutput = Class - > Interface . Outputs . FindByPredicate ( IsClassInput ) )
{
return ClassOutput - > AccessType ;
2023-06-16 17:48:20 -04:00
}
}
}
}
2023-09-07 11:11:22 -04:00
return EMetasoundFrontendVertexAccessType : : Unset ;
2023-06-16 17:48:20 -04:00
}
2024-08-20 03:27:21 -04:00
# if WITH_EDITORONLY_DATA
const bool FMetaSoundFrontendDocumentBuilder : : GetIsAdvancedDisplay ( const FName MemberName , const EMetasoundFrontendClassType Type ) const
{
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
//Input
if ( Type = = EMetasoundFrontendClassType : : Input )
{
if ( const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( MemberName ) )
{
const FMetasoundFrontendClassInput & GraphInput = Document . RootGraph . Interface . Inputs [ * Index ] ;
return GraphInput . Metadata . bIsAdvancedDisplay ;
}
}
//Output
else if ( Type = = EMetasoundFrontendClassType : : Output )
{
if ( const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindOutputIndex ( MemberName ) )
{
const FMetasoundFrontendClassOutput & GraphOutput = Document . RootGraph . Interface . Outputs [ * Index ] ;
return GraphOutput . Metadata . bIsAdvancedDisplay ;
}
}
return false ;
}
# endif // WITH_EDITORONLY_DATA
- 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
void FMetaSoundFrontendDocumentBuilder : : InitDocument ( const FMetasoundFrontendDocument * InDocumentTemplate , const FMetasoundFrontendClassName * InNewClassName , bool bResetVersion )
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
METASOUND_TRACE_CPUPROFILER_EVENT_SCOPE ( FMetaSoundFrontendDocumentBuilder : : InitDocument ) ;
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2024-08-14 12:49:51 -04:00
Document . RootGraph . InitDefaultGraphPage ( ) ;
- 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
// 1. Set default class Metadata.
if ( InDocumentTemplate )
{
// 1a. If template provided, copy that.
Document = * InDocumentTemplate ;
InitGraphClassMetadata ( bResetVersion , InNewClassName ) ;
}
else
{
// 1a. Initialize class using default data
FMetasoundFrontendClassMetadata & ClassMetadata = Document . RootGraph . Metadata ;
InitGraphClassMetadata ( Document . RootGraph . Metadata , bResetVersion , InNewClassName ) ;
2024-07-26 14:23:35 -04:00
# if WITH_EDITORONLY_DATA
- 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
// 1b. Set default doc version Metadata
{
FMetasoundFrontendDocumentMetadata & DocMetadata = Document . Metadata ;
DocMetadata . Version . Number = GetMaxDocumentVersion ( ) ;
}
2024-07-26 14:23:35 -04:00
# endif // WITH_EDITORONLY_DATA
- 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
// 1c. Add default interfaces for given UClass
{
TArray < FMetasoundFrontendVersion > InitVersions = ISearchEngine : : Get ( ) . FindUClassDefaultInterfaceVersions ( GetBuilderClassPath ( ) ) ;
FModifyInterfaceOptions Options ( { } , InitVersions ) ;
ModifyInterfaces ( MoveTemp ( Options ) ) ;
}
}
}
bool FMetaSoundFrontendDocumentBuilder : : IsValid ( ) const
{
return DocumentInterface . GetObject ( ) ! = nullptr ;
}
2023-10-31 17:16:11 -04:00
int32 FMetaSoundFrontendDocumentBuilder : : GetTransactionCount ( ) const
{
using namespace Metasound : : Frontend ;
if ( DocumentCache . IsValid ( ) )
{
return StaticCastSharedPtr < FDocumentCache > ( DocumentCache ) - > GetTransactionCount ( ) ;
}
return 0 ;
}
2023-07-19 17:25:21 -04:00
void FMetaSoundFrontendDocumentBuilder : : InitGraphClassMetadata ( FMetasoundFrontendClassMetadata & InOutMetadata , bool bResetVersion , const FMetasoundFrontendClassName * NewClassName )
2023-03-07 17:01:52 -05:00
{
2023-07-19 17:25:21 -04:00
if ( NewClassName )
{
InOutMetadata . SetClassName ( * NewClassName ) ;
}
else
{
InOutMetadata . SetClassName ( FMetasoundFrontendClassName ( FName ( ) , * FGuid : : NewGuid ( ) . ToString ( ) , FName ( ) ) ) ;
}
2023-03-07 17:01:52 -05:00
if ( bResetVersion )
{
InOutMetadata . SetVersion ( { 1 , 0 } ) ;
}
InOutMetadata . SetType ( EMetasoundFrontendClassType : : Graph ) ;
}
- 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
void FMetaSoundFrontendDocumentBuilder : : InitGraphClassMetadata ( bool bResetVersion , const FMetasoundFrontendClassName * NewClassName )
2023-03-07 17:01:52 -05:00
{
2024-05-29 15:33:29 -04:00
InitGraphClassMetadata ( GetDocumentChecked ( ) . RootGraph . Metadata , bResetVersion , NewClassName ) ;
2023-03-07 17:01:52 -05:00
}
void FMetaSoundFrontendDocumentBuilder : : InitNodeLocations ( )
{
# if WITH_EDITORONLY_DATA
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-08-21 18:37:59 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
2023-03-07 17:01:52 -05:00
{
2024-09-10 10:26:02 -04:00
FVector2D InputNodeLocation = FVector2D : : ZeroVector ;
FVector2D ExternalNodeLocation = InputNodeLocation + DisplayStyle : : NodeLayout : : DefaultOffsetX ;
FVector2D OutputNodeLocation = ExternalNodeLocation + DisplayStyle : : NodeLayout : : DefaultOffsetX ;
2024-08-21 18:37:59 -04:00
TArray < FMetasoundFrontendNode > & Nodes = Graph . Nodes ;
for ( FMetasoundFrontendNode & Node : Nodes )
2023-03-07 17:01:52 -05:00
{
2024-08-21 18:37:59 -04:00
if ( const int32 * ClassIndex = DocumentCache - > FindDependencyIndex ( Node . ClassID ) )
{
FMetasoundFrontendClass & Class = Document . Dependencies [ * ClassIndex ] ;
2023-03-07 17:01:52 -05:00
2024-08-21 18:37:59 -04:00
const EMetasoundFrontendClassType NodeType = Class . Metadata . GetType ( ) ;
FVector2D NewLocation ;
if ( NodeType = = EMetasoundFrontendClassType : : Input )
{
NewLocation = InputNodeLocation ;
InputNodeLocation + = DisplayStyle : : NodeLayout : : DefaultOffsetY ;
}
else if ( NodeType = = EMetasoundFrontendClassType : : Output )
{
NewLocation = OutputNodeLocation ;
OutputNodeLocation + = DisplayStyle : : NodeLayout : : DefaultOffsetY ;
}
else
{
NewLocation = ExternalNodeLocation ;
ExternalNodeLocation + = DisplayStyle : : NodeLayout : : DefaultOffsetY ;
}
2023-03-07 17:01:52 -05:00
2024-08-21 18:37:59 -04:00
// TODO: Find consistent location for controlling node locations.
// Currently it is split between MetasoundEditor and MetasoundFrontend modules.
FMetasoundFrontendNodeStyle & Style = Node . Style ;
if ( Style . Display . Locations . IsEmpty ( ) )
{
Style . Display . Locations = { { FGuid : : NewGuid ( ) , NewLocation } } ;
}
// Initialize the position if the location hasn't been assigned yet. This can happen
// if default interfaces were assigned to the given MetaSound but not placed with respect
// to one another. In this case, node location initialization takes "priority" to avoid
// visual overlap.
else if ( Style . Display . Locations . Num ( ) = = 1 & & Style . Display . Locations . Contains ( FGuid ( ) ) )
{
Style . Display . Locations = { { FGuid : : NewGuid ( ) , NewLocation } } ;
}
2023-07-31 17:24:38 -04:00
}
2023-03-07 17:01:52 -05:00
}
2024-08-21 18:37:59 -04:00
} ) ;
2023-03-07 17:01:52 -05:00
# endif // WITH_EDITORONLY_DATA
}
2023-05-10 20:28:39 -04:00
bool FMetaSoundFrontendDocumentBuilder : : IsDependencyReferenced ( const FGuid & InClassID ) const
{
2024-06-21 16:42:38 -04:00
bool bIsReferenced = false ;
GetConstDocumentChecked ( ) . RootGraph . IterateGraphPages ( [ this , & InClassID , & bIsReferenced ] ( const FMetasoundFrontendGraph & Graph )
{
using namespace Metasound : : Frontend ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
bIsReferenced | = NodeCache . ContainsNodesOfClassID ( InClassID ) ;
} ) ;
return bIsReferenced ;
2023-05-10 20:28:39 -04:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : IsNodeInputConnected ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
return DocumentCache - > GetEdgeCache ( PageID ) . IsNodeInputConnected ( InNodeID , InVertexID ) ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : IsNodeOutputConnected ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID ) const
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
return DocumentCache - > GetEdgeCache ( PageID ) . IsNodeOutputConnected ( InNodeID , InVertexID ) ;
2023-03-07 17:01:52 -05:00
}
bool FMetaSoundFrontendDocumentBuilder : : IsInterfaceDeclared ( FName InInterfaceName ) const
{
using namespace Metasound : : Frontend ;
FMetasoundFrontendInterface Interface ;
if ( ISearchEngine : : Get ( ) . FindInterfaceWithHighestVersion ( InInterfaceName , Interface ) )
{
return IsInterfaceDeclared ( Interface . Version ) ;
}
return false ;
}
bool FMetaSoundFrontendDocumentBuilder : : IsInterfaceDeclared ( const FMetasoundFrontendVersion & InInterfaceVersion ) const
{
2024-05-29 15:33:29 -04:00
return GetConstDocumentChecked ( ) . Interfaces . Contains ( InInterfaceVersion ) ;
2023-03-07 17:01:52 -05:00
}
2023-05-30 14:39:48 -04:00
bool FMetaSoundFrontendDocumentBuilder : : IsPreset ( ) const
{
2024-05-29 15:33:29 -04:00
return GetConstDocumentChecked ( ) . RootGraph . PresetOptions . bIsPreset ;
2023-05-30 14:39:48 -04:00
}
2024-06-18 16:47:21 -04:00
Metasound : : Frontend : : EInvalidEdgeReason FMetaSoundFrontendDocumentBuilder : : IsValidEdge ( const FMetasoundFrontendEdge & InEdge , const FGuid * InPageID ) const
2023-07-27 19:43:47 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-07-27 19:43:47 -04:00
2023-09-07 11:11:22 -04:00
const FMetasoundFrontendVertex * OutputVertex = NodeCache . FindOutputVertex ( InEdge . FromNodeID , InEdge . FromVertexID ) ;
2023-07-27 19:43:47 -04:00
if ( ! OutputVertex )
{
2023-09-07 11:11:22 -04:00
return EInvalidEdgeReason : : MissingOutput ;
2023-07-27 19:43:47 -04:00
}
2023-09-07 11:11:22 -04:00
const FMetasoundFrontendVertex * InputVertex = NodeCache . FindInputVertex ( InEdge . ToNodeID , InEdge . ToVertexID ) ;
if ( ! InputVertex )
2023-07-27 19:43:47 -04:00
{
2023-09-07 11:11:22 -04:00
return EInvalidEdgeReason : : MissingInput ;
2023-07-27 19:43:47 -04:00
}
2023-09-07 11:11:22 -04:00
if ( OutputVertex - > TypeName ! = InputVertex - > TypeName )
2023-07-27 19:43:47 -04:00
{
return EInvalidEdgeReason : : MismatchedDataType ;
}
2023-09-07 11:11:22 -04:00
// TODO: Add cycle detection here
2024-06-18 16:47:21 -04:00
const EMetasoundFrontendVertexAccessType OutputAccessType = GetNodeOutputAccessType ( InEdge . FromNodeID , InEdge . FromVertexID , InPageID ) ;
const EMetasoundFrontendVertexAccessType InputAccessType = GetNodeInputAccessType ( InEdge . ToNodeID , InEdge . ToVertexID , InPageID ) ;
2023-09-05 17:54:02 -04:00
if ( ! FMetasoundFrontendClassVertex : : CanConnectVertexAccessTypes ( OutputAccessType , InputAccessType ) )
2023-07-27 19:43:47 -04:00
{
return EInvalidEdgeReason : : MismatchedAccessType ;
}
return EInvalidEdgeReason : : None ;
}
2024-06-18 16:47:21 -04:00
void FMetaSoundFrontendDocumentBuilder : : IterateNodesConnectedWithVertex ( const FMetasoundFrontendVertexHandle & Vertex , TFunctionRef < void ( const FMetasoundFrontendEdge & , FMetasoundFrontendNode & ) > NodeIndexIterFunc , const FGuid & InPageID )
- 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
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( InPageID ) ;
- 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
TArray < FMetasoundFrontendEdge > EdgesToConnectedNodes ; // Have to cache to avoid pointers becoming garbage in subsequent removal loop
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( InPageID ) ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( InPageID ) ;
- 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
const TArray < const FMetasoundFrontendEdge * > Edges = EdgeCache . FindEdges ( Vertex . NodeID , Vertex . VertexID ) ;
Algo : : Transform ( Edges , EdgesToConnectedNodes , [ ] ( const FMetasoundFrontendEdge * Edge ) { check ( Edge ) ; return * Edge ; } ) ;
for ( const FMetasoundFrontendEdge & Edge : EdgesToConnectedNodes )
{
const FGuid & ConnectedNodeID = Edge . ToNodeID = = Vertex . NodeID ? Edge . FromNodeID : Edge . ToNodeID ;
if ( const int32 * ConnectedNodeIndex = NodeCache . FindNodeIndex ( ConnectedNodeID ) )
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendNode & Node = Graph . Nodes [ * ConnectedNodeIndex ] ;
- 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
NodeIndexIterFunc ( Edge , Node ) ;
}
}
}
2024-07-17 15:46:56 -04:00
void FMetaSoundFrontendDocumentBuilder : : IterateNodesByClassType ( Metasound : : Frontend : : FConstClassAndNodeFunctionRef Func , EMetasoundFrontendClassType ClassType , const FGuid * InPageID ) const
{
using namespace Metasound : : Frontend ;
check ( ClassType ! = EMetasoundFrontendClassType : : Invalid ) ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const FMetasoundFrontendDocument & Doc = GetConstDocumentChecked ( ) ;
const FMetasoundFrontendGraph & Graph = Doc . RootGraph . FindConstGraphChecked ( PageID ) ;
for ( const FMetasoundFrontendNode & Node : Graph . Nodes )
{
if ( const FMetasoundFrontendClass * Class = FindDependency ( Node . ClassID ) )
{
if ( Class - > Metadata . GetType ( ) = = ClassType )
{
Func ( * Class , Node ) ;
}
}
}
}
2023-05-10 20:28:39 -04:00
bool FMetaSoundFrontendDocumentBuilder : : ModifyInterfaces ( Metasound : : Frontend : : FModifyInterfaceOptions & & InOptions )
{
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Doc = GetDocumentChecked ( ) ;
2023-09-05 17:54:02 -04:00
DocumentBuilderPrivate : : FModifyInterfacesImpl Context ( Doc , MoveTemp ( InOptions ) ) ;
return Context . Execute ( * this , * DocumentDelegates ) ;
}
2024-05-08 14:53:53 -04:00
# if WITH_EDITORONLY_DATA
2023-09-05 17:54:02 -04:00
bool FMetaSoundFrontendDocumentBuilder : : TransformTemplateNodes ( )
{
using namespace Metasound : : Frontend ;
METASOUND_TRACE_CPUPROFILER_EVENT_SCOPE ( FMetaSoundFrontendDocumentBuilder : : TransformTemplateNodes ) ;
2023-09-13 20:11:49 -04:00
struct FTemplateTransformParams
{
2024-06-27 18:32:11 -04:00
const Metasound : : Frontend : : INodeTemplate * Template = nullptr ;
2023-09-13 20:11:49 -04:00
TArray < FGuid > NodeIDs ;
} ;
using FTemplateTransformParamsMap = TSortedMap < FGuid , FTemplateTransformParams > ;
2023-09-05 17:54:02 -04:00
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2023-09-05 17:54:02 -04:00
TArray < FMetasoundFrontendClass > & Dependencies = Document . Dependencies ;
2023-09-13 20:11:49 -04:00
FTemplateTransformParamsMap TemplateParams ;
for ( const FMetasoundFrontendClass & Dependency : Dependencies )
2023-09-05 17:54:02 -04:00
{
2023-09-13 20:11:49 -04:00
if ( Dependency . Metadata . GetType ( ) = = EMetasoundFrontendClassType : : Template )
2023-09-05 17:54:02 -04:00
{
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey Key = FNodeRegistryKey ( Dependency . Metadata ) ;
2023-09-05 17:54:02 -04:00
const INodeTemplate * Template = INodeTemplateRegistry : : Get ( ) . FindTemplate ( Key ) ;
2023-09-13 20:11:49 -04:00
ensureMsgf ( Template , TEXT ( " Template not found for template class reference '%s' " ) , * Dependency . Metadata . GetClassName ( ) . ToString ( ) ) ;
TemplateParams . Add ( Dependency . ID , FTemplateTransformParams { Template } ) ;
2023-09-05 17:54:02 -04:00
}
}
2023-09-13 20:11:49 -04:00
if ( TemplateParams . IsEmpty ( ) )
2023-09-05 17:54:02 -04:00
{
2023-09-13 20:11:49 -04:00
return false ;
}
2023-09-05 17:54:02 -04:00
2023-09-13 20:11:49 -04:00
// 1. Execute generated template node transform on copy of node array,
// which allows for addition/removal of nodes to/from original array container
// without template transform having to worry about mutation while iterating
TArray < FGuid > TemplateNodeIDs ;
bool bModified = false ;
2024-06-27 18:32:11 -04:00
Document . RootGraph . IterateGraphPages ( [ this , & Dependencies , & TemplateParams , & bModified ] ( FMetasoundFrontendGraph & Graph )
2023-09-13 20:11:49 -04:00
{
2024-06-27 18:32:11 -04:00
for ( const FMetasoundFrontendNode & Node : Graph . Nodes )
2023-09-13 20:11:49 -04:00
{
2024-06-27 18:32:11 -04:00
if ( FTemplateTransformParams * Params = TemplateParams . Find ( Node . ClassID ) )
2023-09-05 17:54:02 -04:00
{
2024-06-27 18:32:11 -04:00
Params - > NodeIDs . Add ( Node . GetID ( ) ) ;
2023-09-05 17:54:02 -04:00
}
}
2024-06-27 18:32:11 -04:00
for ( TPair < FGuid , FTemplateTransformParams > & Pair : TemplateParams )
{
FTemplateTransformParams & Params = Pair . Value ;
if ( Params . Template )
{
TUniquePtr < INodeTemplateTransform > NodeTransform = Params . Template - > GenerateNodeTransform ( ) ;
check ( NodeTransform . IsValid ( ) ) ;
for ( const FGuid & NodeID : Params . NodeIDs )
{
bModified = true ;
NodeTransform - > Transform ( Graph . PageID , NodeID , * this ) ;
}
}
Params . NodeIDs . Reset ( ) ;
}
} ) ;
// 2. Remove template classes from dependency list
2023-09-13 20:11:49 -04:00
for ( int32 i = Dependencies . Num ( ) - 1 ; i > = 0 ; - - i )
{
const FMetasoundFrontendClass & Class = Dependencies [ i ] ;
if ( TemplateParams . Contains ( Class . ID ) )
{
DocumentDelegates - > OnRemoveSwappingDependency . Broadcast ( i , Dependencies . Num ( ) - 1 ) ;
2024-02-19 16:51:58 -05:00
Dependencies . RemoveAtSwap ( i , EAllowShrinking : : No ) ;
2023-09-13 20:11:49 -04:00
}
}
Dependencies . Shrink ( ) ;
2023-09-05 17:54:02 -04:00
return bModified ;
2023-05-10 20:28:39 -04:00
}
2024-05-08 14:53:53 -04:00
# endif // WITH_EDITORONLY_DATA
2023-05-10 20:28:39 -04:00
- 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
void FMetaSoundFrontendDocumentBuilder : : BeginBuilding ( TSharedPtr < Metasound : : Frontend : : FDocumentModifyDelegates > Delegates , bool bPrimeCache )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
if ( Delegates . IsValid ( ) )
{
DocumentDelegates = Delegates ;
}
else
{
2024-06-18 19:17:25 -04:00
if ( DocumentInterface )
{
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
DocumentDelegates = MakeShared < FDocumentModifyDelegates > ( Document ) ;
}
else
{
DocumentDelegates = MakeShared < FDocumentModifyDelegates > ( ) ;
}
2024-06-18 16:47:21 -04:00
}
- 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
2023-09-22 15:01:07 -04:00
if ( DocumentInterface )
{
DocumentInterface - > OnBeginActiveBuilder ( ) ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
DocumentCache = FDocumentCache : : Create ( Document , DocumentDelegates . ToSharedRef ( ) , BuildPageID , bPrimeCache ) ;
2023-09-22 15:01:07 -04:00
}
}
void FMetaSoundFrontendDocumentBuilder : : FinishBuilding ( )
{
- 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
using namespace Metasound : : Frontend ;
2023-09-22 15:01:07 -04:00
if ( DocumentInterface )
{
DocumentInterface - > OnFinishActiveBuilder ( ) ;
- 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
DocumentInterface = { } ;
2023-09-22 15:01:07 -04:00
}
- 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
DocumentDelegates . Reset ( ) ;
DocumentCache . Reset ( ) ;
2023-09-22 15:01:07 -04:00
}
2023-05-10 20:28:39 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveDependency ( const FGuid & InClassID )
{
using namespace Metasound : : Frontend ;
2024-08-21 18:37:59 -04:00
bool bSuccess = false ;
2023-05-10 20:28:39 -04:00
if ( const int32 * IndexPtr = DocumentCache - > FindDependencyIndex ( InClassID ) )
{
2024-08-21 18:37:59 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2023-05-10 20:28:39 -04:00
TArray < FMetasoundFrontendClass > & Dependencies = Document . Dependencies ;
const int32 Index = * IndexPtr ;
2024-08-21 18:37:59 -04:00
bSuccess = true ;
Document . RootGraph . IterateGraphPages ( [ this , & bSuccess , & InClassID ] ( const FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
TArray < const FMetasoundFrontendNode * > Nodes = NodeCache . FindNodesOfClassID ( InClassID ) ;
for ( const FMetasoundFrontendNode * Node : Nodes )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
bSuccess & = RemoveNode ( Node - > GetID ( ) ) ;
2023-05-10 20:28:39 -04:00
}
2024-08-21 18:37:59 -04:00
} ) ;
2023-05-10 20:28:39 -04:00
2024-06-21 16:42:38 -04:00
RemoveSwapDependencyInternal ( Index ) ;
2023-05-10 20:28:39 -04:00
}
2024-08-21 18:37:59 -04:00
return bSuccess ;
2023-05-10 20:28:39 -04:00
}
2023-03-07 17:01:52 -05:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveDependency ( EMetasoundFrontendClassType ClassType , const FMetasoundFrontendClassName & InClassName , const FMetasoundFrontendVersionNumber & InClassVersionNumber )
{
using namespace Metasound : : Frontend ;
2024-08-21 18:37:59 -04:00
bool bSuccess = false ;
2023-10-12 16:37:45 -04:00
const FNodeRegistryKey ClassKey ( ClassType , InClassName , InClassVersionNumber ) ;
2023-03-07 17:01:52 -05:00
if ( const int32 * IndexPtr = DocumentCache - > FindDependencyIndex ( ClassKey ) )
{
2024-08-21 18:37:59 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2023-05-10 20:28:39 -04:00
TArray < FMetasoundFrontendClass > & Dependencies = Document . Dependencies ;
2023-03-07 17:01:52 -05:00
const int32 Index = * IndexPtr ;
2024-08-21 18:37:59 -04:00
bSuccess = true ;
Document . RootGraph . IterateGraphPages ( [ this , & bSuccess , & Dependencies , & Index ] ( const FMetasoundFrontendGraph & Graph )
2023-03-07 17:01:52 -05:00
{
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
TArray < const FMetasoundFrontendNode * > Nodes = NodeCache . FindNodesOfClassID ( Dependencies [ Index ] . ID ) ;
for ( const FMetasoundFrontendNode * Node : Nodes )
2023-03-07 17:01:52 -05:00
{
2024-08-21 18:37:59 -04:00
bSuccess & = RemoveNode ( Node - > GetID ( ) ) ;
2023-03-07 17:01:52 -05:00
}
2024-08-21 18:37:59 -04:00
} ) ;
2023-03-07 17:01:52 -05:00
2024-06-21 16:42:38 -04:00
RemoveSwapDependencyInternal ( Index ) ;
2023-03-07 17:01:52 -05:00
}
2024-08-21 18:37:59 -04:00
return bSuccess ;
2023-03-07 17:01:52 -05:00
}
2024-06-21 16:42:38 -04:00
void FMetaSoundFrontendDocumentBuilder : : RemoveSwapDependencyInternal ( int32 Index )
{
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TArray < FMetasoundFrontendClass > & Dependencies = Document . Dependencies ;
const int32 LastIndex = Dependencies . Num ( ) - 1 ;
DocumentDelegates - > OnRemoveSwappingDependency . Broadcast ( Index , LastIndex ) ;
Dependencies . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveEdge ( const FMetasoundFrontendEdge & EdgeToRemove , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
2023-03-07 17:01:52 -05:00
TArray < FMetasoundFrontendEdge > & Edges = Graph . Edges ;
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-03-07 17:01:52 -05:00
if ( const int32 * IndexPtr = EdgeCache . FindEdgeIndexToNodeInput ( EdgeToRemove . ToNodeID , EdgeToRemove . ToVertexID ) )
{
const int32 Index = * IndexPtr ;
2024-05-14 20:16:37 -04:00
FMetasoundFrontendEdge & FoundEdge = Edges [ Index ] ;
if ( EdgeToRemove . FromNodeID = = FoundEdge . FromNodeID & & EdgeToRemove . FromVertexID = = FoundEdge . FromVertexID )
{
const int32 LastIndex = Edges . Num ( ) - 1 ;
2024-06-18 16:47:21 -04:00
DocumentDelegates - > FindEdgeDelegatesChecked ( PageID ) . OnRemoveSwappingEdge . Broadcast ( Index , LastIndex ) ;
2024-05-14 20:16:37 -04:00
Edges . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
return true ;
}
2023-03-07 17:01:52 -05:00
}
return false ;
}
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
bool FMetaSoundFrontendDocumentBuilder : : RemoveEdgeStyle ( const FGuid & InNodeID , FName OutputName , const FGuid * InPageID )
{
auto IsEdgeStyle = [ & InNodeID , & OutputName ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle )
{
return EdgeStyle . NodeID = = InNodeID & & EdgeStyle . OutputName = = OutputName ;
} ;
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( PageID ) ;
return Graph . Style . EdgeStyles . RemoveAllSwap ( IsEdgeStyle ) > 0 ;
}
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveNamedEdges ( const TSet < Metasound : : Frontend : : FNamedEdge > & InNamedEdgesToRemove , TArray < FMetasoundFrontendEdge > * OutRemovedEdges , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-03-07 17:01:52 -05:00
if ( OutRemovedEdges )
{
OutRemovedEdges - > Reset ( ) ;
}
bool bSuccess = true ;
TArray < FMetasoundFrontendEdge > EdgesToRemove ;
2023-03-13 17:23:05 -04:00
for ( const FNamedEdge & NamedEdge : InNamedEdgesToRemove )
2023-03-07 17:01:52 -05:00
{
2023-03-13 17:23:05 -04:00
const FMetasoundFrontendVertex * OutputVertex = NodeCache . FindOutputVertex ( NamedEdge . OutputNodeID , NamedEdge . OutputName ) ;
const FMetasoundFrontendVertex * InputVertex = NodeCache . FindInputVertex ( NamedEdge . InputNodeID , NamedEdge . InputName ) ;
2023-03-07 17:01:52 -05:00
if ( OutputVertex & & InputVertex )
{
2023-03-13 17:23:05 -04:00
FMetasoundFrontendEdge NewEdge = { NamedEdge . OutputNodeID , OutputVertex - > VertexID , NamedEdge . InputNodeID , InputVertex - > VertexID } ;
2024-06-18 16:47:21 -04:00
if ( EdgeCache . ContainsEdge ( NewEdge ) )
2023-03-07 17:01:52 -05:00
{
EdgesToRemove . Add ( MoveTemp ( NewEdge ) ) ;
}
else
{
bSuccess = false ;
2023-03-13 17:23:05 -04:00
UE_LOG ( LogMetaSound , Warning , TEXT ( " Failed to remove connection between MetaSound node output '%s' and input '%s': No connection found. " ) , * NamedEdge . OutputName . ToString ( ) , * NamedEdge . InputName . ToString ( ) ) ;
2023-03-07 17:01:52 -05:00
}
}
}
2023-06-26 15:42:30 -04:00
for ( const FMetasoundFrontendEdge & EdgeToRemove : EdgesToRemove )
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
const bool bRemovedEdge = RemoveEdgeToNodeInput ( EdgeToRemove . ToNodeID , EdgeToRemove . ToVertexID , InPageID ) ;
2023-03-07 17:01:52 -05:00
if ( ensureAlwaysMsgf ( bRemovedEdge , TEXT ( " Failed to remove MetaSound graph edge via DocumentBuilder when prior step validated edge remove was valid " ) ) )
{
if ( OutRemovedEdges )
{
OutRemovedEdges - > Add ( EdgeToRemove ) ;
}
}
else
{
bSuccess = false ;
}
}
return bSuccess ;
}
- 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
void FMetaSoundFrontendDocumentBuilder : : Reload ( TSharedPtr < Metasound : : Frontend : : FDocumentModifyDelegates > Delegates , bool bPrimeCache )
{
using namespace Metasound : : Frontend ;
if ( DocumentInterface )
{
DocumentInterface - > OnFinishActiveBuilder ( ) ;
}
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
DocumentDelegates = Delegates . IsValid ( ) ? Delegates : MakeShared < FDocumentModifyDelegates > ( Document ) ;
- 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
if ( DocumentInterface )
{
2024-06-18 16:47:21 -04:00
DocumentCache = FDocumentCache : : Create ( Document , DocumentDelegates . ToSharedRef ( ) , BuildPageID , bPrimeCache ) ;
- 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
DocumentInterface - > OnBeginActiveBuilder ( ) ;
}
}
2024-08-23 21:59:54 -04:00
# if WITH_EDITORONLY_DATA
2024-10-08 18:08:08 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveGraphInputDefault ( FName InputName , const FGuid & InPageID , bool bClearInheritsDefault )
2024-08-23 21:59:54 -04:00
{
using namespace Metasound ;
auto NameMatchesInput = [ & InputName ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = InputName ; } ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TArray < FMetasoundFrontendClassInput > & Inputs = Document . RootGraph . Interface . Inputs ;
const int32 Index = Inputs . IndexOfByPredicate ( NameMatchesInput ) ;
if ( Index ! = INDEX_NONE )
{
FMetasoundFrontendClassInput & Input = Inputs [ Index ] ;
const bool bRemovedDefault = Input . RemoveDefault ( InPageID ) ;
if ( bRemovedDefault )
{
DocumentDelegates - > InterfaceDelegates . OnInputDefaultChanged . Broadcast ( Index ) ;
2024-10-08 18:08:08 -04:00
if ( bClearInheritsDefault )
2024-08-23 21:59:54 -04:00
{
2024-10-08 18:08:08 -04:00
// Set the input as no longer inheriting default for presets
// (No-ops if MetaSound isn't preset or isn't set to inherit default).
2024-08-23 21:59:54 -04:00
constexpr bool bInputInheritsDefault = false ;
2024-10-08 18:08:08 -04:00
SetGraphInputInheritsDefault ( InputName , bInputInheritsDefault ) ;
2024-08-23 21:59:54 -04:00
}
return true ;
}
}
return false ;
}
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveNodeInputDefault ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID )
2023-06-16 17:48:20 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
2023-06-16 17:48:20 -04:00
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
auto IsVertex = [ & InVertexID ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . VertexID = = InVertexID ; } ;
const int32 VertexIndex = Node . Interface . Inputs . IndexOfByPredicate ( IsVertex ) ;
if ( VertexIndex ! = INDEX_NONE )
{
auto IsLiteral = [ & InVertexID ] ( const FMetasoundFrontendVertexLiteral & Literal ) { return Literal . VertexID = = InVertexID ; } ;
const int32 LiteralIndex = Node . InputLiterals . IndexOfByPredicate ( IsLiteral ) ;
if ( LiteralIndex ! = INDEX_NONE )
{
2024-06-18 16:47:21 -04:00
FNodeModifyDelegates & NodeDelegates = DocumentDelegates - > FindNodeDelegatesChecked ( PageID ) ;
const FOnMetaSoundFrontendDocumentMutateNodeInputLiteralArray & OnRemovingNodeInputLiteral = NodeDelegates . OnRemovingNodeInputLiteral ;
2023-06-16 17:48:20 -04:00
const int32 LastIndex = Node . InputLiterals . Num ( ) - 1 ;
OnRemovingNodeInputLiteral . Broadcast ( * NodeIndex , VertexIndex , LastIndex ) ;
if ( LiteralIndex ! = LastIndex )
{
OnRemovingNodeInputLiteral . Broadcast ( * NodeIndex , VertexIndex , LiteralIndex ) ;
}
2024-02-19 16:51:58 -05:00
Node . InputLiterals . RemoveAtSwap ( LiteralIndex , EAllowShrinking : : No ) ;
2023-06-16 17:48:20 -04:00
if ( LiteralIndex ! = LastIndex )
{
2024-06-18 16:47:21 -04:00
const FOnMetaSoundFrontendDocumentMutateNodeInputLiteralArray & OnNodeInputLiteralSet = NodeDelegates . OnNodeInputLiteralSet ;
2023-06-16 17:48:20 -04:00
OnNodeInputLiteralSet . Broadcast ( * NodeIndex , VertexIndex , LiteralIndex ) ;
}
return true ;
}
}
}
return false ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveEdges ( const FGuid & InNodeID , const FGuid * InPageID )
2024-05-14 20:16:37 -04:00
{
using namespace Metasound : : Frontend ;
using namespace Metasound : : VariableNames ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2024-05-14 20:16:37 -04:00
if ( const FMetasoundFrontendNode * Node = NodeCache . FindNode ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2024-05-14 20:16:37 -04:00
for ( const FMetasoundFrontendVertex & Vertex : Node - > Interface . Inputs )
{
2024-06-18 16:47:21 -04:00
RemoveEdgeToNodeInput ( InNodeID , Vertex . VertexID , InPageID ) ;
2024-05-14 20:16:37 -04:00
}
TArray < FMetasoundFrontendVertexHandle > ToVertexHandles ;
for ( const FMetasoundFrontendVertex & Vertex : Node - > Interface . Outputs )
{
2024-06-18 16:47:21 -04:00
RemoveEdgesFromNodeOutput ( InNodeID , Vertex . VertexID , InPageID ) ;
2024-05-14 20:16:37 -04:00
}
return true ;
}
return false ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveEdgesByNodeClassInterfaceBindings ( const FGuid & InFromNodeID , const FGuid & InToNodeID , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2023-10-19 17:47:21 -04:00
TSet < FMetasoundFrontendVersion > FromInterfaceVersions ;
TSet < FMetasoundFrontendVersion > ToInterfaceVersions ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
if ( FindNodeClassInterfaces ( InFromNodeID , FromInterfaceVersions , PageID ) & & FindNodeClassInterfaces ( InToNodeID , ToInterfaceVersions , PageID ) )
2023-03-07 17:01:52 -05:00
{
2023-03-13 17:23:05 -04:00
TSet < FNamedEdge > NamedEdges ;
2023-10-19 17:47:21 -04:00
if ( DocumentBuilderPrivate : : TryGetInterfaceBoundEdges ( InFromNodeID , FromInterfaceVersions , InToNodeID , ToInterfaceVersions , NamedEdges ) )
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
constexpr TArray < FMetasoundFrontendEdge > * RemovedEdges = nullptr ;
return RemoveNamedEdges ( NamedEdges , RemovedEdges , InPageID ) ;
2023-03-07 17:01:52 -05:00
}
}
2023-03-13 17:23:05 -04:00
return false ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveEdgesFromNodeOutput ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-09-05 17:54:02 -04:00
const TArrayView < const int32 > Indices = EdgeCache . FindEdgeIndicesFromNodeOutput ( InNodeID , InVertexID ) ;
if ( ! Indices . IsEmpty ( ) )
2023-03-07 17:01:52 -05:00
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
2023-09-05 17:54:02 -04:00
// Copy off indices and sort descending as the edge array will be modified when notifying the cache in the loop below
TArray < int32 > IndicesCopy ( Indices . GetData ( ) , Indices . Num ( ) ) ;
Algo : : Sort ( IndicesCopy , [ ] ( const int32 & L , const int32 & R ) { return L > R ; } ) ;
2024-06-18 16:47:21 -04:00
FEdgeModifyDelegates & EdgeDelegates = DocumentDelegates - > FindEdgeDelegatesChecked ( PageID ) ;
2023-03-07 17:01:52 -05:00
for ( int32 Index : IndicesCopy )
{
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
if ( const FMetasoundFrontendVertex * Vertex = FindNodeOutput ( InNodeID , InVertexID ) )
{
auto IsEdgeStyle = [ & InNodeID , OutputName = Vertex - > Name ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle )
{
return EdgeStyle . NodeID = = InNodeID & & EdgeStyle . OutputName = = OutputName ;
} ;
Graph . Style . EdgeStyles . RemoveAllSwap ( IsEdgeStyle ) ;
}
# endif // WITH_EDITORONLY_DATA
2023-03-07 17:01:52 -05:00
const int32 LastIndex = Graph . Edges . Num ( ) - 1 ;
2024-06-18 16:47:21 -04:00
EdgeDelegates . OnRemoveSwappingEdge . Broadcast ( Index , LastIndex ) ;
2024-02-19 16:51:58 -05:00
Graph . Edges . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
2023-03-07 17:01:52 -05:00
}
return true ;
}
return false ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveEdgeToNodeInput ( const FGuid & InNodeID , const FGuid & InVertexID , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-03-07 17:01:52 -05:00
if ( const int32 * IndexPtr = EdgeCache . FindEdgeIndexToNodeInput ( InNodeID , InVertexID ) )
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
2023-03-07 17:01:52 -05:00
const int32 Index = * IndexPtr ; // Copy off indices as the pointer may be modified when notifying the cache below
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
if ( const FMetasoundFrontendVertex * Vertex = FindNodeOutput ( InNodeID , Graph . Edges [ Index ] . FromVertexID ) )
{
auto IsEdgeStyle = [ & InNodeID , OutputName = Vertex - > Name ] ( const FMetasoundFrontendEdgeStyle & EdgeStyle )
{
return EdgeStyle . NodeID = = InNodeID & & EdgeStyle . OutputName = = OutputName ;
} ;
Graph . Style . EdgeStyles . RemoveAllSwap ( IsEdgeStyle ) ;
}
# endif // WITH_EDITORONLY_DATA
const FEdgeModifyDelegates & EdgeDelegates = DocumentDelegates - > FindEdgeDelegatesChecked ( PageID ) ;
2023-03-07 17:01:52 -05:00
const int32 LastIndex = Graph . Edges . Num ( ) - 1 ;
2024-06-18 16:47:21 -04:00
EdgeDelegates . OnRemoveSwappingEdge . Broadcast ( Index , LastIndex ) ;
2024-02-19 16:51:58 -05:00
Graph . Edges . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
2023-03-07 17:01:52 -05:00
- 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
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
GetDocumentChecked ( ) . Metadata . ModifyContext . AddNodeIDModified ( InNodeID ) ;
- 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
# endif // WITH_EDITORONLY_DATA
2023-03-07 17:01:52 -05:00
return true ;
}
return false ;
}
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveGraphComment ( const FGuid & InCommentID , const FGuid * InPageID )
2024-01-31 15:02:39 -05:00
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( InPageID ? * InPageID : BuildPageID ) ;
if ( Graph . Style . Comments . Remove ( InCommentID ) > 0 )
- 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
{
Document . Metadata . ModifyContext . SetDocumentModified ( ) ;
return true ;
}
return false ;
2024-01-31 15:02:39 -05:00
}
2024-09-16 15:56:55 -04:00
# endif // WITH_EDITORONLY_DATA
2024-01-31 15:02:39 -05:00
- 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
bool FMetaSoundFrontendDocumentBuilder : : RemoveGraphInput ( FName InInputName )
{
using namespace Metasound : : Frontend ;
2024-05-29 15:33:29 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
- 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
if ( const int32 * IndexPtr = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( InInputName ) )
{
2024-05-29 15:33:29 -04:00
TArray < FMetasoundFrontendClassInput > & Inputs = Document . RootGraph . Interface . Inputs ;
- 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
const FGuid NodeID = Inputs [ * IndexPtr ] . NodeID ;
FGuid ClassID ;
bool bNodesRemoved = true ;
2024-06-18 16:47:21 -04:00
Document . RootGraph . IterateGraphPages ( [ this , & Document , & ClassID , & NodeID , & InInputName , & bNodesRemoved ] ( const FMetasoundFrontendGraph & Graph )
- 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
{
2024-06-18 16:47:21 -04:00
TArray < FGuid > NodeIDsToRemove { NodeID } ;
if ( const FMetasoundFrontendNode * Node = FindNode ( NodeID , & Graph . PageID ) )
- 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
{
2024-06-18 16:47:21 -04:00
ClassID = Node - > ClassID ;
- 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
}
else
{
bNodesRemoved = false ;
2024-06-18 16:47:21 -04:00
return ;
- 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
}
2024-06-18 16:47:21 -04:00
const TArray < const FMetasoundFrontendNode * > TemplateNodes = GetGraphInputTemplateNodes ( InInputName , & Graph . PageID ) ;
Algo : : Transform ( TemplateNodes , NodeIDsToRemove , [ ] ( const FMetasoundFrontendNode * Node ) { return Node - > GetID ( ) ; } ) ;
for ( const FGuid & ToRemove : NodeIDsToRemove )
{
if ( RemoveNode ( ToRemove , & Graph . PageID ) )
{
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddNodeIDModified ( ToRemove ) ;
# endif // WITH_EDITORONLY_DATA
}
else
{
bNodesRemoved = 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
if ( bNodesRemoved )
{
const int32 Index = * IndexPtr ;
DocumentDelegates - > InterfaceDelegates . OnRemovingInput . Broadcast ( Index ) ;
const int32 LastIndex = Inputs . Num ( ) - 1 ;
if ( Index ! = LastIndex )
{
DocumentDelegates - > InterfaceDelegates . OnRemovingInput . Broadcast ( LastIndex ) ;
}
Inputs . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
if ( Index ! = LastIndex )
{
DocumentDelegates - > InterfaceDelegates . OnInputAdded . Broadcast ( Index ) ;
}
# if WITH_EDITORONLY_DATA
ClearMemberMetadata ( NodeID ) ;
Document . Metadata . ModifyContext . AddMemberIDModified ( NodeID ) ;
# endif // WITH_EDITORONLY_DATA
const bool bDependencyReferenced = IsDependencyReferenced ( ClassID ) ;
if ( bDependencyReferenced | | RemoveDependency ( ClassID ) )
{
return true ;
}
}
}
2023-05-10 20:28:39 -04:00
return false ;
}
bool FMetaSoundFrontendDocumentBuilder : : RemoveGraphOutput ( FName InOutputName )
{
2024-06-18 16:47:21 -04:00
bool bNodesRemoved = true ;
FGuid ClassID ;
FGuid NodeID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
Document . RootGraph . IterateGraphPages ( [ this , & InOutputName , & Document , & ClassID , & NodeID , & bNodesRemoved ] ( const FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-06-18 16:47:21 -04:00
if ( const FMetasoundFrontendNode * Node = FindGraphOutputNode ( InOutputName , & Graph . PageID ) )
2023-05-10 20:28:39 -04:00
{
2024-06-18 16:47:21 -04:00
ClassID = Node - > ClassID ;
NodeID = Node - > GetID ( ) ;
if ( ! RemoveNode ( NodeID , & Graph . PageID ) )
{
bNodesRemoved = false ;
return ;
}
- 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
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddNodeIDModified ( NodeID ) ;
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
}
} ) ;
- 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
2024-06-18 16:47:21 -04:00
if ( bNodesRemoved )
{
TArray < FMetasoundFrontendClassOutput > & Outputs = Document . RootGraph . Interface . Outputs ;
auto OutputNameMatches = [ InOutputName ] ( const FMetasoundFrontendClassOutput & Output ) { return Output . Name = = InOutputName ; } ;
const int32 Index = Outputs . IndexOfByPredicate ( OutputNameMatches ) ;
if ( Index ! = INDEX_NONE )
{
DocumentDelegates - > InterfaceDelegates . OnRemovingOutput . Broadcast ( Index ) ;
const int32 LastIndex = Outputs . Num ( ) - 1 ;
if ( Index ! = LastIndex )
2023-05-10 20:28:39 -04:00
{
2024-06-18 16:47:21 -04:00
DocumentDelegates - > InterfaceDelegates . OnRemovingOutput . Broadcast ( LastIndex ) ;
}
Outputs . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
if ( Index ! = LastIndex )
{
DocumentDelegates - > InterfaceDelegates . OnOutputAdded . Broadcast ( Index ) ;
}
2023-06-27 19:07:35 -04:00
- 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
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
ClearMemberMetadata ( NodeID ) ;
Document . Metadata . ModifyContext . AddMemberIDModified ( NodeID ) ;
- 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
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
const bool bDependencyReferenced = IsDependencyReferenced ( ClassID ) ;
if ( bDependencyReferenced | | RemoveDependency ( ClassID ) )
{
return true ;
2023-05-10 20:28:39 -04:00
}
}
}
return false ;
}
2024-07-15 13:25:53 -04:00
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveGraphPage ( const FGuid & InPageID )
{
using namespace Metasound : : Frontend ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FGuid AdjacentPageID ;
if ( Document . RootGraph . ContainsGraphPage ( InPageID ) )
{
DocumentDelegates - > RemovePageDelegates ( InPageID ) ;
}
const bool bPageRemoved = Document . RootGraph . RemoveGraphPage ( InPageID , & AdjacentPageID ) ;
if ( bPageRemoved )
{
if ( InPageID = = BuildPageID )
{
ensureAlwaysMsgf ( SetBuildPageID ( AdjacentPageID ) , TEXT ( " AdjacentPageID returned is always expected to be valid " ) ) ;
}
}
return bPageRemoved ;
}
2024-07-15 13:25:53 -04:00
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
2023-03-07 17:01:52 -05:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveInterface ( FName InterfaceName )
{
using namespace Metasound : : Frontend ;
FMetasoundFrontendInterface Interface ;
if ( ISearchEngine : : Get ( ) . FindInterfaceWithHighestVersion ( InterfaceName , Interface ) )
{
2024-05-29 15:33:29 -04:00
if ( ! GetDocumentChecked ( ) . Interfaces . Contains ( Interface . Version ) )
2023-03-07 17:01:52 -05:00
{
2023-04-04 19:14:26 -04:00
UE_LOG ( LogMetaSound , VeryVerbose , TEXT ( " MetaSound interface '%s' not found on document. MetaSoundBuilder skipping remove request. " ) , * InterfaceName . ToString ( ) ) ;
2023-03-07 17:01:52 -05:00
return true ;
}
2023-05-10 20:28:39 -04:00
const FTopLevelAssetPath BuilderClassPath = GetBuilderClassPath ( ) ;
2023-04-04 19:14:26 -04:00
const FInterfaceRegistryKey Key = GetInterfaceRegistryKey ( Interface . Version ) ;
if ( const IInterfaceRegistryEntry * Entry = IInterfaceRegistry : : Get ( ) . FindInterfaceRegistryEntry ( Key ) )
{
2023-04-06 16:32:00 -04:00
const FMetasoundFrontendInterfaceUClassOptions * ClassOptions = Entry - > GetInterface ( ) . FindClassOptions ( BuilderClassPath ) ;
2023-04-04 19:14:26 -04:00
if ( ClassOptions & & ! ClassOptions - > bIsModifiable )
{
2023-04-06 16:32:00 -04:00
UE_LOG ( LogMetaSound , Error , TEXT ( " DocumentBuilder failed to remove MetaSound Interface '%s' to document: is not set to be modifiable for given UClass '%s' " ) , * InterfaceName . ToString ( ) , * BuilderClassPath . ToString ( ) ) ;
2023-04-04 19:14:26 -04:00
return false ;
}
2023-06-16 17:48:20 -04:00
TArray < FMetasoundFrontendInterface > InterfacesToRemove ;
InterfacesToRemove . Add ( Entry - > GetInterface ( ) ) ;
FModifyInterfaceOptions Options ( MoveTemp ( InterfacesToRemove ) , { } ) ;
return ModifyInterfaces ( MoveTemp ( Options ) ) ;
2023-03-07 17:01:52 -05:00
}
}
return false ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveNode ( const FGuid & InNodeID , const FGuid * InPageID )
2023-03-07 17:01:52 -05:00
{
METASOUND_TRACE_CPUPROFILER_EVENT_SCOPE ( FMetaSoundFrontendDocumentBuilder : : RemoveNode ) ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( PageID ) ;
2023-03-07 17:01:52 -05:00
if ( const int32 * IndexPtr = NodeCache . FindNodeIndex ( InNodeID ) )
{
const int32 Index = * IndexPtr ; // Copy off indices as the pointer may be modified when notifying the cache below
2023-06-16 17:48:20 -04:00
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
2023-06-16 17:48:20 -04:00
TArray < FMetasoundFrontendNode > & Nodes = Graph . Nodes ;
2023-03-07 17:01:52 -05:00
const FMetasoundFrontendNode & Node = Nodes [ Index ] ;
- 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
const FGuid & NodeID = Node . GetID ( ) ;
2023-03-07 17:01:52 -05:00
- 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
const FMetasoundFrontendClass * NodeClass = DocumentCache - > FindDependency ( Node . ClassID ) ;
check ( NodeClass ) ;
2024-05-14 20:16:37 -04:00
const EMetasoundFrontendClassType ClassType = NodeClass - > Metadata . GetType ( ) ;
switch ( ClassType )
- 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
{
2024-05-14 20:16:37 -04:00
case EMetasoundFrontendClassType : : Variable :
case EMetasoundFrontendClassType : : VariableDeferredAccessor :
case EMetasoundFrontendClassType : : VariableAccessor :
case EMetasoundFrontendClassType : : VariableMutator :
{
2024-06-18 16:47:21 -04:00
const bool bVariableNodeUnlinked = UnlinkVariableNode ( NodeID , PageID ) ;
2024-05-14 20:16:37 -04:00
ensureAlwaysMsgf ( bVariableNodeUnlinked , TEXT ( " Failed to unlink %s node with ID '%s " ) , LexToString ( ClassType ) , * InNodeID . ToString ( ) ) ;
}
break ;
2023-03-07 17:01:52 -05:00
}
2024-06-18 16:47:21 -04:00
RemoveEdges ( NodeID , InPageID ) ;
2023-03-07 17:01:52 -05:00
const int32 LastIndex = Nodes . Num ( ) - 1 ;
2024-06-18 16:47:21 -04:00
FNodeModifyDelegates & NodeDelegates = DocumentDelegates - > FindNodeDelegatesChecked ( PageID ) ;
NodeDelegates . OnRemoveSwappingNode . Broadcast ( Index , LastIndex ) ;
2024-02-19 16:51:58 -05:00
Nodes . RemoveAtSwap ( Index , EAllowShrinking : : No ) ;
2023-03-07 17:01:52 -05:00
2023-05-10 20:28:39 -04:00
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
GetDocumentChecked ( ) . Metadata . ModifyContext . AddNodeIDModified ( InNodeID ) ;
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITORONLY_DATA
2023-03-07 17:01:52 -05:00
return true ;
}
return false ;
}
2024-09-16 15:56:55 -04:00
# if WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
int32 FMetaSoundFrontendDocumentBuilder : : RemoveNodeLocation ( const FGuid & InNodeID , const FGuid * InLocationGuid , const FGuid * InPageID )
2024-01-31 15:02:39 -05:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2024-01-31 15:02:39 -05:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
2024-01-31 15:02:39 -05:00
FMetasoundFrontendNodeStyle & Style = Node . Style ;
if ( InLocationGuid )
{
return Style . Display . Locations . Remove ( * InLocationGuid ) ;
}
else
{
const int32 NumLocationsRemoved = Style . Display . Locations . Num ( ) ;
Style . Display . Locations . Reset ( ) ;
return NumLocationsRemoved ;
}
}
return 0 ;
}
2024-09-16 15:56:55 -04:00
# endif // WITH_EDITORONLY_DATA
2024-01-31 15:02:39 -05:00
2024-05-29 15:33:29 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RemoveUnusedDependencies ( )
{
bool bDidEdit = false ;
2024-06-21 16:42:38 -04:00
const FMetasoundFrontendDocument & Document = GetConstDocumentChecked ( ) ;
const FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
const TArray < FMetasoundFrontendClass > & Dependencies = Document . Dependencies ;
for ( int32 Index = Dependencies . Num ( ) - 1 ; Index > = 0 ; - - Index )
2024-05-29 15:33:29 -04:00
{
2024-06-21 16:42:38 -04:00
const FGuid & ClassID = Dependencies [ Index ] . ID ;
const bool bIsReferenced = IsDependencyReferenced ( ClassID ) ;
if ( ! bIsReferenced )
2024-05-29 15:33:29 -04:00
{
2024-06-21 16:42:38 -04:00
RemoveSwapDependencyInternal ( Index ) ;
bDidEdit = true ;
2024-05-29 15:33:29 -04:00
}
}
return bDidEdit ;
}
2023-06-28 17:08:29 -04:00
bool FMetaSoundFrontendDocumentBuilder : : RenameRootGraphClass ( const FMetasoundFrontendClassName & InName )
{
2024-05-08 14:53:53 -04:00
return false ;
2023-06-28 17:08:29 -04:00
}
2023-07-24 17:38:26 -04:00
void FMetaSoundFrontendDocumentBuilder : : ReloadCache ( )
{
- 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
using namespace Metasound : : Frontend ;
Reload ( DocumentDelegates , true ) ;
2023-07-24 17:38:26 -04:00
}
2024-08-19 17:06:23 -04:00
# if WITH_EDITORONLY_DATA
bool FMetaSoundFrontendDocumentBuilder : : ResetGraphInputDefault ( FName InputName )
{
using namespace Metasound ;
auto NameMatchesInput = [ & InputName ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = InputName ; } ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TArray < FMetasoundFrontendClassInput > & Inputs = Document . RootGraph . Interface . Inputs ;
const int32 Index = Inputs . IndexOfByPredicate ( NameMatchesInput ) ;
if ( Index ! = INDEX_NONE )
{
FMetasoundFrontendClassInput & Input = Inputs [ Index ] ;
Input . ResetDefaults ( ) ;
DocumentDelegates - > InterfaceDelegates . OnInputDefaultChanged . Broadcast ( Index ) ;
// Set the input as inheriting default for presets
2024-10-08 18:08:08 -04:00
// (No-ops if MetaSound isn't preset or is already set to inherit default).
constexpr bool bInputInheritsDefault = true ;
SetGraphInputInheritsDefault ( InputName , bInputInheritsDefault ) ;
2024-08-19 17:06:23 -04:00
Document . Metadata . ModifyContext . AddMemberIDModified ( Input . NodeID ) ;
return true ;
}
return false ;
}
void FMetaSoundFrontendDocumentBuilder : : ResetGraphPages ( bool bClearDefaultGraph )
{
using namespace Metasound ;
FMetasoundFrontendGraphClass & RootGraph = GetDocumentChecked ( ) . RootGraph ;
RootGraph . IterateGraphPages ( [ this ] ( FMetasoundFrontendGraph & Graph )
{
if ( Graph . PageID ! = Frontend : : DefaultPageID )
{
DocumentDelegates - > PageDelegates . OnRemovingPage . Broadcast ( Frontend : : FDocumentMutatePageArgs { Graph . PageID } ) ;
}
} ) ;
RootGraph . ResetGraphPages ( bClearDefaultGraph ) ;
SetBuildPageID ( Frontend : : DefaultPageID ) ;
}
# endif // WITH_EDITORONLY_DATA
2023-09-14 16:54:36 -04:00
# if WITH_EDITOR
2023-03-07 17:01:52 -05:00
void FMetaSoundFrontendDocumentBuilder : : SetAuthor ( const FString & InAuthor )
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendClassMetadata & ClassMetadata = GetDocumentChecked ( ) . RootGraph . Metadata ;
2023-03-07 17:01:52 -05:00
ClassMetadata . SetAuthor ( InAuthor ) ;
}
# endif // WITH_EDITOR
2024-07-15 13:25:53 -04:00
# if WITH_EDITORONLY_DATA
2024-08-30 12:53:13 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetBuildPageID ( const FGuid & InBuildPageID , bool bBroadcastDelegate )
2024-05-29 15:33:29 -04:00
{
using namespace Metasound : : Frontend ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
if ( const FMetasoundFrontendGraph * BuildGraph = Document . RootGraph . FindConstGraph ( InBuildPageID ) )
{
if ( BuildPageID ! = BuildGraph - > PageID )
{
BuildPageID = BuildGraph - > PageID ;
constexpr bool bPrimeCache = false ;
2024-06-14 14:41:30 -04:00
DocumentCache - > SetBuildPageID ( BuildPageID ) ;
2024-08-30 12:53:13 -04:00
if ( bBroadcastDelegate )
{
DocumentDelegates - > PageDelegates . OnPageSet . Broadcast ( { BuildPageID } ) ;
}
2024-05-29 15:33:29 -04:00
}
return true ;
}
return false ;
}
2024-08-20 03:27:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputAdvancedDisplay ( const FName InputName , const bool InAdvancedDisplay )
{
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
if ( const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( InputName ) )
{
2024-09-17 15:37:28 -04:00
FMetasoundFrontendClassInput & GraphInput = RootGraph . Interface . Inputs [ * Index ] ;
2024-08-20 03:27:21 -04:00
if ( GraphInput . Metadata . bIsAdvancedDisplay ! = InAdvancedDisplay )
{
GraphInput . Metadata . SetIsAdvancedDisplay ( InAdvancedDisplay ) ;
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphInput . VertexID ) ;
return true ;
}
}
return false ;
}
2024-07-15 13:25:53 -04:00
# endif // WITH_EDITORONLY_DATA
2024-05-29 15:33:29 -04:00
- 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
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputAccessType ( FName InputName , EMetasoundFrontendVertexAccessType AccessType )
{
using namespace Metasound : : Frontend ;
if ( ! ensureMsgf ( AccessType ! = EMetasoundFrontendVertexAccessType : : Unset , TEXT ( " Cannot set graph input access type to '%s' " ) , LexToString ( AccessType ) ) )
{
return false ;
}
2024-07-17 18:43:11 -04:00
const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( InputName ) ;
if ( ! Index )
- 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
{
2024-07-17 18:43:11 -04:00
return 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
2024-07-17 18:43:11 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
FMetasoundFrontendClassInput & GraphInput = RootGraph . Interface . Inputs [ * Index ] ;
2024-06-10 15:00:26 -04:00
2024-07-17 18:43:11 -04:00
if ( GraphInput . AccessType ! = AccessType )
{
2024-06-10 15:00:26 -04:00
GraphInput . AccessType = AccessType ;
if ( AccessType = = EMetasoundFrontendVertexAccessType : : Reference )
{
2024-06-18 16:47:21 -04:00
RootGraph . IterateGraphPages ( [ this , & GraphInput , & AccessType ] ( FMetasoundFrontendGraph & Graph )
- 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
{
2024-06-18 16:47:21 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( GraphInput . NodeID ) )
- 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
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
const FMetasoundFrontendVertex & NodeOutput = Node . Interface . Outputs . Last ( ) ;
IterateNodesConnectedWithVertex ( { GraphInput . NodeID , NodeOutput . VertexID } , [ this , & Graph , & AccessType ] ( const FMetasoundFrontendEdge & Edge , FMetasoundFrontendNode & ConnectedNode )
- 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
{
2024-06-18 16:47:21 -04:00
if ( const FMetasoundFrontendClass * ConnectedNodeClass = FindDependency ( ConnectedNode . ClassID ) )
- 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
{
2024-06-18 16:47:21 -04:00
// If connected to an input template node, disconnect the template node from other nodes as the data type is
// about to be mismatched. Otherwise, direct connection to other nodes (i.e. at runtime when template
// nodes aren't injected) forcefully remove to avoid data type mismatch.
if ( ConnectedNodeClass - > Metadata . GetClassName ( ) = = FInputNodeTemplate : : ClassName )
- 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
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex & ConnectedNodeOutput = ConnectedNode . Interface . Outputs . Last ( ) ;
IterateNodesConnectedWithVertex ( { Edge . ToNodeID , ConnectedNodeOutput . VertexID } , [ this , & Graph , & AccessType ] ( const FMetasoundFrontendEdge & TempEdge , FMetasoundFrontendNode & )
{
const EMetasoundFrontendVertexAccessType ConnectedAccessType = GetNodeInputAccessType ( TempEdge . ToNodeID , TempEdge . ToVertexID , & Graph . PageID ) ;
if ( ! FMetasoundFrontendClassVertex : : CanConnectVertexAccessTypes ( AccessType , ConnectedAccessType ) )
{
RemoveEdgeToNodeInput ( TempEdge . ToNodeID , TempEdge . ToVertexID , & Graph . PageID ) ;
}
} , Graph . PageID ) ;
}
else
{
const EMetasoundFrontendVertexAccessType ConnectedAccessType = GetNodeInputAccessType ( Edge . ToNodeID , Edge . ToVertexID , & Graph . PageID ) ;
- 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
if ( ! FMetasoundFrontendClassVertex : : CanConnectVertexAccessTypes ( AccessType , ConnectedAccessType ) )
{
2024-06-18 16:47:21 -04:00
RemoveEdgeToNodeInput ( Edge . ToNodeID , Edge . ToVertexID , & Graph . PageID ) ;
- 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
}
}
}
2024-06-18 16:47:21 -04:00
} , Graph . PageID ) ;
}
} ) ;
- 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
const bool bNodeConformed = ConformGraphInputNodeToClass ( GraphInput ) ;
2024-07-17 18:43:11 -04:00
if ( ! bNodeConformed )
- 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
{
2024-07-17 18:43:11 -04:00
return 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
}
2024-07-17 18:43:11 -04:00
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphInput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
- 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
}
}
2024-07-17 18:43:11 -04:00
return true ;
- 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
}
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputDataType ( FName InputName , FName DataType )
{
2024-07-26 14:23:35 -04:00
using namespace Metasound ;
- 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
2024-07-26 14:23:35 -04:00
if ( Frontend : : IDataTypeRegistry : : Get ( ) . IsRegistered ( DataType ) )
- 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
{
2024-07-17 18:43:11 -04:00
const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( InputName ) ;
if ( ! Index )
- 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
{
2024-07-17 18:43:11 -04:00
return 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
2024-07-17 18:43:11 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
FMetasoundFrontendClassInput & GraphInput = RootGraph . Interface . Inputs [ * Index ] ;
if ( GraphInput . TypeName ! = DataType )
{
2024-06-10 15:00:26 -04:00
GraphInput . TypeName = DataType ;
2024-08-19 17:06:23 -04:00
GraphInput . ResetDefaults ( ) ;
2024-06-10 15:00:26 -04:00
2024-06-18 16:47:21 -04:00
RootGraph . IterateGraphPages ( [ this , & DataType , & GraphInput ] ( FMetasoundFrontendGraph & Graph )
2024-06-10 15:00:26 -04:00
{
2024-08-21 18:37:59 -04:00
const Frontend : : IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
2024-06-18 16:47:21 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( GraphInput . NodeID ) )
- 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
{
2024-06-18 16:47:21 -04:00
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
FMetasoundFrontendVertex & NodeOutput = Node . Interface . Outputs . Last ( ) ;
IterateNodesConnectedWithVertex ( { GraphInput . NodeID , NodeOutput . VertexID } , [ this , & Graph , & DataType ] ( const FMetasoundFrontendEdge & Edge , FMetasoundFrontendNode & ConnectedNode )
- 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
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendClass * ConnectedNodeClass = FindDependency ( ConnectedNode . ClassID ) ;
if ( ensure ( ConnectedNodeClass ) )
- 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
{
2024-06-18 16:47:21 -04:00
// If connected to an input template node, disconnect the template node from other nodes as the data type is
// about to be mismatched. Otherwise, direct connection to other nodes (i.e. at runtime when template
// nodes aren't injected) forcefully remove to avoid data type mismatch.
2024-07-26 14:23:35 -04:00
if ( ConnectedNodeClass - > Metadata . GetClassName ( ) = = Frontend : : FInputNodeTemplate : : ClassName )
2024-06-18 16:47:21 -04:00
{
RemoveEdgesFromNodeOutput ( Edge . ToNodeID , ConnectedNode . Interface . Outputs . Last ( ) . VertexID , & Graph . PageID ) ;
ConnectedNode . Interface . Inputs . Last ( ) . TypeName = DataType ;
ConnectedNode . Interface . Outputs . Last ( ) . TypeName = DataType ;
}
else
{
RemoveEdgeToNodeInput ( Edge . ToNodeID , Edge . ToVertexID , & Graph . PageID ) ;
}
- 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
}
2024-06-18 16:47:21 -04:00
} , Graph . PageID ) ;
}
} ) ;
- 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
2024-06-10 15:00:26 -04:00
const bool bNodeConformed = ConformGraphInputNodeToClass ( GraphInput ) ;
2024-07-17 18:43:11 -04:00
if ( ! bNodeConformed )
2024-06-10 15:00:26 -04:00
{
2024-07-17 18:43:11 -04:00
return false ;
}
RemoveUnusedDependencies ( ) ;
- 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
# if WITH_EDITORONLY_DATA
2024-07-17 18:43:11 -04:00
ClearMemberMetadata ( GraphInput . NodeID ) ;
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphInput . NodeID ) ;
Document . Metadata . ModifyContext . AddNodeIDModified ( GraphInput . NodeID ) ;
- 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
# endif // WITH_EDITORONLY_DATA
}
}
2024-07-17 18:43:11 -04:00
return true ;
- 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
}
2024-08-19 17:06:23 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputDefault ( FName InputName , FMetasoundFrontendLiteral InDefaultLiteral , const FGuid * InPageID )
2023-05-30 14:39:48 -04:00
{
2024-07-26 14:23:35 -04:00
using namespace Metasound ;
2023-05-30 14:39:48 -04:00
auto NameMatchesInput = [ & InputName ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = InputName ; } ;
2024-08-19 17:06:23 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TArray < FMetasoundFrontendClassInput > & Inputs = Document . RootGraph . Interface . Inputs ;
2023-10-31 17:16:11 -04:00
const int32 Index = Inputs . IndexOfByPredicate ( NameMatchesInput ) ;
if ( Index ! = INDEX_NONE )
2023-05-30 14:39:48 -04:00
{
2023-10-31 17:16:11 -04:00
FMetasoundFrontendClassInput & Input = Inputs [ Index ] ;
2024-07-26 14:23:35 -04:00
if ( Frontend : : IDataTypeRegistry : : Get ( ) . IsLiteralTypeSupported ( Input . TypeName , InDefaultLiteral . GetType ( ) ) )
2023-05-30 14:39:48 -04:00
{
2024-08-19 17:06:23 -04:00
const FGuid PageID = InPageID ? * InPageID : Frontend : : DefaultPageID ;
bool bFound = false ;
Input . IterateDefaults ( [ & bFound , & PageID , & InDefaultLiteral ] ( const FGuid & InputPageID , FMetasoundFrontendLiteral & InputLiteral )
{
if ( ! bFound & & InputPageID = = PageID )
{
bFound = true ;
InputLiteral = MoveTemp ( InDefaultLiteral ) ;
}
} ) ;
if ( ! bFound )
{
Input . AddDefault ( PageID ) = MoveTemp ( InDefaultLiteral ) ;
}
2023-10-31 17:16:11 -04:00
DocumentDelegates - > InterfaceDelegates . OnInputDefaultChanged . Broadcast ( Index ) ;
2023-05-30 14:39:48 -04:00
2024-10-08 18:08:08 -04:00
// Set the input as inheriting default for presets
// (No-ops if MetaSound isn't preset or is already set to inherit default).
constexpr bool bInputInheritsDefault = false ;
SetGraphInputInheritsDefault ( InputName , bInputInheritsDefault ) ;
2023-10-31 17:16:11 -04:00
2023-05-30 14:39:48 -04:00
return true ;
}
2023-10-31 17:16:11 -04:00
UE_LOG ( LogMetaSound , Error , TEXT ( " Attempting to set graph input of type '%s' with unsupported literal type " ) , * Input . TypeName . ToString ( ) ) ;
2023-05-30 14:39:48 -04:00
}
return false ;
}
2024-08-19 17:06:23 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputDefaults ( FName InputName , TArray < FMetasoundFrontendClassInputDefault > Defaults )
{
using namespace Metasound ;
auto NameMatchesInput = [ & InputName ] ( const FMetasoundFrontendClassInput & Input ) { return Input . Name = = InputName ; } ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
TArray < FMetasoundFrontendClassInput > & Inputs = Document . RootGraph . Interface . Inputs ;
const int32 Index = Inputs . IndexOfByPredicate ( NameMatchesInput ) ;
if ( Index ! = INDEX_NONE )
{
FMetasoundFrontendClassInput & Input = Inputs [ Index ] ;
TSet < FGuid > ValidPageIDs ;
bool bAllSupported = Algo : : AllOf ( Defaults , [ & Input ] ( const FMetasoundFrontendClassInputDefault & Default )
{
return Frontend : : IDataTypeRegistry : : Get ( ) . IsLiteralTypeSupported ( Input . TypeName , Default . Literal . GetType ( ) ) ;
} ) ;
if ( bAllSupported )
{
Input . SetDefaults ( MoveTemp ( Defaults ) ) ;
DocumentDelegates - > InterfaceDelegates . OnInputDefaultChanged . Broadcast ( Index ) ;
// Set the input as no longer inheriting default for presets
2024-10-08 18:08:08 -04:00
// (No-ops if MetaSound isn't preset or isn't set to inherit default).
constexpr bool bInputInheritsDefault = false ;
SetGraphInputInheritsDefault ( InputName , bInputInheritsDefault ) ;
2024-08-19 17:06:23 -04:00
return true ;
}
UE_LOG ( LogMetaSound , Error , TEXT ( " Attempting to set graph input of type '%s' with unsupported literal type(s) " ) , * Input . TypeName . ToString ( ) ) ;
}
return false ;
}
2024-08-20 03:27:21 -04:00
# if WITH_EDITORONLY_DATA
bool FMetaSoundFrontendDocumentBuilder : : SetGraphOutputAdvancedDisplay ( const FName OutputName , const bool InAdvancedDisplay )
{
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
if ( const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindOutputIndex ( OutputName ) )
{
FMetasoundFrontendClassOutput & GraphOutput = Document . RootGraph . Interface . Outputs [ * Index ] ;
if ( GraphOutput . Metadata . bIsAdvancedDisplay ! = InAdvancedDisplay )
{
GraphOutput . Metadata . SetIsAdvancedDisplay ( InAdvancedDisplay ) ;
2024-09-17 15:37:28 -04:00
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphOutput . VertexID ) ;
2024-08-20 03:27:21 -04:00
return true ;
}
}
return false ;
}
# endif // WITH_EDITORONLY_DATA
2023-06-16 17:48:20 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputInheritsDefault ( FName InName , bool bInputInheritsDefault )
2023-05-30 14:39:48 -04:00
{
2024-05-29 15:33:29 -04:00
FMetasoundFrontendGraphClassPresetOptions & PresetOptions = GetDocumentChecked ( ) . RootGraph . PresetOptions ;
2023-05-30 14:39:48 -04:00
if ( bInputInheritsDefault )
{
if ( PresetOptions . bIsPreset )
{
return PresetOptions . InputsInheritingDefault . Add ( InName ) . IsValidId ( ) ;
}
}
else
{
if ( PresetOptions . bIsPreset )
{
return PresetOptions . InputsInheritingDefault . Remove ( InName ) > 0 ;
}
}
return false ;
}
2024-09-17 15:37:28 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetGraphInputName ( FName InputName , FName NewName )
{
using namespace Metasound : : Frontend ;
if ( InputName = = NewName )
{
return true ;
}
const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindInputIndex ( InputName ) ;
if ( ! Index )
{
return false ;
}
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
FMetasoundFrontendClassInput & GraphInput = RootGraph . Interface . Inputs [ * Index ] ;
GraphInput . Name = NewName ;
RootGraph . IterateGraphPages ( [ this , & GraphInput , & NewName ] ( FMetasoundFrontendGraph & Graph )
{
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( GraphInput . NodeID ) )
{
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
Node . Name = NewName ;
for ( FMetasoundFrontendVertex & Vertex : Node . Interface . Inputs )
{
Vertex . Name = NewName ;
}
for ( FMetasoundFrontendVertex & Vertex : Node . Interface . Outputs )
{
Vertex . Name = NewName ;
}
}
} ) ;
DocumentDelegates - > InterfaceDelegates . OnInputNameChanged . Broadcast ( InputName , NewName ) ;
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphInput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
return true ;
}
bool FMetaSoundFrontendDocumentBuilder : : SetGraphOutputName ( FName OutputName , FName NewName )
{
using namespace Metasound : : Frontend ;
if ( OutputName = = NewName )
{
return true ;
}
const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindOutputIndex ( OutputName ) ;
if ( ! Index )
{
return false ;
}
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & GraphClass = Document . RootGraph ;
FMetasoundFrontendClassInterface & Interface = GraphClass . Interface ;
Interface . UpdateChangeID ( ) ;
FMetasoundFrontendClassOutput & GraphOutput = Interface . Outputs [ * Index ] ;
GraphOutput . Name = NewName ;
GraphClass . IterateGraphPages ( [ this , & GraphOutput , & NewName ] ( FMetasoundFrontendGraph & Graph )
{
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( GraphOutput . NodeID ) )
{
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
Node . Name = NewName ;
for ( FMetasoundFrontendVertex & Vertex : Node . Interface . Inputs )
{
Vertex . Name = NewName ;
}
for ( FMetasoundFrontendVertex & Vertex : Node . Interface . Outputs )
{
Vertex . Name = NewName ;
}
}
} ) ;
DocumentDelegates - > InterfaceDelegates . OnOutputNameChanged . Broadcast ( OutputName , NewName ) ;
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphOutput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
return true ;
}
- 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
bool FMetaSoundFrontendDocumentBuilder : : SetGraphOutputAccessType ( FName OutputName , EMetasoundFrontendVertexAccessType AccessType )
{
using namespace Metasound : : Frontend ;
if ( ! ensureMsgf ( AccessType ! = EMetasoundFrontendVertexAccessType : : Unset , TEXT ( " Cannot set graph output access type to '%s' " ) , LexToString ( AccessType ) ) )
{
return false ;
}
2024-07-17 18:43:11 -04:00
const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindOutputIndex ( OutputName ) ;
if ( ! Index )
- 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
{
2024-07-17 18:43:11 -04:00
return false ;
}
2024-06-10 15:00:26 -04:00
2024-07-17 18:43:11 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
FMetasoundFrontendClassOutput & GraphOutput = RootGraph . Interface . Outputs [ * Index ] ;
if ( GraphOutput . AccessType ! = AccessType )
{
2024-06-10 15:00:26 -04:00
GraphOutput . AccessType = AccessType ;
if ( AccessType = = EMetasoundFrontendVertexAccessType : : Value )
{
2024-06-18 16:47:21 -04:00
RootGraph . IterateGraphPages ( [ this , & GraphOutput , & AccessType ] ( FMetasoundFrontendGraph & Graph )
- 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
{
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
2024-06-18 16:47:21 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( GraphOutput . NodeID ) )
- 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
{
2024-08-21 18:37:59 -04:00
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex & NodeInput = Node . Interface . Inputs . Last ( ) ;
IterateNodesConnectedWithVertex ( { GraphOutput . NodeID , NodeInput . VertexID } , [ this , & Graph , & AccessType ] ( const FMetasoundFrontendEdge & Edge , FMetasoundFrontendNode & ConnectedNode )
- 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
{
2024-06-18 16:47:21 -04:00
if ( const FMetasoundFrontendClass * ConnectedNodeClass = FindDependency ( ConnectedNode . ClassID ) )
- 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
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex & ConnectedNodeOutput = ConnectedNode . Interface . Outputs . Last ( ) ;
const EMetasoundFrontendVertexAccessType ConnectedAccessType = GetNodeOutputAccessType ( ConnectedNode . GetID ( ) , ConnectedNodeOutput . VertexID , & Graph . PageID ) ;
if ( ! FMetasoundFrontendClassVertex : : CanConnectVertexAccessTypes ( ConnectedAccessType , AccessType ) )
{
RemoveEdgeToNodeInput ( Edge . ToNodeID , Edge . ToVertexID , & Graph . PageID ) ;
}
- 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
}
2024-06-18 16:47:21 -04:00
} , Graph . PageID ) ;
}
} ) ;
2024-06-10 15:00:26 -04:00
}
- 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
2024-06-10 15:00:26 -04:00
const bool bNodeConformed = ConformGraphOutputNodeToClass ( GraphOutput ) ;
2024-07-17 18:43:11 -04:00
if ( ! bNodeConformed )
2024-06-10 15:00:26 -04:00
{
2024-07-17 18:43:11 -04:00
return 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
}
2024-07-17 18:43:11 -04:00
# if WITH_EDITORONLY_DATA
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphOutput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
- 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
}
2024-07-17 18:43:11 -04:00
return true ;
- 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
}
bool FMetaSoundFrontendDocumentBuilder : : SetGraphOutputDataType ( FName OutputName , FName DataType )
{
using namespace Metasound : : Frontend ;
2024-07-17 18:43:11 -04:00
if ( ! IDataTypeRegistry : : Get ( ) . IsRegistered ( DataType ) )
- 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
{
2024-07-17 18:43:11 -04:00
return 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
}
2024-07-17 18:43:11 -04:00
const int32 * Index = DocumentCache - > GetInterfaceCache ( ) . FindOutputIndex ( OutputName ) ;
if ( ! Index )
{
return false ;
}
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
FMetasoundFrontendClassOutput & GraphOutput = RootGraph . Interface . Outputs [ * Index ] ;
if ( GraphOutput . TypeName ! = DataType )
{
GraphOutput . TypeName = DataType ;
RootGraph . IterateGraphPages ( [ this , & GraphOutput , & DataType ] ( FMetasoundFrontendGraph & Graph )
{
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
2024-07-17 18:43:11 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( GraphOutput . NodeID ) )
{
2024-08-21 18:37:59 -04:00
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
2024-07-17 18:43:11 -04:00
FMetasoundFrontendLiteral DefaultLiteral ;
DefaultLiteral . SetFromLiteral ( IDataTypeRegistry : : Get ( ) . CreateDefaultLiteral ( DataType ) ) ;
FMetasoundFrontendVertex & NodeInput = Node . Interface . Inputs . Last ( ) ;
Node . InputLiterals = { FMetasoundFrontendVertexLiteral { NodeInput . VertexID , MoveTemp ( DefaultLiteral ) } } ;
RemoveEdgeToNodeInput ( GraphOutput . NodeID , NodeInput . VertexID ) ;
GraphOutput . TypeName = DataType ;
}
} ) ;
const bool bNodeConformed = ConformGraphOutputNodeToClass ( GraphOutput ) ;
if ( ! bNodeConformed )
{
return false ;
}
# if WITH_EDITORONLY_DATA
ClearMemberMetadata ( GraphOutput . NodeID ) ;
Document . Metadata . ModifyContext . AddMemberIDModified ( GraphOutput . NodeID ) ;
# endif // WITH_EDITORONLY_DATA
}
return true ;
- 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
}
2024-08-19 17:06:23 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetGraphVariableDefault ( FName VariableName , FMetasoundFrontendLiteral InDefaultLiteral , const FGuid * InPageID )
{
using namespace Metasound ;
const FGuid PageID = InPageID ? * InPageID : Frontend : : DefaultPageID ;
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( PageID ) ;
auto NameMatchesVariable = [ & VariableName ] ( const FMetasoundFrontendVariable & Variable ) { return Variable . Name = = VariableName ; } ;
if ( FMetasoundFrontendVariable * Variable = Graph . Variables . FindByPredicate ( NameMatchesVariable ) )
{
if ( Frontend : : IDataTypeRegistry : : Get ( ) . IsLiteralTypeSupported ( Variable - > TypeName , InDefaultLiteral . GetType ( ) ) )
{
Variable - > Literal = MoveTemp ( InDefaultLiteral ) ;
return true ;
}
}
return 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
# if WITH_EDITOR
2024-05-08 14:53:53 -04:00
void FMetaSoundFrontendDocumentBuilder : : SetDisplayName ( const FText & InDisplayName )
{
DocumentInterface - > GetDocument ( ) . RootGraph . Metadata . SetDisplayName ( InDisplayName ) ;
}
- 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
void FMetaSoundFrontendDocumentBuilder : : SetMemberMetadata ( UMetaSoundFrontendMemberMetadata & NewMetadata )
{
check ( NewMetadata . MemberID . IsValid ( ) ) ;
2024-05-29 15:33:29 -04:00
TMap < FGuid , TObjectPtr < UMetaSoundFrontendMemberMetadata > > & LiteralMetadata = GetDocumentChecked ( ) . Metadata . MemberMetadata ;
- 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
LiteralMetadata . Remove ( NewMetadata . MemberID ) ;
LiteralMetadata . Add ( NewMetadata . MemberID , NewMetadata ) ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetNodeComment ( const FGuid & InNodeID , FString & & InNewComment , const FGuid * InPageID )
- 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
{
2024-06-18 16:47:21 -04:00
if ( FMetasoundFrontendNode * Node = FindNodeInternal ( InNodeID , InPageID ) )
- 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
{
Node - > Style . Display . Comment = MoveTemp ( InNewComment ) ;
return true ;
}
return false ;
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetNodeCommentVisible ( const FGuid & InNodeID , bool bIsVisible , const FGuid * InPageID )
- 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
{
2024-06-18 16:47:21 -04:00
if ( FMetasoundFrontendNode * Node = FindNodeInternal ( InNodeID , InPageID ) )
- 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
{
Node - > Style . Display . bCommentVisible = bIsVisible ;
return true ;
}
return false ;
}
# endif // WITH_EDITOR
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetNodeInputDefault ( const FGuid & InNodeID , const FGuid & InVertexID , const FMetasoundFrontendLiteral & InLiteral , const FGuid * InPageID )
2023-06-16 17:48:20 -04:00
{
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
const FGuid & PageID = InPageID ? * InPageID : BuildPageID ;
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( PageID ) ;
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( PageID ) ;
2023-06-16 17:48:20 -04:00
if ( const int32 * NodeIndex = NodeCache . FindNodeIndex ( InNodeID ) )
{
FMetasoundFrontendNode & Node = Graph . Nodes [ * NodeIndex ] ;
auto IsVertex = [ & InVertexID ] ( const FMetasoundFrontendVertex & Vertex ) { return Vertex . VertexID = = InVertexID ; } ;
int32 VertexIndex = Node . Interface . Inputs . IndexOfByPredicate ( IsVertex ) ;
if ( VertexIndex ! = INDEX_NONE )
{
FMetasoundFrontendVertexLiteral NewVertexLiteral ;
NewVertexLiteral . VertexID = InVertexID ;
NewVertexLiteral . Value = InLiteral ;
auto IsLiteral = [ & InVertexID ] ( const FMetasoundFrontendVertexLiteral & Literal ) { return Literal . VertexID = = InVertexID ; } ;
int32 LiteralIndex = Node . InputLiterals . IndexOfByPredicate ( IsLiteral ) ;
if ( LiteralIndex = = INDEX_NONE )
{
LiteralIndex = Node . InputLiterals . Num ( ) ;
Node . InputLiterals . Add ( MoveTemp ( NewVertexLiteral ) ) ;
}
else
{
Node . InputLiterals [ LiteralIndex ] = MoveTemp ( NewVertexLiteral ) ;
}
2024-06-18 16:47:21 -04:00
FNodeModifyDelegates & NodeDelegates = DocumentDelegates - > FindNodeDelegatesChecked ( PageID ) ;
const FOnMetaSoundFrontendDocumentMutateNodeInputLiteralArray & OnNodeInputLiteralSet = NodeDelegates . OnNodeInputLiteralSet ;
2023-06-16 17:48:20 -04:00
OnNodeInputLiteralSet . Broadcast ( * NodeIndex , VertexIndex , LiteralIndex ) ;
return true ;
}
}
return false ;
}
2023-07-31 14:25:14 -04:00
# if WITH_EDITOR
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetNodeLocation ( const FGuid & InNodeID , const FVector2D & InLocation , const FGuid * InLocationGuid , const FGuid * InPageID )
2024-01-31 15:02:39 -05:00
{
2024-06-18 16:47:21 -04:00
if ( FMetasoundFrontendNode * Node = FindNodeInternal ( InNodeID , InPageID ) )
2024-01-31 15:02:39 -05:00
{
FMetasoundFrontendNodeStyle & Style = Node - > Style ;
if ( InLocationGuid )
{
- 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
if ( InLocationGuid - > IsValid ( ) )
{
Style . Display . Locations . FindOrAdd ( * InLocationGuid ) = InLocation ;
return true ;
}
UE_LOG ( LogMetaSound , Display , TEXT ( " Invalid Location Guid no longer supported, reseting display location for node with ID '%s' " ) , * InNodeID . ToString ( ) ) ;
2024-01-31 15:02:39 -05:00
}
- 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
if ( Style . Display . Locations . IsEmpty ( ) )
2023-07-31 14:25:14 -04:00
{
Style . Display . Locations = { { FGuid : : NewGuid ( ) , InLocation } } ;
}
else
{
Algo : : ForEach ( Style . Display . Locations , [ InLocation ] ( TPair < FGuid , FVector2D > & Pair )
{
Pair . Value = InLocation ;
} ) ;
}
return true ;
}
return false ;
}
2024-06-18 04:15:33 -04:00
2024-06-21 16:42:38 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SetNodeUnconnectedPinsHidden ( const FGuid & InNodeID , const bool bUnconnectedPinsHidden , const FGuid * InPageID )
2024-06-18 04:15:33 -04:00
{
2024-06-21 16:42:38 -04:00
if ( FMetasoundFrontendNode * Node = FindNodeInternal ( InNodeID , InPageID ) )
2024-06-18 04:15:33 -04:00
{
Node - > Style . bUnconnectedPinsHidden = bUnconnectedPinsHidden ;
return true ;
}
return false ;
}
2024-06-21 16:42:38 -04:00
const FMetasoundFrontendNodeStyle * FMetaSoundFrontendDocumentBuilder : : GetNodeStyle ( const FGuid & InNodeID , const FGuid * InPageID )
2024-06-18 04:15:33 -04:00
{
2024-06-21 16:42:38 -04:00
if ( const FMetasoundFrontendNode * Node = FindNodeInternal ( InNodeID , InPageID ) )
2024-06-18 04:15:33 -04:00
{
return & Node - > Style ;
}
return nullptr ;
}
2023-07-31 14:25:14 -04:00
# endif // WITH_EDITOR
2024-01-31 15:02:39 -05:00
void FMetaSoundFrontendDocumentBuilder : : SetVersionNumber ( const FMetasoundFrontendVersionNumber & InDocumentVersionNumber )
{
2024-05-29 15:33:29 -04:00
GetDocumentChecked ( ) . Metadata . Version . Number = InDocumentVersionNumber ;
2024-01-31 15:02:39 -05:00
}
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SpliceVariableNodeFromStack ( const FGuid & InNodeID , const FGuid & InPageID )
2024-05-14 20:16:37 -04:00
{
using namespace Metasound ;
using namespace Metasound : : Frontend ;
2024-06-18 16:47:21 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraph & Graph = Document . RootGraph . FindGraphChecked ( InPageID ) ;
const IDocumentGraphEdgeCache & EdgeCache = DocumentCache - > GetEdgeCache ( InPageID ) ;
2024-05-14 20:16:37 -04:00
FMetasoundFrontendVertexHandle FromVariableVertexHandle ;
{
2024-06-18 16:47:21 -04:00
const FMetasoundFrontendVertex * InputVertex = FindNodeInput ( InNodeID , VariableNames : : InputVariableName , & InPageID ) ;
2024-05-14 20:16:37 -04:00
check ( InputVertex ) ;
if ( const int32 * InputEdgeIndex = EdgeCache . FindEdgeIndexToNodeInput ( InNodeID , InputVertex - > VertexID ) )
{
FromVariableVertexHandle = Graph . Edges [ * InputEdgeIndex ] . GetFromVertexHandle ( ) ;
2024-06-18 16:47:21 -04:00
const bool bRemovedEdge = RemoveEdgeToNodeInput ( InNodeID , InputVertex - > VertexID , & InPageID ) ;
2024-05-14 20:16:37 -04:00
check ( bRemovedEdge ) ;
}
}
if ( FromVariableVertexHandle . IsSet ( ) )
{
2024-06-18 16:47:21 -04:00
if ( const FMetasoundFrontendVertex * OutputVertex = FindNodeOutput ( InNodeID , VariableNames : : OutputVariableName , & InPageID ) )
2024-05-14 20:16:37 -04:00
{
TArray < FMetasoundFrontendVertexHandle > ToVertexHandles ;
const TArrayView < const int32 > OutputEdgeIndices = EdgeCache . FindEdgeIndicesFromNodeOutput ( InNodeID , OutputVertex - > VertexID ) ;
Algo : : Transform ( OutputEdgeIndices , ToVertexHandles , [ & Graph ] ( const int32 & VertIndex ) { return Graph . Edges [ VertIndex ] . GetToVertexHandle ( ) ; } ) ;
2024-06-18 16:47:21 -04:00
RemoveEdgesFromNodeOutput ( InNodeID , OutputVertex - > VertexID , & InPageID ) ;
2024-05-14 20:16:37 -04:00
for ( const FMetasoundFrontendVertexHandle & ToHandle : ToVertexHandles )
{
AddEdge ( FMetasoundFrontendEdge
{
FromVariableVertexHandle . NodeID ,
FromVariableVertexHandle . VertexID ,
ToHandle . NodeID ,
ToHandle . VertexID
2024-06-18 16:47:21 -04:00
} , & InPageID ) ;
2024-05-14 20:16:37 -04:00
}
return true ;
}
}
return false ;
}
2023-05-10 20:28:39 -04:00
bool FMetaSoundFrontendDocumentBuilder : : SwapGraphInput ( const FMetasoundFrontendClassVertex & InExistingInputVertex , const FMetasoundFrontendClassVertex & InNewInputVertex )
2023-03-07 17:01:52 -05:00
{
using namespace Metasound : : Frontend ;
2023-05-10 20:28:39 -04:00
// 1. Check if equivalent and early out if functionally do not match
2023-03-07 17:01:52 -05:00
{
2023-05-10 20:28:39 -04:00
const FMetasoundFrontendClassInput * ClassInput = FindGraphInput ( InExistingInputVertex . Name ) ;
if ( ! ClassInput | | ! FMetasoundFrontendVertex : : IsFunctionalEquivalent ( * ClassInput , InExistingInputVertex ) )
{
return false ;
}
2023-03-07 17:01:52 -05:00
}
2023-06-16 17:48:20 -04:00
const IDocumentGraphInterfaceCache & InterfaceCache = DocumentCache - > GetInterfaceCache ( ) ;
2023-05-10 20:28:39 -04:00
2024-08-21 18:37:59 -04:00
# if WITH_EDITOR
using FPageNodeLocations = TMap < FGuid , FVector2D > ;
TMap < FGuid , FPageNodeLocations > PageNodeLocations ;
# endif // WITH_EDITOR
2023-05-10 20:28:39 -04:00
// 2. Gather data from existing member/node needed to swap
2024-09-10 10:26:02 -04:00
TMultiMap < FGuid , FMetasoundFrontendEdge > RemovedEdgesPerPage ;
2023-05-10 20:28:39 -04:00
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClassInput * ExistingInputClass = InterfaceCache . FindInput ( InExistingInputVertex . Name ) ;
checkf ( ExistingInputClass , TEXT ( " 'SwapGraphInput' failed to find original graph input " ) ) ;
const FGuid NodeID = ExistingInputClass - > NodeID ;
2023-05-10 20:28:39 -04:00
2024-08-21 18:37:59 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendNode * ExistingInputNode = NodeCache . FindNode ( NodeID ) ;
check ( ExistingInputNode ) ;
2023-05-10 20:28:39 -04:00
# if WITH_EDITOR
2024-08-21 18:37:59 -04:00
PageNodeLocations . Add ( Graph . PageID , ExistingInputNode - > Style . Display . Locations ) ;
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITOR
const FGuid VertexID = ExistingInputNode - > Interface . Outputs . Last ( ) . VertexID ;
2024-08-21 18:37:59 -04:00
TArray < const FMetasoundFrontendEdge * > Edges = DocumentCache - > GetEdgeCache ( Graph . PageID ) . FindEdges ( NodeID , VertexID ) ;
2024-09-10 10:26:02 -04:00
Algo : : Transform ( Edges , RemovedEdgesPerPage , [ PageID = Graph . PageID ] ( const FMetasoundFrontendEdge * Edge )
{
return TPair < FGuid , FMetasoundFrontendEdge > ( PageID , * Edge ) ;
} ) ;
2024-08-21 18:37:59 -04:00
} ) ;
2023-05-10 20:28:39 -04:00
// 3. Remove existing graph vertex
{
2024-05-21 17:18:40 -04:00
const bool bRemovedVertex = RemoveGraphInput ( InExistingInputVertex . Name ) ;
2023-05-10 20:28:39 -04:00
checkf ( bRemovedVertex , TEXT ( " Failed to swap MetaSound input expected to exist " ) ) ;
}
// 4. Add new graph vertex
FMetasoundFrontendClassInput NewInput = InNewInputVertex ;
NewInput . NodeID = NodeID ;
# if WITH_EDITOR
NewInput . Metadata . SetSerializeText ( InExistingInputVertex . Metadata . GetSerializeText ( ) ) ;
# endif // WITH_EDITOR
const FMetasoundFrontendNode * NewInputNode = AddGraphInput ( NewInput ) ;
checkf ( NewInputNode , TEXT ( " Failed to add new Input node when swapping graph inputs " ) ) ;
2024-08-21 18:37:59 -04:00
checkf ( NewInputNode - > GetID ( ) = = NewInput . NodeID , TEXT ( " Expected new node added to build graph to have same ID as provided input " ) ) ;
2023-05-10 20:28:39 -04:00
2024-08-21 18:37:59 -04:00
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
# if WITH_EDITOR
// 5a. Add to new copy existing node locations
if ( const FPageNodeLocations * Locations = PageNodeLocations . Find ( Graph . PageID ) )
{
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
const int32 * NodeIndex = NodeCache . FindNodeIndex ( NodeID ) ;
checkf ( NodeIndex , TEXT ( " Cache was not updated to reflect newly added input node " ) ) ;
FMetasoundFrontendNode & NewNode = Graph . Nodes [ * NodeIndex ] ;
NewNode . Style . Display . Locations = * Locations ;
}
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITOR
2024-08-21 18:37:59 -04:00
// 5b. Add to new copy existing node edges
2024-09-10 10:26:02 -04:00
TArray < FMetasoundFrontendEdge > RemovedEdges ;
RemovedEdgesPerPage . MultiFind ( Graph . PageID , RemovedEdges ) ;
2024-08-21 18:37:59 -04:00
for ( const FMetasoundFrontendEdge & RemovedEdge : RemovedEdges )
{
FMetasoundFrontendEdge NewEdge = RemovedEdge ;
NewEdge . FromNodeID = NewInputNode - > GetID ( ) ;
NewEdge . FromVertexID = NewInputNode - > Interface . Outputs . Last ( ) . VertexID ;
2024-09-10 10:26:02 -04:00
AddEdge ( MoveTemp ( NewEdge ) , & Graph . PageID ) ;
2024-08-21 18:37:59 -04:00
}
} ) ;
2023-05-10 20:28:39 -04:00
return true ;
}
bool FMetaSoundFrontendDocumentBuilder : : SwapGraphOutput ( const FMetasoundFrontendClassVertex & InExistingOutputVertex , const FMetasoundFrontendClassVertex & InNewOutputVertex )
{
using namespace Metasound : : Frontend ;
// 1. Check if equivalent and early out if functionally do not match
{
const FMetasoundFrontendClassOutput * ClassOutput = FindGraphOutput ( InExistingOutputVertex . Name ) ;
if ( ! ClassOutput | | ! FMetasoundFrontendVertex : : IsFunctionalEquivalent ( * ClassOutput , InExistingOutputVertex ) )
{
return false ;
}
}
2023-06-16 17:48:20 -04:00
const IDocumentGraphInterfaceCache & InterfaceCache = DocumentCache - > GetInterfaceCache ( ) ;
2023-05-10 20:28:39 -04:00
2024-08-21 18:37:59 -04:00
# if WITH_EDITOR
using FPageNodeLocations = TMap < FGuid , FVector2D > ;
TMap < FGuid , FPageNodeLocations > PageNodeLocations ;
# endif // WITH_EDITOR
2024-09-10 10:26:02 -04:00
// 2. Gather data from existing page member/node needed to swap
TMultiMap < FGuid , FMetasoundFrontendEdge > RemovedEdgesPerPage ;
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendClassOutput * ExistingOutputClass = InterfaceCache . FindOutput ( InExistingOutputVertex . Name ) ;
checkf ( ExistingOutputClass , TEXT ( " 'SwapGraphOutput' failed to find original graph output " ) ) ;
const FGuid NodeID = ExistingOutputClass - > NodeID ;
2024-08-21 18:37:59 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
FMetasoundFrontendGraphClass & RootGraph = Document . RootGraph ;
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
2023-06-16 17:48:20 -04:00
const FMetasoundFrontendNode * ExistingOutputNode = NodeCache . FindNode ( NodeID ) ;
check ( ExistingOutputNode ) ;
2023-05-10 20:28:39 -04:00
# if WITH_EDITOR
2024-08-21 18:37:59 -04:00
PageNodeLocations . Add ( Graph . PageID , ExistingOutputNode - > Style . Display . Locations ) ;
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITOR
const FGuid VertexID = ExistingOutputNode - > Interface . Inputs . Last ( ) . VertexID ;
2024-08-21 18:37:59 -04:00
TArray < const FMetasoundFrontendEdge * > Edges = DocumentCache - > GetEdgeCache ( Graph . PageID ) . FindEdges ( NodeID , VertexID ) ;
2024-09-10 10:26:02 -04:00
Algo : : Transform ( Edges , RemovedEdgesPerPage , [ PageID = Graph . PageID ] ( const FMetasoundFrontendEdge * Edge )
{
return TPair < FGuid , FMetasoundFrontendEdge > ( PageID , * Edge ) ;
} ) ;
2024-08-21 18:37:59 -04:00
} ) ;
2023-05-10 20:28:39 -04:00
// 3. Remove existing graph vertex
{
const bool bRemovedVertex = RemoveGraphOutput ( InExistingOutputVertex . Name ) ;
checkf ( bRemovedVertex , TEXT ( " Failed to swap output expected to exist while swapping MetaSound outputs " ) ) ;
}
// 4. Add new graph vertex
FMetasoundFrontendClassOutput NewOutput = InNewOutputVertex ;
NewOutput . NodeID = NodeID ;
# if WITH_EDITOR
NewOutput . Metadata . SetSerializeText ( InExistingOutputVertex . Metadata . GetSerializeText ( ) ) ;
# endif // WITH_EDITOR
const FMetasoundFrontendNode * NewOutputNode = AddGraphOutput ( NewOutput ) ;
checkf ( NewOutputNode , TEXT ( " Failed to add new output node when swapping graph outputs " ) ) ;
2024-08-21 18:37:59 -04:00
checkf ( NewOutputNode - > GetID ( ) = = NewOutput . NodeID , TEXT ( " Expected new node added to build graph to have same ID as provided output " ) ) ;
2023-05-10 20:28:39 -04:00
2024-08-21 18:37:59 -04:00
Document . RootGraph . IterateGraphPages ( [ & ] ( FMetasoundFrontendGraph & Graph )
2023-05-10 20:28:39 -04:00
{
2024-08-21 18:37:59 -04:00
# if WITH_EDITOR
// 5a. Add to new copy existing node locations
if ( const FPageNodeLocations * Locations = PageNodeLocations . Find ( Graph . PageID ) )
{
const IDocumentGraphNodeCache & NodeCache = DocumentCache - > GetNodeCache ( Graph . PageID ) ;
const int32 * NodeIndex = NodeCache . FindNodeIndex ( NodeID ) ;
checkf ( NodeIndex , TEXT ( " Cache was not updated to reflect newly added output node " ) ) ;
FMetasoundFrontendNode & NewNode = Graph . Nodes [ * NodeIndex ] ;
NewNode . Style . Display . Locations = * Locations ;
}
2023-05-10 20:28:39 -04:00
# endif // WITH_EDITOR
2024-08-21 18:37:59 -04:00
// 5b. Add to new copy existing node edges
2024-09-10 10:26:02 -04:00
TArray < FMetasoundFrontendEdge > RemovedEdges ;
RemovedEdgesPerPage . MultiFind ( Graph . PageID , RemovedEdges ) ;
2024-08-21 18:37:59 -04:00
for ( const FMetasoundFrontendEdge & RemovedEdge : RemovedEdges )
{
FMetasoundFrontendEdge NewEdge = RemovedEdge ;
NewEdge . ToNodeID = NewOutputNode - > GetID ( ) ;
NewEdge . ToVertexID = NewOutputNode - > Interface . Inputs . Last ( ) . VertexID ;
2024-09-10 10:26:02 -04:00
AddEdge ( MoveTemp ( NewEdge ) , & Graph . PageID ) ;
2024-08-21 18:37:59 -04:00
}
} ) ;
2023-05-10 20:28:39 -04:00
return true ;
2023-03-07 17:01:52 -05:00
}
2023-06-28 17:08:29 -04:00
2024-06-18 16:47:21 -04:00
bool FMetaSoundFrontendDocumentBuilder : : UnlinkVariableNode ( const FGuid & InNodeID , const FGuid & InPageID )
- 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
{
2024-05-14 20:16:37 -04:00
auto IsNodeID = [ & InNodeID ] ( const FGuid & TestID ) { return TestID = = InNodeID ; } ;
- 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
2024-06-18 16:47:21 -04:00
FMetasoundFrontendGraph & Graph = GetDocumentChecked ( ) . RootGraph . FindGraphChecked ( InPageID ) ;
2024-05-14 20:16:37 -04:00
for ( FMetasoundFrontendVariable & Variable : Graph . Variables )
- 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
{
2024-05-14 20:16:37 -04:00
if ( Variable . MutatorNodeID = = InNodeID )
- 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
{
Variable . MutatorNodeID = FGuid ( ) ;
2024-06-18 16:47:21 -04:00
SpliceVariableNodeFromStack ( InNodeID , InPageID ) ;
- 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
return true ;
}
2024-05-14 20:16:37 -04:00
if ( Variable . VariableNodeID = = InNodeID )
- 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
{
2024-05-14 20:16:37 -04:00
Variable . VariableNodeID = FGuid ( ) ;
2024-06-18 16:47:21 -04:00
SpliceVariableNodeFromStack ( InNodeID , InPageID ) ;
- 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
return true ;
}
2024-05-14 20:16:37 -04:00
const bool bRemovedDeferredNode = Variable . DeferredAccessorNodeIDs . RemoveAllSwap ( IsNodeID , EAllowShrinking : : No ) > 0 ;
if ( bRemovedDeferredNode )
- 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
{
2024-06-18 16:47:21 -04:00
SpliceVariableNodeFromStack ( InNodeID , InPageID ) ;
2024-05-14 20:16:37 -04:00
return true ;
}
const bool bRemovedAccessorNode = Variable . AccessorNodeIDs . RemoveAllSwap ( IsNodeID , EAllowShrinking : : No ) > 0 ;
if ( bRemovedAccessorNode )
{
2024-06-18 16:47:21 -04:00
SpliceVariableNodeFromStack ( InNodeID , InPageID ) ;
- 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
return true ;
}
}
return false ;
}
2024-09-10 10:26:02 -04:00
# if WITH_EDITOR
bool FMetaSoundFrontendDocumentBuilder : : UpdateDependencyRegistryData ( const TMap < Metasound : : Frontend : : FNodeRegistryKey , Metasound : : Frontend : : FNodeRegistryKey > & OldToNewClassKeys )
2023-06-28 17:08:29 -04:00
{
2024-09-10 10:26:02 -04:00
using namespace Metasound : : Frontend ;
bool bUpdated = false ;
if ( DocumentDelegates . IsValid ( ) )
2024-06-18 16:47:21 -04:00
{
2024-09-10 10:26:02 -04:00
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
for ( FMetasoundFrontendClass & Dependency : Document . Dependencies )
{
const FNodeRegistryKey OldKey ( Dependency . Metadata ) ;
if ( const FNodeRegistryKey * NewKey = OldToNewClassKeys . Find ( OldKey ) )
{
if ( Dependency . Metadata . GetType ( ) = = EMetasoundFrontendClassType : : External )
{
bUpdated = true ;
const int32 * DependencyIndex = DocumentCache - > FindDependencyIndex ( Dependency . ID ) ;
check ( DependencyIndex ) ;
DocumentDelegates - > OnRenamingDependencyClass . Broadcast ( * DependencyIndex , NewKey - > ClassName ) ;
Dependency . Metadata . SetType ( NewKey - > Type ) ;
Dependency . Metadata . SetClassName ( NewKey - > ClassName ) ;
Dependency . Metadata . SetVersion ( NewKey - > Version ) ;
}
}
}
# if WITH_EDITORONLY_DATA
if ( bUpdated )
{
Document . Metadata . ModifyContext . SetDocumentModified ( ) ;
}
# endif // WITH_EDITORONLY_DATA
2024-06-18 16:47:21 -04:00
}
2024-09-10 10:26:02 -04:00
return bUpdated ;
2023-06-28 17:08:29 -04:00
}
2024-05-30 18:56:24 -04:00
2024-09-10 10:26:02 -04:00
bool FMetaSoundFrontendDocumentBuilder : : UpdateDependencyClassNames ( const TMap < FMetasoundFrontendClassName , FMetasoundFrontendClassName > & OldToNewReferencedClassNames )
{
using namespace Metasound : : Frontend ;
TMap < FNodeRegistryKey , FNodeRegistryKey > OldToNewKeys ;
Algo : : Transform ( OldToNewReferencedClassNames , OldToNewKeys , [ ] ( const TPair < FMetasoundFrontendClassName , FMetasoundFrontendClassName > & ClassNamePair )
{
return TPair < FNodeRegistryKey , FNodeRegistryKey > (
FNodeRegistryKey ( EMetasoundFrontendClassType : : External , ClassNamePair . Key , FMetasoundFrontendVersionNumber ( ) ) ,
FNodeRegistryKey ( EMetasoundFrontendClassType : : External , ClassNamePair . Value , FMetasoundFrontendVersionNumber ( ) )
) ;
} ) ;
return UpdateDependencyRegistryData ( OldToNewKeys ) ;
}
# endif // WITH_EDITOR
2024-05-30 18:56:24 -04:00
# if WITH_EDITORONLY_DATA
bool FMetaSoundFrontendDocumentBuilder : : VersionInterfaces ( )
{
FMetasoundFrontendDocument & Document = GetDocumentChecked ( ) ;
if ( Document . RequiresInterfaceVersioning ( ) )
{
Document . VersionInterfaces ( ) ;
return true ;
}
return false ;
}
2024-07-26 14:23:35 -04:00
FMetasoundFrontendDocument & FMetaSoundFrontendDocumentBuilder : : IPropertyVersionTransform : : GetDocumentUnsafe ( const FMetaSoundFrontendDocumentBuilder & Builder )
{
return Builder . GetDocumentChecked ( ) ;
}
2024-05-30 18:56:24 -04:00
# endif // WITH_EDITORONLY_DATA