Skip to content

Commit

Permalink
added Is Input Connected method #96
Browse files Browse the repository at this point in the history
  • Loading branch information
MothDoctor committed Mar 30, 2022
1 parent acd4260 commit ea7e0d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Source/Flow/Private/Nodes/FlowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,28 @@ TSet<UFlowNode*> UFlowNode::GetConnectedNodes() const
return Result;
}

bool UFlowNode::IsInputConnected(const FName& PinName) const
{
if (GetFlowAsset())
{
for (const TPair<FGuid, UFlowNode*>& Pair : GetFlowAsset()->Nodes)
{
if (Pair.Value)
{
for (const TPair<FName, FConnectedPin>& Connection : Pair.Value->Connections)
{
if (Connection.Value.NodeGuid == NodeGuid && Connection.Value.PinName == PinName)
{
return true;
}
}
}
}
}

return false;
}

bool UFlowNode::IsOutputConnected(const FName& PinName) const
{
return OutputPins.Contains(PinName) && Connections.Contains(PinName);
Expand Down
3 changes: 3 additions & 0 deletions Source/Flow/Public/Nodes/FlowNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ class FLOW_API UFlowNode : public UObject, public IVisualLoggerDebugSnapshotInte
FConnectedPin GetConnection(const FName OutputName) const { return Connections.FindRef(OutputName); }
TSet<UFlowNode*> GetConnectedNodes() const;

UFUNCTION(BlueprintPure, Category= "FlowNode")
bool IsInputConnected(const FName& PinName) const;

UFUNCTION(BlueprintPure, Category= "FlowNode")
bool IsOutputConnected(const FName& PinName) const;

Expand Down

0 comments on commit ea7e0d4

Please sign in to comment.