diff --git a/Source/Flow/Public/Nodes/FlowPin.h b/Source/Flow/Public/Nodes/FlowPin.h index 752ae6a5..4142674b 100644 --- a/Source/Flow/Public/Nodes/FlowPin.h +++ b/Source/Flow/Public/Nodes/FlowPin.h @@ -34,6 +34,10 @@ struct FLOW_API FFlowPin UPROPERTY(EditDefaultsOnly, Category = FlowPin) FString PinToolTip; + UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "FlowPin") + FLinearColor PinColorModifier = FLinearColor::White; + + // PinType (implies PinCategory) // Deprecated PinType, use PinTypeName instead (all standard names are defined in FFlowPinTypeNamesStandard) UPROPERTY(Meta = (DeprecatedProperty, DeprecationMessage = "Use PinTypeName instead")) EFlowPinType PinType = EFlowPinType::Invalid; diff --git a/Source/FlowEditor/Private/Graph/FlowGraphPinFactory.cpp b/Source/FlowEditor/Private/Graph/FlowGraphPinFactory.cpp index 55b87437..adffc3dc 100644 --- a/Source/FlowEditor/Private/Graph/FlowGraphPinFactory.cpp +++ b/Source/FlowEditor/Private/Graph/FlowGraphPinFactory.cpp @@ -27,7 +27,8 @@ TSharedPtr FFlowGraphPinFactory::CreatePin(UEdGraphPin* InPin) const // Create the widget for a Flow 'Exec'-style pin if (FlowGraphNode && FFlowPin::IsExecPinCategory(InPin->PinType.PinCategory)) { - const TSharedPtr NewPinWidget = SNew(SFlowGraphPinExec, InPin); + const TSharedPtr NewPinWidget = SNew(SFlowGraphPinExec, InPin) + .PinModifierColor(FlowGraphNode->GetPinModifierColor(InPin)); const UFlowNode* FlowNode = Cast(FlowGraphNode->GetFlowNodeBase()); diff --git a/Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp b/Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp index 92a0910c..967621a6 100644 --- a/Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp +++ b/Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp @@ -378,11 +378,13 @@ void UFlowGraphNode::AllocateDefaultPins() for (const FFlowPin& InputPin : FlowNode->InputPins) { CreateInputPin(InputPin); + PinColorModifierMap.Add(InputPin.PinName, InputPin.PinColorModifier); } for (const FFlowPin& OutputPin : FlowNode->OutputPins) { CreateOutputPin(OutputPin); + PinColorModifierMap.Add(OutputPin.PinName, OutputPin.PinColorModifier); } } } @@ -1003,6 +1005,11 @@ void UFlowGraphNode::AddUserOutput() AddInstancePin(EGPD_Output, FlowNode->CountNumberedOutputs()); } +FLinearColor UFlowGraphNode::GetPinModifierColor(const UEdGraphPin* Pin) const +{ + return PinColorModifierMap.FindRef(Pin->PinName, FColor::White); +} + void UFlowGraphNode::AddInstancePin(const EEdGraphPinDirection Direction, const uint8 NumberedPinsAmount) { const FScopedTransaction Transaction(LOCTEXT("AddInstancePin", "Add Instance Pin")); diff --git a/Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp b/Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp index f2b4a118..d53d78b3 100644 --- a/Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp +++ b/Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp @@ -49,6 +49,7 @@ void SFlowGraphPinExec::Construct(const FArguments& InArgs, UEdGraphPin* InPin) { SGraphPinExec::Construct(SGraphPinExec::FArguments(), InPin); bUsePinColorForText = true; + PinColorModifier = InArgs._PinModifierColor; } const FLinearColor SFlowGraphNode::UnselectedNodeTint = FLinearColor(1.0f, 1.0f, 1.0f, 0.5f); diff --git a/Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode.h b/Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode.h index c7a985ad..b76c3ebc 100644 --- a/Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode.h +++ b/Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode.h @@ -196,6 +196,8 @@ class FLOWEDITOR_API UFlowGraphNode : public UEdGraphNode void AddUserInput(); void AddUserOutput(); + FLinearColor GetPinModifierColor(const UEdGraphPin* Pin) const; + // Add pin only on this instance of node, under default pins void AddInstancePin(const EEdGraphPinDirection Direction, const uint8 NumberedPinsAmount); @@ -311,6 +313,10 @@ class FLOWEDITOR_API UFlowGraphNode : public UEdGraphNode UPROPERTY() FString ErrorMessage; +protected: + UPROPERTY() + TMap PinColorModifierMap; + private: /** parent UFlowGraphNode for this node, * note, this is not saved, and is restored in when the graph is opened in the editor via diff --git a/Source/FlowEditor/Public/Graph/Widgets/SFlowGraphNode.h b/Source/FlowEditor/Public/Graph/Widgets/SFlowGraphNode.h index 14063328..26e7c28e 100644 --- a/Source/FlowEditor/Public/Graph/Widgets/SFlowGraphNode.h +++ b/Source/FlowEditor/Public/Graph/Widgets/SFlowGraphNode.h @@ -15,7 +15,10 @@ class FLOWEDITOR_API SFlowGraphPinExec : public SGraphPinExec public: SFlowGraphPinExec(); - SLATE_BEGIN_ARGS(SFlowGraphPinExec) {} + SLATE_BEGIN_ARGS(SFlowGraphPinExec) : + _PinModifierColor(FLinearColor::White) + {} + SLATE_ARGUMENT(FLinearColor, PinModifierColor) SLATE_END_ARGS() void Construct(const FArguments& InArgs, UEdGraphPin* InPin);