2021-01-13 10:48:59 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "MetasoundFrontendController.h"
|
2021-06-08 10:52:31 -04:00
|
|
|
#include "MetasoundFrontendDocument.h"
|
|
|
|
|
|
2021-01-13 10:48:59 -04:00
|
|
|
|
|
|
|
|
namespace Metasound
|
|
|
|
|
{
|
|
|
|
|
namespace Frontend
|
|
|
|
|
{
|
|
|
|
|
/** Interface for transforms applied to documents. */
|
|
|
|
|
class IDocumentTransform
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual ~IDocumentTransform() = default;
|
|
|
|
|
virtual bool Transform(FDocumentHandle InDocument) const = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Adds or swaps root graph inputs and outputs to match the document's archetype. */
|
|
|
|
|
class METASOUNDFRONTEND_API FMatchRootGraphToArchetype : public IDocumentTransform
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-06-08 10:52:31 -04:00
|
|
|
FMatchRootGraphToArchetype(const FMetasoundFrontendArchetype& InArchetype)
|
|
|
|
|
: Archetype(InArchetype)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-13 10:48:59 -04:00
|
|
|
bool Transform(FDocumentHandle InDocument) const override;
|
2021-06-08 10:52:31 -04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FMetasoundFrontendArchetype Archetype;
|
2021-01-13 10:48:59 -04:00
|
|
|
};
|
2021-05-28 14:09:45 -04:00
|
|
|
|
|
|
|
|
/** Base class for versioning a document. */
|
|
|
|
|
class METASOUNDFRONTEND_API FVersionDocument : public IDocumentTransform
|
|
|
|
|
{
|
2021-06-08 10:52:31 -04:00
|
|
|
const FName Name;
|
|
|
|
|
const FString& Path;
|
|
|
|
|
|
2021-05-28 14:09:45 -04:00
|
|
|
public:
|
2021-06-08 10:52:31 -04:00
|
|
|
static FMetasoundFrontendVersionNumber GetMaxVersion()
|
|
|
|
|
{
|
|
|
|
|
return FMetasoundFrontendVersionNumber { 1, 2 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVersionDocument(FName InName, const FString& InPath);
|
|
|
|
|
|
|
|
|
|
bool Transform(FDocumentHandle InDocument) const override;
|
2021-05-28 14:09:45 -04:00
|
|
|
};
|
2021-01-13 10:48:59 -04:00
|
|
|
}
|
|
|
|
|
}
|