2022-10-18 13:07:17 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
#include "SMetasoundGraphPin.h"
|
|
|
|
|
|
|
|
|
|
#include "Logging/TokenizedMessage.h"
|
|
|
|
|
#include "MetasoundEditorModule.h"
|
|
|
|
|
#include "MetasoundFrontendNodeTemplateRegistry.h"
|
|
|
|
|
#include "NodeTemplates/MetasoundFrontendNodeTemplateReroute.h"
|
|
|
|
|
#include "SPinTypeSelector.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Metasound
|
|
|
|
|
{
|
|
|
|
|
namespace Editor
|
|
|
|
|
{
|
- 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 SMetaSoundGraphPinKnot::CanInspectPin(const UEdGraphPin* InPin)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-18 13:07:17 -04:00
|
|
|
void SMetaSoundGraphPinKnot::Construct(const FArguments& InArgs, UEdGraphPin* InPin)
|
|
|
|
|
{
|
|
|
|
|
SGraphPinKnot::Construct(SGraphPinKnot::FArguments(), InPin);
|
|
|
|
|
|
|
|
|
|
TSharedRef<SWidget> PinWidgetRef = SPinTypeSelector::ConstructPinTypeImage(
|
|
|
|
|
MakeAttributeSP(this, &SMetaSoundGraphPinKnot::GetPinIcon),
|
|
|
|
|
MakeAttributeSP(this, &SMetaSoundGraphPinKnot::GetPinColor),
|
|
|
|
|
MakeAttributeSP(this, &SMetaSoundGraphPinKnot::GetSecondaryPinIcon),
|
|
|
|
|
MakeAttributeSP(this, &SMetaSoundGraphPinKnot::GetSecondaryPinColor));
|
|
|
|
|
PinImage = PinWidgetRef;
|
2022-10-22 14:43:51 -04:00
|
|
|
|
|
|
|
|
CacheAccessType();
|
|
|
|
|
CacheHasRequiredConnections();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SMetaSoundGraphPinKnot::CacheHasRequiredConnections()
|
|
|
|
|
{
|
|
|
|
|
using namespace Frontend;
|
|
|
|
|
|
|
|
|
|
bHasRequiredConnections = false;
|
|
|
|
|
if (UEdGraphPin* Pin = SGraphPinKnot::GetPinObj())
|
|
|
|
|
{
|
|
|
|
|
if (const UMetasoundEditorGraphExternalNode* OwningNode = Cast<UMetasoundEditorGraphExternalNode>(Pin->GetOwningNode()))
|
|
|
|
|
{
|
|
|
|
|
if (const INodeTemplate* Template = INodeTemplateRegistry::Get().FindTemplate(FRerouteNodeTemplate::GetRegistryKey()))
|
|
|
|
|
{
|
2024-06-27 18:32:11 -04:00
|
|
|
const FMetaSoundFrontendDocumentBuilder& DocBuilder = GetBuilderChecked().GetConstBuilder();
|
|
|
|
|
bHasRequiredConnections = Template->HasRequiredConnections(DocBuilder, DocBuilder.GetBuildPageID(), OwningNode->GetNodeID());
|
2022-10-22 14:43:51 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-18 13:07:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSlateColor SMetaSoundGraphPinKnot::GetPinColor() const
|
|
|
|
|
{
|
|
|
|
|
if (const UEdGraphPin* Pin = SGraphPinKnot::GetPinObj())
|
|
|
|
|
{
|
|
|
|
|
if (Pin->Direction == EGPD_Output)
|
|
|
|
|
{
|
2022-10-22 14:43:51 -04:00
|
|
|
if (!bHasRequiredConnections || Pin->GetOwningNode()->ErrorType <= static_cast<uint32>(EMessageSeverity::Warning))
|
2022-10-18 13:07:17 -04:00
|
|
|
{
|
|
|
|
|
return FLinearColor::Yellow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SGraphPinKnot::GetPinColor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* SMetaSoundGraphPinKnot::GetPinIcon() const
|
|
|
|
|
{
|
|
|
|
|
using namespace Metasound::Frontend;
|
|
|
|
|
|
|
|
|
|
if (const UEdGraphPin* Pin = SGraphPinKnot::GetPinObj())
|
|
|
|
|
{
|
2022-10-22 14:43:51 -04:00
|
|
|
if (!bHasRequiredConnections || Pin->GetOwningNode()->ErrorType <= static_cast<uint32>(EMessageSeverity::Warning))
|
2022-10-18 13:07:17 -04:00
|
|
|
{
|
|
|
|
|
return &Editor::Style::GetSlateBrushSafe("MetasoundEditor.Graph.InvalidReroute");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-22 14:43:51 -04:00
|
|
|
const bool bIsConstructorPin = TMetasoundGraphPin<SGraphPinKnot>::AccessType == EMetasoundFrontendVertexAccessType::Value;
|
2022-10-18 13:07:17 -04:00
|
|
|
if (bIsConstructorPin)
|
|
|
|
|
{
|
|
|
|
|
const bool bIsConnected = IsConnected();
|
|
|
|
|
if (IsArray())
|
|
|
|
|
{
|
|
|
|
|
const FName BrushName = bIsConnected ? "MetasoundEditor.Graph.ConstructorPinArray" : "MetasoundEditor.Graph.ConstructorPinArrayDisconnected";
|
|
|
|
|
return &Editor::Style::GetSlateBrushSafe(BrushName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const FName BrushName = bIsConnected ? "MetasoundEditor.Graph.ConstructorPin" : "MetasoundEditor.Graph.ConstructorPinDisconnected";
|
|
|
|
|
return &Editor::Style::GetSlateBrushSafe(BrushName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SGraphPinKnot::GetPinIcon();
|
|
|
|
|
}
|
|
|
|
|
} // namespace Editor
|
|
|
|
|
} // namespace Metasound
|