You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Undo/Redo fixed when linking/unlinking nodes - Node synchronization fix (adding ghost ed nodes when modifying default value in inspector) - General synchronization logging for easier debugging - Fix nodes jumping back to origin when swapping Metasound archetype #rb aaron.mcleran #jira UE-110503 #jira UEAU-735 #jira UE-111785 #preflight 6063ebe6f8bd0000010081e1 #ROBOMERGE-SOURCE: CL 15871447 in //UE5/Release-5.0-EarlyAccess/... #ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533) [CL 15871453 by rob gay in ue5-main branch]
84 lines
2.6 KiB
C++
84 lines
2.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
#include "MetasoundFrontendTransform.h"
|
|
|
|
#include "MetasoundFrontendDocument.h"
|
|
|
|
|
|
namespace Metasound
|
|
{
|
|
namespace Frontend
|
|
{
|
|
bool FMatchRootGraphToArchetype::Transform(FDocumentHandle InDocument) const
|
|
{
|
|
if (!InDocument->IsValid())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool bDidEdit = false;
|
|
FGraphHandle Graph = InDocument->GetRootGraph();
|
|
|
|
TArray<FMetasoundFrontendClassVertex> RequiredInputs = InDocument->GetRequiredInputs();
|
|
TArray<FMetasoundFrontendClassVertex> RequiredOutputs = InDocument->GetRequiredOutputs();
|
|
|
|
// Go through each input and add or swap if something is missing.
|
|
for (const FMetasoundFrontendClassVertex& RequiredInput : RequiredInputs)
|
|
{
|
|
if (const FMetasoundFrontendClassInput* ClassInput = Graph->FindClassInputWithName(RequiredInput.Name).Get())
|
|
{
|
|
if (!FMetasoundFrontendClassVertex::IsFunctionalEquivalent(RequiredInput, *ClassInput))
|
|
{
|
|
bDidEdit = true;
|
|
|
|
// Cache off node locations to push to new node
|
|
FNodeHandle InputNode = Graph->GetInputNodeWithName(ClassInput->Name);
|
|
const TMap<FGuid, FVector2D> Locations = InputNode->GetNodeStyle().Display.Locations;
|
|
|
|
Graph->RemoveInputVertex(RequiredInput.Name);
|
|
InputNode = Graph->AddInputVertex(RequiredInput);
|
|
|
|
FMetasoundFrontendNodeStyle Style = InputNode->GetNodeStyle();
|
|
Style.Display.Locations = Locations;
|
|
InputNode->SetNodeStyle(Style);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bDidEdit = true;
|
|
Graph->AddInputVertex(RequiredInput);
|
|
}
|
|
}
|
|
|
|
// Go through each output and add or swap if something is missing.
|
|
for (const FMetasoundFrontendClassVertex& RequiredOutput : RequiredOutputs)
|
|
{
|
|
if (const FMetasoundFrontendClassOutput* ClassOutput = Graph->FindClassOutputWithName(RequiredOutput.Name).Get())
|
|
{
|
|
if (!FMetasoundFrontendClassVertex::IsFunctionalEquivalent(RequiredOutput, *ClassOutput))
|
|
{
|
|
bDidEdit = true;
|
|
|
|
// Cache off node locations to push to new node
|
|
FNodeHandle OutputNode = Graph->GetOutputNodeWithName(ClassOutput->Name);
|
|
const TMap<FGuid, FVector2D> Locations = OutputNode->GetNodeStyle().Display.Locations;
|
|
|
|
Graph->RemoveOutputVertex(RequiredOutput.Name);
|
|
OutputNode = Graph->AddOutputVertex(RequiredOutput);
|
|
|
|
FMetasoundFrontendNodeStyle Style = OutputNode->GetNodeStyle();
|
|
Style.Display.Locations = Locations;
|
|
OutputNode->SetNodeStyle(Style);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bDidEdit = true;
|
|
Graph->AddOutputVertex(RequiredOutput);
|
|
}
|
|
}
|
|
|
|
return bDidEdit;
|
|
}
|
|
} // namespace Frontend
|
|
} // namespace Metasound
|