Skip to content

Commit

Permalink
Fix start node deletable (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjon2040 authored and MothDoctor committed Jan 28, 2022
1 parent eaf2f99 commit cb90eaf
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions Source/Flow/Private/Nodes/FlowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ UFlowNode::UFlowNode(const FObjectInitializer& ObjectInitializer)
#if WITH_EDITOR
Category = TEXT("Uncategorized");
NodeStyle = EFlowNodeStyle::Default;
bCanDelete = bCanDuplicate = true;
#endif

InputPins = {DefaultInputPin};
Expand Down
1 change: 1 addition & 0 deletions Source/Flow/Private/Nodes/Route/FlowNode_Start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ UFlowNode_Start::UFlowNode_Start(const FObjectInitializer& ObjectInitializer)
#if WITH_EDITOR
Category = TEXT("Route");
NodeStyle = EFlowNodeStyle::InOut;
bCanDelete = bCanDuplicate = false;
#endif

InputPins = {};
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 @@ -44,6 +44,9 @@ class FLOW_API UFlowNode : public UObject, public IVisualLoggerDebugSnapshotInte
UPROPERTY(EditDefaultsOnly, Category = "FlowNode")
EFlowNodeStyle NodeStyle;

uint8 bCanDelete : 1;
uint8 bCanDuplicate : 1;

public:
FFlowNodeEvent OnReconstructionRequested;
#endif
Expand Down
10 changes: 10 additions & 0 deletions Source/FlowEditor/Private/Graph/Nodes/FlowGraphNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,16 @@ void UFlowGraphNode::GetNodeContextMenuActions(class UToolMenu* Menu, class UGra
}
}

bool UFlowGraphNode::CanUserDeleteNode() const
{
return FlowNode ? FlowNode->bCanDelete : Super::CanUserDeleteNode();
}

bool UFlowGraphNode::CanDuplicateNode() const
{
return FlowNode ? FlowNode->bCanDuplicate : Super::CanDuplicateNode();
}

TSharedPtr<SGraphNode> UFlowGraphNode::CreateVisualWidget()
{
return SNew(SFlowGraphNode, this);
Expand Down
3 changes: 2 additions & 1 deletion Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class FLOWEDITOR_API UFlowGraphNode : public UEdGraphNode

// UEdGraphNode
virtual void GetNodeContextMenuActions(class UToolMenu* Menu, class UGraphNodeContextMenuContext* Context) const override;

virtual bool CanUserDeleteNode() const override;
virtual bool CanDuplicateNode() const override;
virtual TSharedPtr<SGraphNode> CreateVisualWidget() override;
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
virtual FLinearColor GetNodeTitleColor() const override;
Expand Down
2 changes: 0 additions & 2 deletions Source/FlowEditor/Public/Graph/Nodes/FlowGraphNode_Start.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ class FLOWEDITOR_API UFlowGraphNode_Start : public UFlowGraphNode

// UEdGraphNode
virtual TSharedPtr<SGraphNode> CreateVisualWidget() override;
virtual bool CanUserDeleteNode() const override { return false; }
virtual bool CanDuplicateNode() const override { return false; }
// --
};

0 comments on commit cb90eaf

Please sign in to comment.