Skip to content

Commit

Permalink
tweaking #154: changes to add/remove Custom Inputs
Browse files Browse the repository at this point in the history
- wrap it with WITH_EDITOR
- replace check with with simple if-statement, we don't editor to crash on accidentally provided invalid data
  • Loading branch information
MothDoctor committed May 11, 2023
1 parent ba9b57b commit 8b6c610
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Source/Flow/Private/FlowAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,23 @@ void UFlowAsset::HarvestNodeConnections()
}
}
}
#endif // WITH_EDITOR

void UFlowAsset::AddCustomInput(const FName& InName)
{
check(!CustomInputs.Contains(InName));
CustomInputs.Add(InName);
if (!CustomInputs.Contains(InName))
{
CustomInputs.Add(InName);
}
}

void UFlowAsset::RemoveCustomInput(const FName& InName)
{
check(CustomInputs.Contains(InName));
CustomInputs.Remove(InName);
if (CustomInputs.Contains(InName))
{
CustomInputs.Remove(InName);
}
}
#endif // WITH_EDITOR

UFlowNode* UFlowAsset::GetDefaultEntryNode() const
{
Expand Down
2 changes: 2 additions & 0 deletions Source/Flow/Public/FlowAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ class FLOW_API UFlowAsset : public UObject
const TArray<FName>& GetCustomOutputs() const { return CustomOutputs; }

protected:
#if WITH_EDITOR
void AddCustomInput(const FName& InName);
void RemoveCustomInput(const FName& InName);
#endif

//////////////////////////////////////////////////////////////////////////
// Instances of the template asset
Expand Down

0 comments on commit 8b6c610

Please sign in to comment.