Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundEditor/Private/SMetasoundGraphPin.cpp
rob gay b3ab5744bf - 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

100 lines
3.1 KiB
C++

// 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
{
bool SMetaSoundGraphPinKnot::CanInspectPin(const UEdGraphPin* InPin)
{
return false;
}
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;
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()))
{
bHasRequiredConnections = Template->HasRequiredConnections(GetBuilderChecked().GetConstBuilder(), OwningNode->GetNodeID());
}
}
}
}
FSlateColor SMetaSoundGraphPinKnot::GetPinColor() const
{
if (const UEdGraphPin* Pin = SGraphPinKnot::GetPinObj())
{
if (Pin->Direction == EGPD_Output)
{
if (!bHasRequiredConnections || Pin->GetOwningNode()->ErrorType <= static_cast<uint32>(EMessageSeverity::Warning))
{
return FLinearColor::Yellow;
}
}
}
return SGraphPinKnot::GetPinColor();
}
const FSlateBrush* SMetaSoundGraphPinKnot::GetPinIcon() const
{
using namespace Metasound::Frontend;
if (const UEdGraphPin* Pin = SGraphPinKnot::GetPinObj())
{
if (!bHasRequiredConnections || Pin->GetOwningNode()->ErrorType <= static_cast<uint32>(EMessageSeverity::Warning))
{
return &Editor::Style::GetSlateBrushSafe("MetasoundEditor.Graph.InvalidReroute");
}
}
const bool bIsConstructorPin = TMetasoundGraphPin<SGraphPinKnot>::AccessType == EMetasoundFrontendVertexAccessType::Value;
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