From 8b6c6108f7d6766f3fe0456c9c0c47aae3cc9e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysiek=20Justy=C5=84ski?= Date: Fri, 12 May 2023 00:03:09 +0200 Subject: [PATCH] tweaking #154: changes to add/remove Custom Inputs - wrap it with WITH_EDITOR - replace check with with simple if-statement, we don't editor to crash on accidentally provided invalid data --- Source/Flow/Private/FlowAsset.cpp | 14 +++++++++----- Source/Flow/Public/FlowAsset.h | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/Flow/Private/FlowAsset.cpp b/Source/Flow/Private/FlowAsset.cpp index 86dd4420..af26ab62 100644 --- a/Source/Flow/Private/FlowAsset.cpp +++ b/Source/Flow/Private/FlowAsset.cpp @@ -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 { diff --git a/Source/Flow/Public/FlowAsset.h b/Source/Flow/Public/FlowAsset.h index 4d7e0223..8ab10aaa 100644 --- a/Source/Flow/Public/FlowAsset.h +++ b/Source/Flow/Public/FlowAsset.h @@ -187,8 +187,10 @@ class FLOW_API UFlowAsset : public UObject const TArray& GetCustomOutputs() const { return CustomOutputs; } protected: +#if WITH_EDITOR void AddCustomInput(const FName& InName); void RemoveCustomInput(const FName& InName); +#endif ////////////////////////////////////////////////////////////////////////// // Instances of the template asset