Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Public/Interfaces/MetasoundFrontendInterfaceRegistry.h
rob gay c97856654f [Backout] - CL33854938
[FYI] bob.tellez
Original CL Desc
-----------------------------------------------------------------
[Backout] - CL33838807
[FYI] Rob.Gay
Original CL Desc
-----------------------------------------------------------------
- Move MetaSound input/output editor validation, GetMemberName/Description, IsInterfaceMember to builder API
- Add warnings on register for interface vertex members (disabled until projects are complaint) to ensure they are following the expected naming convention (i.e. namespace matches that of owning interface)
    - Note this is editor only to avoid spamming cook and failing builds
- Move versioning to use shared builder now that IDocumentBuilderRegistry is available prior to all asset serialize load calls. This ensures that multiple builders are not accessing the same asset when loading and versioning/migrating old editor data
#jira UE-194160
#rb phil.popp
#rnx

[CL 33957350 by rob gay in ue5-main branch]
2024-05-28 18:51:03 -04:00

81 lines
2.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "MetasoundFrontendController.h"
#include "MetasoundFrontendDocument.h"
#include "UObject/NoExportTypes.h"
namespace Metasound::Frontend
{
using FInterfaceRegistryKey = FString;
using FRegistryTransactionID = int32;
METASOUNDFRONTEND_API bool IsValidInterfaceRegistryKey(const FInterfaceRegistryKey& InKey);
METASOUNDFRONTEND_API FInterfaceRegistryKey GetInterfaceRegistryKey(const FMetasoundFrontendVersion& InInterfaceVersion);
METASOUNDFRONTEND_API FInterfaceRegistryKey GetInterfaceRegistryKey(const FMetasoundFrontendInterface& InInterface);
class METASOUNDFRONTEND_API IInterfaceRegistryEntry
{
public:
virtual ~IInterfaceRegistryEntry() = default;
// MetaSound Interface definition
virtual const FMetasoundFrontendInterface& GetInterface() const = 0;
// Whether or not entry is deprecated or not. If false, entry is checked for validity on registration in editor builds.
virtual bool IsDeprecated() const { return false; }
// Name of routing system used to update interface inputs (ex. ParameterInterface or DataReference).
virtual FName GetRouterName() const = 0;
// How to update a given document if versioning is required to this interface from a deprecated version.
virtual bool UpdateRootGraphInterface(FDocumentHandle InDocument) const = 0;
};
class METASOUNDFRONTEND_API FInterfaceRegistryTransaction
{
public:
using FTimeType = uint64;
/** Describes the type of transaction. */
enum class ETransactionType : uint8
{
InterfaceRegistration, //< Something was added to the registry.
InterfaceUnregistration, //< Something was removed from the registry.
Invalid
};
FInterfaceRegistryTransaction(ETransactionType InType, const FInterfaceRegistryKey& InKey, const FMetasoundFrontendVersion& InInterfaceVersion, FTimeType InTimestamp);
ETransactionType GetTransactionType() const;
const FMetasoundFrontendVersion& GetInterfaceVersion() const;
const FInterfaceRegistryKey& GetInterfaceRegistryKey() const;
FTimeType GetTimestamp() const;
private:
ETransactionType Type;
FInterfaceRegistryKey Key;
FMetasoundFrontendVersion InterfaceVersion;
FTimeType Timestamp;
};
class METASOUNDFRONTEND_API IInterfaceRegistry
{
public:
static IInterfaceRegistry& Get();
virtual ~IInterfaceRegistry() = default;
// Register an interface
virtual bool RegisterInterface(TUniquePtr<IInterfaceRegistryEntry>&& InEntry) = 0;
// Find an interface entry with the given key. Returns null if entry not found with given key.
virtual const IInterfaceRegistryEntry* FindInterfaceRegistryEntry(const FInterfaceRegistryKey& InKey) const = 0;
// Find an interface with the given key. Returns true if interface is found, false if not.
virtual bool FindInterface(const FInterfaceRegistryKey& InKey, FMetasoundFrontendInterface& OutInterface) const = 0;
};
} // namespace Metasound::Frontend