Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Source/Flow/Public/Nodes/FlowPin.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ struct FLOW_API FFlowPin
UPROPERTY(EditDefaultsOnly, Category = FlowPin)
FString PinToolTip;

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "FlowPin")
FLinearColor PinColorModifier = FLinearColor::White;

protected:
// PinType (implies PinCategory)
UPROPERTY(EditAnywhere, Category = FlowPin)
Expand Down
3 changes: 2 additions & 1 deletion Source/FlowEditor/Private/Graph/FlowGraphPinFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ TSharedPtr<SGraphPin> FFlowGraphPinFactory::CreatePin(UEdGraphPin* InPin) const
// Create the widget for a Flow 'Exec'-style pin
if (FlowGraphNode && FFlowPin::IsExecPinCategory(InPin->PinType.PinCategory))
{
const TSharedPtr<SGraphPin> NewPinWidget = SNew(SFlowGraphPinExec, InPin);
const TSharedPtr<SGraphPin> NewPinWidget = SNew(SFlowGraphPinExec, InPin)
.PinModifierColor(FlowGraphNode->GetPinModifierColor(InPin));

const UFlowNode* FlowNode = Cast<UFlowNode>(FlowGraphNode->GetFlowNodeBase());

Expand Down
7 changes: 7 additions & 0 deletions Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,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);
}
}
}
Expand Down Expand Up @@ -945,6 +947,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"));
Expand Down
1 change: 1 addition & 0 deletions Source/FlowEditor/Private/Graph/Widgets/SFlowGraphNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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);
Expand Down
6 changes: 6 additions & 0 deletions Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,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);

Expand Down Expand Up @@ -344,6 +346,10 @@ class FLOWEDITOR_API UFlowGraphNode : public UEdGraphNode
UPROPERTY()
FString ErrorMessage;

protected:
UPROPERTY()
TMap<FName, FLinearColor> 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
Expand Down
5 changes: 4 additions & 1 deletion Source/FlowEditor/Public/Graph/Widgets/SFlowGraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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);
Expand Down