From 3d06c5723e460b5c5f4d3352fc87ac9fec27332b Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Mon, 2 Oct 2023 00:57:44 -0400 Subject: [PATCH] Added UComboAction class setting to the action node base class. --- .../ComboActionGraphNode_ActionNodeBase.cpp | 23 +++++++++++++++++ .../ComboActionGraphNode_ActionNodeBase.h | 25 +++++++++++-------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Source/ComboInput/Private/Nodes/ComboActionGraphNode_ActionNodeBase.cpp b/Source/ComboInput/Private/Nodes/ComboActionGraphNode_ActionNodeBase.cpp index 4cb81fb..2614c26 100644 --- a/Source/ComboInput/Private/Nodes/ComboActionGraphNode_ActionNodeBase.cpp +++ b/Source/ComboInput/Private/Nodes/ComboActionGraphNode_ActionNodeBase.cpp @@ -39,6 +39,11 @@ bool UComboActionGraphNode_ActionNodeBase::ValidateNodeRuntime_Implementation() return false; } + if (!this->ComboAction) + { + return false; + } + if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes) { return false; @@ -89,6 +94,24 @@ bool UComboActionGraphNode_ActionNodeBase::ValidateNode(TArray &Validatio ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn)); } + if (!this->ComboAction) + { + bResult = false; + + const FString RichTextReturn = + FString("* "). + Append(""). + Append(NodeTitle.ToString()). + Append(""). + Append(": Does not reference a valid combo action!"); + + const FString TextReturn = + FString(NodeTitle.ToString()). + Append(": Does not reference a valid combo action!"); + + ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn)); + } + if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes) { const FString RichTextReturn = FString("* ") diff --git a/Source/ComboInput/Public/Nodes/ComboActionGraphNode_ActionNodeBase.h b/Source/ComboInput/Public/Nodes/ComboActionGraphNode_ActionNodeBase.h index 200316a..57ae3e2 100644 --- a/Source/ComboInput/Public/Nodes/ComboActionGraphNode_ActionNodeBase.h +++ b/Source/ComboInput/Public/Nodes/ComboActionGraphNode_ActionNodeBase.h @@ -28,18 +28,15 @@ public: virtual void ProcessNode(const TScriptInterface &Manager) override; virtual void PreProcessNode(const TScriptInterface &Manager) override; - /** - * Returns the Dialogue Data Row name. - * ❗ Might be invalid - * - * @return The Dialogue Data Row name. - */ UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action") class UComboInputAsset *GetComboInput() const { return this->ComboInput; } - UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Combo Input|Action") + UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action") enum EComboActionTriggerEvent GetTriggerEvent() const { return this->TriggerEvent; } + UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action") + class UComboAction *GetComboAction() const { return this->ComboAction; } + virtual bool ValidateNodeRuntime_Implementation() const override; public: @@ -47,7 +44,7 @@ public: #if WITH_EDITORONLY_DATA /** - * Shows read-only Texts with localization of selected Dialogue Row. + * Shows read-only Texts with localization of selected row. */ UPROPERTY(Transient, VisibleAnywhere, Category="Base", meta=(MultiLine=true, ShowOnlyInnerProperties)) TArray Preview; @@ -57,14 +54,20 @@ public: #endif protected: - /** Name of row in the table that we want */ + // Combo input to respond to in order to reach this action. UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action") TObjectPtr ComboInput; - /** Name of row in the table that we want */ - UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action"/*, meta=(EditCondition="ComboInput != nullptr")*/) + // Trigger event to respond to in order to reach this action. + UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action") EComboActionTriggerEvent TriggerEvent = EComboActionTriggerEvent::Activated; + // Combo action to fire upon this node's activation. + UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Combo Input|Action") + TObjectPtr ComboAction; + + + #if WITH_EDITOR virtual bool ValidateNode(TArray &ValidationMessages, const bool RichFormat) override;