2020-07-15 00:16:40 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# pragma once
# include "CoreMinimal.h"
2021-06-16 11:21:13 -04:00
2021-06-08 10:52:31 -04:00
# include "EdGraph/EdGraph.h"
2021-05-10 19:52:56 -04:00
# include "MetasoundAssetBase.h"
2023-03-07 17:01:52 -05:00
# include "MetasoundDocumentInterface.h"
2020-07-15 00:16:40 -04:00
# include "MetasoundFrontend.h"
2021-01-13 10:48:59 -04:00
# include "MetasoundFrontendDocument.h"
2021-07-28 16:21:39 -04:00
# include "MetasoundFrontendTransform.h"
2021-06-08 10:52:31 -04:00
# include "MetasoundOperatorSettings.h"
# include "MetasoundRouter.h"
2021-07-27 15:36:03 -04:00
# include "MetasoundUObjectRegistry.h"
# include "Serialization/Archive.h"
2021-08-31 16:07:45 -04:00
# include "UObject/ObjectSaveContext.h"
2022-10-13 17:38:11 -04:00
# include "UObject/SoftObjectPath.h"
2021-06-16 14:11:49 -04:00
2020-07-15 00:16:40 -04:00
# include "Metasound.generated.h"
2020-07-22 14:52:03 -04:00
2024-05-30 18:56:24 -04:00
// Forward Declarations
2024-08-30 12:53:13 -04:00
# if WITH_EDITOR
class FDataValidationContext ;
# endif // WITH_EDITOR
2024-05-30 18:56:24 -04:00
namespace Metasound : : Engine
{
struct FAssetHelper ;
} // namespace Metasound::Engine
2021-11-18 14:37:34 -05:00
UCLASS ( Abstract )
2021-07-27 15:36:03 -04:00
class METASOUNDENGINE_API UMetasoundEditorGraphBase : public UEdGraph
{
GENERATED_BODY ( )
public :
virtual bool IsEditorOnly ( ) const override { return true ; }
virtual bool NeedsLoadForEditorGame ( ) const override { return false ; }
2021-11-18 14:37:34 -05:00
virtual void RegisterGraphWithFrontend ( ) PURE_VIRTUAL ( UMetasoundEditorGraphBase : : RegisterGraphWithFrontend ( ) , )
2022-01-26 20:55:33 -05: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
UE_DEPRECATED ( 5.5 , " ModifyContext is to be replaced by builder API delegates providing context when items changed and it will be up to the caller to track modification deltas. " )
virtual FMetasoundFrontendDocumentModifyContext & GetModifyContext ( ) { static FMetasoundFrontendDocumentModifyContext InvalidModifyData ; return InvalidModifyData ; }
UE_DEPRECATED ( 5.5 , " ModifyContext is to be replaced by builder API delegates providing context when items changed and it will be up to the caller to track modification deltas. " )
virtual const FMetasoundFrontendDocumentModifyContext & GetModifyContext ( ) const { static const FMetasoundFrontendDocumentModifyContext InvalidModifyData ; return InvalidModifyData ; }
UE_DEPRECATED ( 5.5 , " Editor Graph is now transient, so versioning flag moved to AssetBase. " )
virtual void ClearVersionedOnLoad ( ) { }
UE_DEPRECATED ( 5.5 , " Editor Graph is now transient, so versioning flag moved to AssetBase. " )
virtual bool GetVersionedOnLoad ( ) const { return false ; }
UE_DEPRECATED ( 5.5 , " Editor Graph is now transient, so versioning flag moved to AssetBase. " )
virtual void SetVersionedOnLoad ( ) { }
virtual void MigrateEditorDocumentData ( FMetaSoundFrontendDocumentBuilder & OutBuilder ) PURE_VIRTUAL ( UMetasoundEditorGraphBase : : MigrateEditorDocumentData ( ) , )
2022-01-26 20:55:33 -05:00
# endif // WITH_EDITORONLY_DATA
2022-09-14 18:49:46 -04:00
int32 GetHighestMessageSeverity ( ) const ;
2021-07-27 15:36:03 -04:00
} ;
2020-07-15 00:16:40 -04:00
/**
* This asset type is used for Metasound assets that can only be used as nodes in other Metasound graphs .
2021-06-08 10:52:31 -04:00
* Because of this , they contain no required inputs or outputs .
2020-07-15 00:16:40 -04:00
*/
2024-09-11 20:41:41 -04:00
UCLASS ( hidecategories = object , BlueprintType , meta = ( DisplayName = " MetaSound Patch " ) )
2023-03-07 17:01:52 -05:00
class METASOUNDENGINE_API UMetaSoundPatch : public UObject , public FMetasoundAssetBase , public IMetaSoundDocumentInterface
2020-07-15 00:16:40 -04:00
{
GENERATED_BODY ( )
2024-05-30 18:56:24 -04:00
friend struct Metasound : : Engine : : FAssetHelper ;
2024-05-08 14:53:53 -04:00
friend class UMetaSoundPatchBuilder ;
2020-07-15 00:16:40 -04:00
protected :
2020-08-05 12:47:19 -04:00
UPROPERTY ( EditAnywhere , Category = CustomView )
2021-06-08 10:52:31 -04:00
FMetasoundFrontendDocument RootMetaSoundDocument ;
2020-07-15 00:16:40 -04:00
2022-10-13 17:38:11 -04:00
UPROPERTY ( )
TSet < FString > ReferencedAssetClassKeys ;
UPROPERTY ( )
TSet < TObjectPtr < UObject > > ReferencedAssetClassObjects ;
UPROPERTY ( )
TSet < FSoftObjectPath > ReferenceAssetClassCache ;
2020-07-15 12:59:38 -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
UPROPERTY ( meta = ( DeprecatedProperty , DeprecationMessage = " Use EditorGraph instead as it is now transient and generated via the FrontendDocument dynamically. " ) )
2022-05-26 15:06:53 -04:00
TObjectPtr < UMetasoundEditorGraphBase > 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
UPROPERTY ( Transient )
TObjectPtr < UMetasoundEditorGraphBase > EditorGraph ;
2020-07-15 12:59:38 -04:00
# endif // WITH_EDITORONLY_DATA
2020-07-15 00:16:40 -04:00
public :
2022-08-12 14:54:54 -04:00
UMetaSoundPatch ( const FObjectInitializer & ObjectInitializer ) ;
2020-07-15 00:16:40 -04:00
2021-06-16 11:21:13 -04:00
UPROPERTY ( AssetRegistrySearchable )
FGuid AssetClassID ;
2020-07-15 12:59:38 -04:00
# if WITH_EDITORONLY_DATA
2021-06-16 11:21:13 -04:00
UPROPERTY ( AssetRegistrySearchable )
FString RegistryInputTypes ;
UPROPERTY ( AssetRegistrySearchable )
FString RegistryOutputTypes ;
UPROPERTY ( AssetRegistrySearchable )
int32 RegistryVersionMajor = 0 ;
UPROPERTY ( AssetRegistrySearchable )
int32 RegistryVersionMinor = 0 ;
2022-10-26 15:28:04 -04:00
UPROPERTY ( AssetRegistrySearchable )
bool bIsPreset = false ;
2021-06-16 11:21:13 -04:00
// Sets Asset Registry Metadata associated with this MetaSound
virtual void SetRegistryAssetClassInfo ( const Metasound : : Frontend : : FNodeClassInfo & InClassInfo ) override ;
2020-07-30 16:57:04 -04:00
// Returns document name (for editor purposes, and avoids making document public for edit
// while allowing editor to reference directly)
static FName GetDocumentPropertyName ( )
{
2022-08-12 14:54:54 -04:00
return GET_MEMBER_NAME_CHECKED ( UMetaSoundPatch , RootMetaSoundDocument ) ;
2020-07-30 16:57:04 -04:00
}
2020-07-15 12:59:38 -04:00
2021-06-08 10:52:31 -04:00
// Name to display in editors
virtual FText GetDisplayName ( ) const override ;
2020-07-15 12:59:38 -04:00
// Returns the graph associated with this Metasound. Graph is required to be referenced on
// Metasound UObject for editor serialization purposes.
2021-06-08 10:52:31 -04:00
// @return Editor graph associated with UMetaSoundSource.
2024-05-08 14:53:53 -04:00
virtual UEdGraph * GetGraph ( ) const override ;
virtual UEdGraph & GetGraphChecked ( ) const override ;
- 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
virtual void MigrateEditorGraph ( FMetaSoundFrontendDocumentBuilder & OutBuilder ) override ;
2020-07-15 12:59:38 -04:00
// Sets the graph associated with this Metasound. Graph is required to be referenced on
// Metasound UObject for editor serialization purposes.
2021-06-08 10:52:31 -04:00
// @param Editor graph associated with UMetaSoundSource.
virtual void SetGraph ( UEdGraph * InGraph ) override
{
- 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
EditorGraph = CastChecked < UMetasoundEditorGraphBase > ( InGraph ) ;
2021-06-08 10:52:31 -04:00
}
# endif // #if WITH_EDITORONLY_DATA
2023-12-15 13:21:12 -05:00
virtual FTopLevelAssetPath GetAssetPathChecked ( ) const override ;
2023-05-10 20:28:39 -04:00
virtual const UClass & GetBaseMetaSoundUClass ( ) const final override ;
2024-05-08 14:53:53 -04:00
virtual const UClass & GetBuilderUClass ( ) const final override ;
2023-09-22 15:01:07 -04:00
virtual const FMetasoundFrontendDocument & GetConstDocument ( ) const override ;
2023-04-04 19:14:26 -04:00
2021-06-08 10:52:31 -04:00
# if WITH_EDITOR
2024-06-10 13:52:48 -04:00
virtual void PreDuplicate ( FObjectDuplicationParameters & DupParams ) override ;
2021-07-28 16:21:39 -04:00
virtual void PostDuplicate ( EDuplicateMode : : Type DuplicateMode ) override ;
2021-06-08 10:52:31 -04:00
virtual void PostEditUndo ( ) override ;
2024-06-20 16:42:12 -04:00
virtual EDataValidationResult IsDataValid ( FDataValidationContext & Context ) const override ;
2021-06-08 10:52:31 -04:00
# endif // WITH_EDITOR
2021-07-27 15:36:03 -04:00
virtual void BeginDestroy ( ) override ;
virtual void PreSave ( FObjectPreSaveContext InSaveContext ) override ;
virtual void Serialize ( FArchive & InArchive ) override ;
2022-10-13 17:38:11 -04:00
virtual void PostLoad ( ) override ;
2021-07-27 15:36:03 -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
virtual bool ConformObjectToDocument ( ) override { return false ; }
2021-08-18 15:16:57 -04:00
virtual const TSet < FString > & GetReferencedAssetClassKeys ( ) const override
{
return ReferencedAssetClassKeys ;
}
2022-10-13 17:38:11 -04:00
virtual TArray < FMetasoundAssetBase * > GetReferencedAssets ( ) override ;
virtual const TSet < FSoftObjectPath > & GetAsyncReferencedAssetClassPaths ( ) const override ;
virtual void OnAsyncReferencedAssetsLoaded ( const TArray < FMetasoundAssetBase * > & InAsyncReferences ) override ;
2021-08-18 15:16:57 -04:00
2021-02-01 15:59:27 -04:00
UObject * GetOwningAsset ( ) override
2020-07-23 16:39:56 -04:00
{
2021-02-01 15:59:27 -04:00
return this ;
}
const UObject * GetOwningAsset ( ) const override
{
return this ;
2020-07-17 16:43:42 -04:00
}
2020-07-15 00:16:40 -04:00
2024-04-24 10:36:28 -04:00
virtual bool IsActivelyBuilding ( ) const override ;
- 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
2021-06-08 10:52:31 -04:00
protected :
2022-10-13 17:38:11 -04:00
# if WITH_EDITOR
virtual void SetReferencedAssetClasses ( TSet < Metasound : : Frontend : : IMetaSoundAssetManager : : FAssetInfo > & & InAssetClasses ) override ;
# endif // #if WITH_EDITOR
2020-12-14 15:48:27 -04:00
2023-09-14 16:54:36 -04:00
Metasound : : Frontend : : FDocumentAccessPtr GetDocumentAccessPtr ( ) override ;
Metasound : : Frontend : : FConstDocumentAccessPtr GetDocumentConstAccessPtr ( ) const override ;
2023-03-07 17:01:52 -05:00
private :
virtual FMetasoundFrontendDocument & GetDocument ( ) override
{
return RootMetaSoundDocument ;
}
2023-09-22 15:01:07 -04:00
virtual void OnBeginActiveBuilder ( ) override ;
virtual void OnFinishActiveBuilder ( ) override ;
bool bIsBuilderActive = false ;
2020-12-14 15:48:27 -04:00
} ;