diff --git a/Source/Flow/Public/Nodes/FlowPin.h b/Source/Flow/Public/Nodes/FlowPin.h index 465a2cf1..a3e8afe9 100644 --- a/Source/Flow/Public/Nodes/FlowPin.h +++ b/Source/Flow/Public/Nodes/FlowPin.h @@ -34,6 +34,9 @@ struct FLOW_API FFlowPin UPROPERTY(EditDefaultsOnly, Category = DataPins) FString PinToolTip; + UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "FlowPin") + FLinearColor PinColorModifier = FLinearColor::White; + // PinType (implies PinCategory) 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 9864a54e..838175ef 100644 --- a/Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp +++ b/Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp @@ -376,11 +376,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); } } } @@ -1001,6 +1003,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 78c54ff2..8a9daf99 100644 --- a/Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp +++ b/Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp @@ -48,6 +48,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 c01ccef9..5ac2bedd 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 2428d41b..3dd2804e 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);