Combo Action Graph is basically finished. The hard part, anyway.
This commit is contained in:
parent
af2b70227d
commit
3d14af4625
@ -26,109 +26,34 @@ UComboActionGraph::UComboActionGraph()
|
||||
#endif
|
||||
}
|
||||
|
||||
TArray<FComboActionDecorator> UComboActionGraph::GetGraphDecorators() const
|
||||
{
|
||||
TArray<FComboActionDecorator> TempReturn;
|
||||
TArray<FComboActionDecorator> Return;
|
||||
|
||||
for (const FComboActionDecorator &Itr : this->GraphDecorators)
|
||||
{
|
||||
if (Itr.DecoratorType != nullptr)
|
||||
{
|
||||
TempReturn.AddUnique(Itr);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Cleanup duplicates
|
||||
for (auto Itr : TempReturn)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
Return = TempReturn;
|
||||
return Return;
|
||||
}
|
||||
|
||||
TArray<FComboActionDecorator> UComboActionGraph::GetAllDecorators() const
|
||||
{
|
||||
TArray<FComboActionDecorator> TempReturn;
|
||||
TArray<FComboActionDecorator> Return;
|
||||
|
||||
for (const UComboActionGraphNode *Itr : this->AllNodes)
|
||||
{
|
||||
if (Itr && Itr->GetNodeDecorators().Num() > 0)
|
||||
{
|
||||
TempReturn.Append(Itr->NodeDecorators);
|
||||
}
|
||||
}
|
||||
|
||||
TempReturn.Append(this->GetGraphDecorators());
|
||||
|
||||
return TempReturn;
|
||||
}
|
||||
|
||||
bool UComboActionGraph::CanStartDialogueGraph() const
|
||||
{
|
||||
bool bSatisfied = true;
|
||||
|
||||
if (this->AllNodes.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& Itr : this->AllNodes)
|
||||
for (const UComboActionGraphNode *Itr : this->AllNodes)
|
||||
{
|
||||
if (!Itr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Itr->ValidateNodeRuntime() == false)
|
||||
if (!Itr || !Itr->ValidateNodeRuntime())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const TArray<FComboActionDecorator> &Decorators = this->GetAllDecorators();
|
||||
|
||||
if (Decorators.Num() == 0)
|
||||
{
|
||||
return bSatisfied;
|
||||
}
|
||||
|
||||
TArray<FText> DecoratorValidations;
|
||||
for (const FComboActionDecorator &Itr : Decorators)
|
||||
{
|
||||
if (Itr.ValidateDecorator(DecoratorValidations) == false) bSatisfied = false;
|
||||
}
|
||||
|
||||
if (DecoratorValidations.Num() > 0)
|
||||
{
|
||||
for(auto Itr : DecoratorValidations)
|
||||
{
|
||||
UE_LOG(LogComboActionGraph, Error, TEXT("%s"), *Itr.ToString());
|
||||
}
|
||||
}
|
||||
return bSatisfied;
|
||||
return true;
|
||||
}
|
||||
|
||||
void UComboActionGraph::CreateGraph()
|
||||
{
|
||||
#if WITH_EDITOR
|
||||
// We already have existing Graph
|
||||
if (this->EdGraph != nullptr)
|
||||
// We already have an existing graph or start node
|
||||
if (this->EdGraph != nullptr || this->StartNode != nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// We already have existing Start Node
|
||||
if (this->StartNode != nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->StartNode = ConstructDialogueNode<UComboActionGraphNode_StartNode>();
|
||||
this->StartNode = this->ConstructActionNode<UComboActionGraphNode_StartNode>();
|
||||
if (this->StartNode != nullptr )
|
||||
{
|
||||
this->StartNode->Graph = this;
|
||||
@ -168,115 +93,10 @@ void UComboActionGraph::PostInitProperties()
|
||||
}
|
||||
|
||||
#if WITH_EDITOR
|
||||
bool UComboActionGraph::ValidateGraph(TArray<FText>& ValidationErrors, bool RichTextFormat)
|
||||
bool UComboActionGraph::ValidateGraph(TArray<FText> &ValidationErrors, bool RichTextFormat)
|
||||
{
|
||||
bool bReturnValue = true;
|
||||
|
||||
// GRAPH DECORATORS VALIDATION
|
||||
{
|
||||
TArray<UComboActionDecoratorBase*> UsedNodeDecorators;
|
||||
for (int i = 0; i < this->GraphDecorators.Num(); i++)
|
||||
{
|
||||
const FComboActionDecorator &Decorator = this->GraphDecorators[i];
|
||||
if (Decorator.DecoratorType)
|
||||
{
|
||||
UsedNodeDecorators.Add(Decorator.DecoratorType);
|
||||
}
|
||||
else
|
||||
{
|
||||
const FString RichTextReturn =
|
||||
FString("* ")
|
||||
.Append( TEXT("<RichTextBlock.Bold>Dialogue Graph</>"))
|
||||
.Append(": has ")
|
||||
.Append(TEXT("<RichTextBlock.Bold>invalid</> Node Decorator at Index: "))
|
||||
.Append(FString::FromInt(i))
|
||||
.Append(".");
|
||||
|
||||
const FString TextReturn =
|
||||
this->GetName()
|
||||
.Append(": has ")
|
||||
.Append(TEXT("INVALID Node Decorator at Index: "))
|
||||
.Append(FString::FromInt(i))
|
||||
.Append(".");
|
||||
|
||||
ValidationErrors.Add(FText::FromString(RichTextFormat ? RichTextReturn : TextReturn));
|
||||
|
||||
bReturnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
TMap<UClass*, int32> DuplicatedDecoratorsMap;
|
||||
for (const auto& Itr : UsedNodeDecorators)
|
||||
{
|
||||
int32 ClassAppearance = 1;
|
||||
for (const auto& Itr2 : UsedNodeDecorators)
|
||||
{
|
||||
if (Itr != Itr2 && Itr->GetClass() == Itr2->GetClass())
|
||||
{
|
||||
auto A = Itr->GetClass()->GetName();
|
||||
ClassAppearance++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ClassAppearance > 1 && DuplicatedDecoratorsMap.Contains(Itr->GetClass()) == false)
|
||||
{
|
||||
DuplicatedDecoratorsMap.Add(Itr->GetClass(), ClassAppearance);
|
||||
}
|
||||
}
|
||||
|
||||
if (DuplicatedDecoratorsMap.Num() > 0)
|
||||
{
|
||||
for (const TTuple<UClass*, int32> &Itr : DuplicatedDecoratorsMap)
|
||||
{
|
||||
bReturnValue = false;
|
||||
|
||||
const FString RichTextReturn =
|
||||
FString("* ")
|
||||
.Append(TEXT("<RichTextBlock.Bold>Dialogue Graph</>"))
|
||||
.Append(": has Node Decorator ")
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(Itr.Key->GetName().LeftChop(2))
|
||||
.Append("</> ")
|
||||
.Append(FString::FromInt(Itr.Value))
|
||||
.Append("x times! Please, avoid duplicates!");
|
||||
|
||||
const FString TextReturn =
|
||||
FString(TEXT("Dialogue Graph: has Node Decorator "))
|
||||
.Append( Itr.Key->GetName().LeftChop(2))
|
||||
.Append(" ")
|
||||
.Append(FString::FromInt(Itr.Value))
|
||||
.Append("x times! Please, avoid duplicates!");
|
||||
|
||||
ValidationErrors.Add(FText::FromString(RichTextFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GRAPH DECORATORS VALIDATION
|
||||
for (const FComboActionDecorator &Itr : this->GraphDecorators)
|
||||
{
|
||||
TArray<FText> DecoratorErrors;
|
||||
if (!Itr.ValidateDecorator(DecoratorErrors))
|
||||
{
|
||||
for (auto Error : DecoratorErrors)
|
||||
{
|
||||
const FString ErrorTextRich =
|
||||
FString("* ")
|
||||
.Append(TEXT("<RichTextBlock.Bold>Dialogue Graph</>: "))
|
||||
.Append(FString(Error.ToString()));
|
||||
|
||||
const FString ErrorTextSimple =
|
||||
this->GetName()
|
||||
.Append(": ")
|
||||
.Append(FString(Error.ToString()));
|
||||
|
||||
ValidationErrors.Add(FText::FromString(RichTextFormat ? ErrorTextRich : ErrorTextSimple));
|
||||
|
||||
bReturnValue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->StartNode == nullptr)
|
||||
{
|
||||
const FString RichTextReturn =
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
#include "Nodes/ComboActionGraphNode.h"
|
||||
|
||||
#include "ComboActionGraph.h"
|
||||
#include "ComboInputAssets.h"
|
||||
#include "ComboInputTriggers.h"
|
||||
|
||||
#include "Data/ComboActionContext.h"
|
||||
#include "Decorators/ComboActionDecoratorBase.h"
|
||||
@ -15,28 +17,27 @@ DEFINE_LOG_CATEGORY(LogComboActionGraphNode);
|
||||
|
||||
UComboActionGraphNode::UComboActionGraphNode()
|
||||
{
|
||||
NodeGUID = FGuid::NewGuid();
|
||||
bInheritGraphDecorators = true;
|
||||
this->NodeGUID = FGuid::NewGuid();
|
||||
|
||||
#if WITH_EDITORONLY_DATA
|
||||
CompatibleGraphType = UComboActionGraph::StaticClass();
|
||||
this->CompatibleGraphType = UComboActionGraph::StaticClass();
|
||||
|
||||
BackgroundColor = FLinearColor::Black;
|
||||
this->BackgroundColor = FLinearColor::Black;
|
||||
|
||||
bAllowInputNodes = true;
|
||||
bAllowOutputNodes = true;
|
||||
this->bAllowInputNodes = true;
|
||||
this->bAllowOutputNodes = true;
|
||||
|
||||
bAllowCopy = true;
|
||||
bAllowCut = true;
|
||||
bAllowDelete = true;
|
||||
bAllowPaste = true;
|
||||
bAllowManualCreate = true;
|
||||
this->bAllowCopy = true;
|
||||
this->bAllowCut = true;
|
||||
this->bAllowDelete = true;
|
||||
this->bAllowPaste = true;
|
||||
this->bAllowManualCreate = true;
|
||||
|
||||
NodeTypeName = LOCTEXT("ComboActionGraphNode_InternalName", "ComboActionGraphNode");
|
||||
NodeTooltipText = LOCTEXT("ComboActionGraphNode_Tooltip", "Combo action graph base node. Child nodes provide more information.");
|
||||
this->NodeTypeName = LOCTEXT("ComboActionGraphNode_InternalName", "ComboActionGraphNode");
|
||||
this->NodeTooltipText = LOCTEXT("ComboActionGraphNode_Tooltip", "Combo action graph base node. Child nodes provide more information.");
|
||||
#endif
|
||||
|
||||
bAutoStarts = false;
|
||||
this->bAutoStarts = false;
|
||||
}
|
||||
|
||||
void UComboActionGraphNode::SetNewWorld(UWorld *NewWorld)
|
||||
@ -83,63 +84,6 @@ void UComboActionGraphNode::ProcessNode(const TScriptInterface<IComboActionGraph
|
||||
//Manager->GetDialogueNodeStartedEventHandle().Broadcast(Context);
|
||||
}
|
||||
|
||||
TArray<FComboActionDecorator> UComboActionGraphNode::GetNodeDecorators() const
|
||||
{
|
||||
TArray<FComboActionDecorator> TempReturn;
|
||||
TArray<FComboActionDecorator> Return;
|
||||
|
||||
for (auto Itr : NodeDecorators)
|
||||
{
|
||||
if (Itr.DecoratorType != nullptr)
|
||||
{
|
||||
TempReturn.AddUnique(Itr);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Cleanup duplicates
|
||||
for (auto Itr : TempReturn)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
Return = TempReturn;
|
||||
return Return;
|
||||
}
|
||||
|
||||
bool UComboActionGraphNode::CanStartNode() const
|
||||
{
|
||||
return this->EvaluateDecorators();
|
||||
}
|
||||
|
||||
bool UComboActionGraphNode::EvaluateDecorators() const
|
||||
{
|
||||
if (this->GetGraph() == nullptr)
|
||||
{
|
||||
UE_LOG(LogComboActionGraphNode, Error, TEXT("[EvaluateDecorators] Graph is null (invalid)!"))
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bSatisfied = true;
|
||||
TArray<FComboActionDecorator> AllDecorators;
|
||||
if (this->bInheritGraphDecorators)
|
||||
{
|
||||
// Add those Decorators rather than asking Graph to evaluate, because Nodes might introduce specific context
|
||||
AllDecorators.Append(GetGraph()->GetGraphDecorators());
|
||||
}
|
||||
|
||||
AllDecorators.Append(GetNodeDecorators());
|
||||
|
||||
if (AllDecorators.Num() == 0) return bSatisfied;
|
||||
|
||||
for (auto Itr : AllDecorators)
|
||||
{
|
||||
if (Itr.EvaluateDecorator() == false) bSatisfied = false;
|
||||
}
|
||||
|
||||
return bSatisfied;
|
||||
}
|
||||
|
||||
void UComboActionGraphNode::SetNodeIndex(const int32 NewIndex)
|
||||
{
|
||||
check(NewIndex>INDEX_NONE);
|
||||
@ -213,6 +157,7 @@ bool UComboActionGraphNode::CanCreateConnection(UComboActionGraphNode *Other, en
|
||||
bool UComboActionGraphNode::ValidateNode(TArray<FText> &ValidationsMessages, const bool RichFormat)
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
if (this->ParentNodes.Num() == 0 && this->ChildrenNodes.Num() == 0)
|
||||
{
|
||||
bResult = false;
|
||||
@ -240,155 +185,32 @@ bool UComboActionGraphNode::ValidateNode(TArray<FText> &ValidationsMessages, con
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(this->NodeTitle.ToString())
|
||||
.Append("</>")
|
||||
.Append(": This Node requires Inputs, however, none are found!");
|
||||
.Append(": This node requires inputs, however none are found!");
|
||||
|
||||
const FString TextReturn =
|
||||
FString(this->NodeTitle.ToString())
|
||||
.Append(": This Node requires Inputs, however, none are found!");
|
||||
.Append(": This node requires inputs, however none are found!");
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
|
||||
// DECORATORS VALIDATION
|
||||
{
|
||||
TArray<UComboActionDecoratorBase*> UsedNodeDecorators;
|
||||
for (int i = 0; i < this->NodeDecorators.Num(); i++)
|
||||
{
|
||||
if (this->NodeDecorators.IsValidIndex(i) && this->NodeDecorators[i].DecoratorType && !UsedNodeDecorators.Contains(this->NodeDecorators[i].DecoratorType))
|
||||
{
|
||||
UsedNodeDecorators.Add(NodeDecorators[i].DecoratorType);
|
||||
}
|
||||
else
|
||||
{
|
||||
const FString RichTextReturn =
|
||||
FString("* ")
|
||||
.Append( TEXT("<RichTextBlock.Bold>"))
|
||||
.Append(GetNodeTitle().ToString())
|
||||
.Append(TEXT("</>"))
|
||||
.Append(": has ")
|
||||
.Append(TEXT("<RichTextBlock.Bold>invalid</> Node Decorator at Index: "))
|
||||
.Append(FString::FromInt(i))
|
||||
.Append(".");
|
||||
|
||||
FString TextReturn = FString(GetNodeTitle().ToString())
|
||||
.Append(": has ")
|
||||
.Append(TEXT("INVALID Node Decorator at Index: "))
|
||||
.Append(FString::FromInt(i))
|
||||
.Append(".");
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
TMap<UClass*, int32> DuplicatedDecoratorsMap;
|
||||
for (const UComboActionDecoratorBase *Itr : UsedNodeDecorators)
|
||||
{
|
||||
int32 ClassAppearance = 1;
|
||||
for (const UComboActionDecoratorBase *Itr2 : UsedNodeDecorators)
|
||||
{
|
||||
if (Itr != Itr2 && Itr->GetClass() == Itr2->GetClass())
|
||||
{
|
||||
auto A = Itr->GetClass()->GetName();
|
||||
ClassAppearance++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ClassAppearance > 1 && DuplicatedDecoratorsMap.Contains(Itr->GetClass()) == false)
|
||||
{
|
||||
DuplicatedDecoratorsMap.Add(Itr->GetClass(), ClassAppearance);
|
||||
}
|
||||
}
|
||||
|
||||
if (DuplicatedDecoratorsMap.Num() > 0)
|
||||
{
|
||||
for (const TTuple<UClass*, int32> &Itr : DuplicatedDecoratorsMap)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
const FString RichTextReturn =
|
||||
FString("* ")
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(this->NodeTitle.ToString())
|
||||
.Append("</>")
|
||||
.Append(": has Node Decorator ")
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(Itr.Key->GetName().LeftChop(2))
|
||||
.Append("</> ")
|
||||
.Append(FString::FromInt(Itr.Value))
|
||||
.Append("x times! Please, avoid duplicates!");
|
||||
|
||||
const FString TextReturn =
|
||||
FString(this->NodeTitle.ToString())
|
||||
.Append(this->NodeTitle.ToString())
|
||||
.Append(": has Node Decorator ")
|
||||
.Append(Itr.Key->GetName().LeftChop(2))
|
||||
.Append(" ")
|
||||
.Append(FString::FromInt(Itr.Value))
|
||||
.Append("x times! Please, avoid duplicates!");
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
}
|
||||
|
||||
for (const FComboActionDecorator &Itr : this->GetNodeDecorators())
|
||||
{
|
||||
TArray<FText> DecoratorErrors;
|
||||
if (!Itr.ValidateDecorator(DecoratorErrors))
|
||||
{
|
||||
for (auto Error : DecoratorErrors)
|
||||
{
|
||||
const FString ErrorTextRich =
|
||||
FString("* ")
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(this->NodeTitle.ToString())
|
||||
.Append("</>: ")
|
||||
.Append(FString(Error.ToString()));
|
||||
|
||||
const FString ErrorTextSimple =
|
||||
FString(this->GetClass()->GetDisplayNameText().ToString())
|
||||
.Append(": ")
|
||||
.Append(FString(Error.ToString()));
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? ErrorTextRich : ErrorTextSimple));
|
||||
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void UComboActionGraphNode::OnPasted()
|
||||
{
|
||||
NodeGUID = FGuid::NewGuid();
|
||||
this->NodeGUID = FGuid::NewGuid();
|
||||
|
||||
ParentNodes.Empty();
|
||||
ChildrenNodes.Empty();
|
||||
Edges.Empty();
|
||||
this->ParentNodes.Empty();
|
||||
this->ChildrenNodes.Empty();
|
||||
this->Edges.Empty();
|
||||
}
|
||||
|
||||
FText UComboActionGraphNode::GetDefaultTooltipBody() const
|
||||
{
|
||||
const FText InheritsValue = this->bInheritGraphDecorators ? LOCTEXT("True","Yes") : LOCTEXT("False","No");
|
||||
const FText Inherits = FText::Format(LOCTEXT("UComboActionGraphNode_InheritsTooltip", "Inherits Graph Decorators: {0}"), InheritsValue);
|
||||
|
||||
FText ImplementsNumber;
|
||||
if (this->NodeDecorators.Num() == 0)
|
||||
{
|
||||
ImplementsNumber = LOCTEXT("None", "-");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImplementsNumber = FText::FromString(FString::FromInt(this->NodeDecorators.Num()));
|
||||
}
|
||||
|
||||
const FText Implements = FText::Format(LOCTEXT("UComboActionGraphNode_ImplementsTooltip", "Implements Decorators: {0}"), ImplementsNumber);
|
||||
|
||||
return FText::Format(LOCTEXT("UComboActionGraphNode_BaseTooltip", "{0}\n\n{1}\n{2}"), this->NodeTypeName, Inherits, Implements);
|
||||
//const FText Inherits = FText::Format(LOCTEXT("UComboActionGraphNode_InheritsTooltip", "Inherits Graph Decorators: {0}"), InheritsValue);
|
||||
//const FText Implements = FText::Format(LOCTEXT("UComboActionGraphNode_ImplementsTooltip", "Implements Decorators: {0}"), ImplementsNumber);
|
||||
return FText::Format(LOCTEXT("UComboActionGraphNode_BaseTooltip", "{0}\n\n{1}\n{2}"), this->NodeTypeName, this->NodeTypeName, this->NodeTypeName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,25 +25,12 @@ UComboActionGraphNode_ActionNode::UComboActionGraphNode_ActionNode()
|
||||
this->AllowedInputClasses.Add(UComboActionGraphNode_ActionNode::StaticClass());
|
||||
|
||||
this->bAutoStarts = false;
|
||||
this->bUseGameplayTags = false;
|
||||
|
||||
this->MaxChildrenNodes = 1;
|
||||
}
|
||||
|
||||
void UComboActionGraphNode_ActionNode::PreProcessNode(const TScriptInterface<IComboActionGraphManagerInterface> &Manager)
|
||||
{
|
||||
if (!bUseGameplayTags)
|
||||
{
|
||||
// Switch Active Participant to Player
|
||||
if (Manager.GetInterface())
|
||||
{
|
||||
//if (const auto TempContext = Manager->GetDialogueContext())
|
||||
//{
|
||||
// TempContext->UpdateActiveDialogueParticipant(TempContext->GetDialoguePlayerParticipant());
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Super::PreProcessNode(Manager);
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
|
||||
#include "Nodes/ComboActionGraphNode_ActionNodeBase.h"
|
||||
|
||||
//#include "Helpers/ComboActionSystemBFC.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "ComboActionGraphNode_ActionNodeBase"
|
||||
|
||||
|
||||
@ -20,87 +17,35 @@ UComboActionGraphNode_ActionNodeBase::UComboActionGraphNode_ActionNodeBase()
|
||||
#endif
|
||||
|
||||
this->bAutoStarts = false;
|
||||
this->bUseGameplayTags = true;
|
||||
}
|
||||
|
||||
void UComboActionGraphNode_ActionNodeBase::ProcessNode(const TScriptInterface<IComboActionGraphManagerInterface> &Manager)
|
||||
{
|
||||
if (Manager)
|
||||
{
|
||||
//if (UComboActionContext *Context = Manager->GetDialogueContext())
|
||||
//{
|
||||
// this->GetWorld()->GetTimerManager().ClearTimer(Manager->GetDialogueRowTimerHandle());
|
||||
|
||||
// const FDialogueRow DialogueRow = UComboActionSystemBFC::GetDialogueRow(Context->ActiveNode);
|
||||
// if (UComboActionSystemBFC::IsDialogueRowValid(DialogueRow) && DialogueRow.DialogueRowData.Array().IsValidIndex(Context->GetActiveDialogueRowDataIndex()))
|
||||
// {
|
||||
// Context->UpdateActiveDialogueRow(DialogueRow);
|
||||
// Context->UpdateActiveDialogueRowDataIndex(Context->ActiveDialogueRowDataIndex);
|
||||
// Manager->GetDialogueContextUpdatedEventHande().Broadcast(Context);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
Super::ProcessNode(Manager);
|
||||
}
|
||||
|
||||
void UComboActionGraphNode_ActionNodeBase::PreProcessNode(const TScriptInterface<IComboActionGraphManagerInterface> &Manager)
|
||||
{
|
||||
if (this->bUseGameplayTags)
|
||||
{
|
||||
// Switch Participants based on Tags
|
||||
if (Manager.GetInterface())
|
||||
{
|
||||
//if (const auto TempContext = Manager->GetDialogueContext())
|
||||
//{
|
||||
// const TScriptInterface<IComboActionParticipantInterface> BestMatchingParticipant = UComboActionSystemBFC::FindBestMatchingParticipant(Manager.GetObject(), TempContext);
|
||||
//
|
||||
// TempContext->UpdateActiveDialogueParticipant(BestMatchingParticipant);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Super::PreProcessNode(Manager);
|
||||
}
|
||||
|
||||
UDataTable *UComboActionGraphNode_ActionNodeBase::GetDataTable() const
|
||||
{
|
||||
return this->DataTable;
|
||||
}
|
||||
|
||||
bool UComboActionGraphNode_ActionNodeBase::ValidateNodeRuntime_Implementation() const
|
||||
{
|
||||
if (this->DataTable == nullptr)
|
||||
if (!this->ComboInput)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//if (this->RowName.IsNone())
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
if (this->TriggerEvent == EComboActionTriggerEvent::None)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//const FString Context;
|
||||
//const FDialogueRow *SelectedRow = DataTable->FindRow<FDialogueRow>(RowName, Context);
|
||||
|
||||
//if (SelectedRow == nullptr)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//if (SelectedRow)
|
||||
//{
|
||||
// if (SelectedRow->DialogueRowData.Num() == 0)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -110,41 +55,41 @@ bool UComboActionGraphNode_ActionNodeBase::ValidateNode(TArray<FText> &Validatio
|
||||
{
|
||||
bool bResult = Super::ValidateNode(ValidationsMessages, RichFormat);
|
||||
|
||||
//if (DataTable == nullptr)
|
||||
//{
|
||||
// bResult = false;
|
||||
if (!this->ComboInput)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
// const FString RichTextReturn =
|
||||
// FString("* ").
|
||||
// Append("<RichTextBlock.Bold>").
|
||||
// Append(NodeTitle.ToString()).
|
||||
// Append("</>").
|
||||
// Append(": Does not contain any Dialogue Data Table!");
|
||||
const FString RichTextReturn =
|
||||
FString("* ").
|
||||
Append("<RichTextBlock.Bold>").
|
||||
Append(NodeTitle.ToString()).
|
||||
Append("</>").
|
||||
Append(": Does not reference a valid combo input!");
|
||||
|
||||
// const FString TextReturn =
|
||||
// FString(NodeTitle.ToString()).
|
||||
// Append(": Does not contain any Dialogue Data Table!");
|
||||
//
|
||||
// ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
//}
|
||||
const FString TextReturn =
|
||||
FString(NodeTitle.ToString()).
|
||||
Append(": Does not reference a valid combo input!");
|
||||
|
||||
//if (this->RowName.IsNone())
|
||||
//{
|
||||
// bResult = false;
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
|
||||
// const FString RichTextReturn =
|
||||
// FString("* ").
|
||||
// Append("<RichTextBlock.Bold>").
|
||||
// Append(NodeTitle.ToString()).
|
||||
// Append("</>").
|
||||
// Append(": Does not contain valid Dialogue Row!");
|
||||
if (this->TriggerEvent == EComboActionTriggerEvent::None)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
// const FString TextReturn =
|
||||
// FString(NodeTitle.ToString()).
|
||||
// Append(": Does not contain valid Dialogue Row!");
|
||||
//
|
||||
// ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
//}
|
||||
const FString RichTextReturn =
|
||||
FString("* ").
|
||||
Append("<RichTextBlock.Bold>").
|
||||
Append(NodeTitle.ToString()).
|
||||
Append("</>").
|
||||
Append(": Does not reference a valid trigger event!");
|
||||
|
||||
const FString TextReturn =
|
||||
FString(NodeTitle.ToString()).
|
||||
Append(": Does not reference a valid trigger event!");
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
|
||||
if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes)
|
||||
{
|
||||
@ -156,56 +101,14 @@ bool UComboActionGraphNode_ActionNodeBase::ValidateNode(TArray<FText> &Validatio
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(FString::FromInt(this->MaxChildrenNodes))
|
||||
.Append("</>")
|
||||
.Append(" Children Nodes!");
|
||||
.Append(" child nodes!");
|
||||
|
||||
const FString TextReturn = FString(this->NodeTitle.ToString())
|
||||
.Append(": Has more than ").Append(FString::FromInt(MaxChildrenNodes)).Append(" Children Nodes!");
|
||||
.Append(": Has more than ").Append(FString::FromInt(this->MaxChildrenNodes)).Append(" child nodes!");
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
|
||||
//const FString Context;
|
||||
//const FDialogueRow* SelectedRow = DataTable!=nullptr ? DataTable->FindRow<FDialogueRow>(RowName, Context) : nullptr;
|
||||
|
||||
//if (SelectedRow == nullptr)
|
||||
//{
|
||||
// bResult = false;
|
||||
|
||||
// const FString RichTextReturn =
|
||||
// FString("* ").
|
||||
// Append("<RichTextBlock.Bold>").
|
||||
// Append(NodeTitle.ToString()).
|
||||
// Append("</>").
|
||||
// Append(": Invalid Selected Row!");
|
||||
|
||||
// const FString TextReturn =
|
||||
// FString(NodeTitle.ToString()).
|
||||
// Append(": Invalid Selected Row!");
|
||||
//
|
||||
// ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
//}
|
||||
|
||||
//if (SelectedRow)
|
||||
//{
|
||||
// if (SelectedRow->DialogueRowData.Num() == 0)
|
||||
// {
|
||||
// bResult = false;
|
||||
|
||||
// const FString RichTextReturn =
|
||||
// FString("* ").
|
||||
// Append("<RichTextBlock.Bold>").
|
||||
// Append(NodeTitle.ToString()).
|
||||
// Append("</>").
|
||||
// Append(": Invalid Selected Row! No Dialogue Data Rows inside!");
|
||||
|
||||
// const FString TextReturn =
|
||||
// FString(NodeTitle.ToString()).
|
||||
// Append(": Invalid Selected Row! No Dialogue Data Rows inside!");
|
||||
//
|
||||
// ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
// }
|
||||
//}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
@ -213,14 +116,13 @@ void UComboActionGraphNode_ActionNodeBase::PostEditChangeProperty(FPropertyChang
|
||||
{
|
||||
Super::PostEditChangeProperty(PropertyChangedEvent);
|
||||
|
||||
if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UComboActionGraphNode_ActionNodeBase, DataTable))
|
||||
if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UComboActionGraphNode_ActionNodeBase, ComboInput))
|
||||
{
|
||||
this->RowName = FName("");
|
||||
this->Preview.Empty();
|
||||
this->PreviewsUpdated.ExecuteIfBound();
|
||||
}
|
||||
|
||||
if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UComboActionGraphNode_ActionNodeBase, RowName))
|
||||
if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UComboActionGraphNode_ActionNodeBase, TriggerEvent))
|
||||
{
|
||||
this->UpdatePreviews();
|
||||
this->PreviewsUpdated.ExecuteIfBound();
|
||||
@ -252,18 +154,6 @@ TArray<FText> UComboActionGraphNode_ActionNodeBase::GetPreviews() const
|
||||
return ReturnValues;
|
||||
}
|
||||
|
||||
void UComboActionGraphNode_ActionNodeBase::UpdatePreviews()
|
||||
{
|
||||
if (!this->DataTable)
|
||||
{
|
||||
this->Preview.Empty();
|
||||
}
|
||||
|
||||
this->Preview.Empty();
|
||||
|
||||
this->Preview = this->GetPreviews();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
@ -56,23 +56,6 @@ bool UComboActionGraphNode_StartNode::ValidateNode(TArray<FText>& ValidationsMes
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
|
||||
if (ChildrenNodes.Num() > 1)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
const FString RichTextReturn =
|
||||
FString("* ")
|
||||
.Append("<RichTextBlock.Bold>")
|
||||
.Append(this->NodeTitle.ToString())
|
||||
.Append("</>")
|
||||
.Append(": Has more than 1 child node.");
|
||||
|
||||
const FString TextReturn = FString(this->NodeTitle.ToString())
|
||||
.Append(": Has more than 1 child node.");
|
||||
|
||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
@ -30,15 +30,6 @@ public:
|
||||
#pragma region Variables
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The list of decorators for the dialogue graph.
|
||||
* Decorators are used to add extra functionality or behavior to the nodes in the graph.
|
||||
* This array should contain an instance of each decorator used in the graph.
|
||||
* The order of the decorators in this array determines the order in which they will be applied to the nodes.
|
||||
*/
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Combo Input|Action", NoClear, meta=(NoResetToDefault))
|
||||
TArray<FComboActionDecorator> GraphDecorators;
|
||||
/**
|
||||
* A set of gameplay tags associated with this dialogue graph.
|
||||
*/
|
||||
@ -109,20 +100,6 @@ public:
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
||||
UComboActionGraphNode *GetStartNode() const { return this->StartNode; }
|
||||
/**
|
||||
* Returns the array of decorators that are associated with this graph.
|
||||
*
|
||||
* @return The array of decorators.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
TArray<FComboActionDecorator> GetGraphDecorators() const;
|
||||
/**
|
||||
* Returns the array of decorators that are associated with this graph and its nodes.
|
||||
*
|
||||
* @return The array of decorators.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
TArray<FComboActionDecorator> GetAllDecorators() const;
|
||||
/**
|
||||
* Determines whether the dialogue graph can be started.
|
||||
*
|
||||
@ -160,12 +137,12 @@ public:
|
||||
|
||||
// Construct and initialize a node within this Dialogue.
|
||||
template<class T>
|
||||
T* ConstructDialogueNode(TSubclassOf<class UComboActionGraphNode> DialogueNodeClass = T::StaticClass())
|
||||
T* ConstructActionNode(TSubclassOf<class UComboActionGraphNode> DialogueNodeClass = T::StaticClass())
|
||||
{
|
||||
// Set flag to be transactional so it registers with undo system
|
||||
T *DialogueNode = NewObject<T>(this, DialogueNodeClass, NAME_None, EObjectFlags::RF_Transactional);
|
||||
DialogueNode->OnCreatedInEditor();
|
||||
return DialogueNode;
|
||||
T *ActionNode = NewObject<T>(this, DialogueNodeClass, NAME_None, EObjectFlags::RF_Transactional);
|
||||
ActionNode->OnCreatedInEditor();
|
||||
return ActionNode;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Decorators/ComboActionDecoratorBase.h"
|
||||
|
||||
#include "ComboActionGraphNode.generated.h"
|
||||
@ -100,21 +101,6 @@ public:
|
||||
*/
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category="Combo Input|Action")
|
||||
int32 MaxChildrenNodes = -1;
|
||||
/**
|
||||
* Indicates whether this node inherits the decorators from its parent Graph.
|
||||
*❗ If true, the decorators of the parent Graph will be inherited and applied to this node during processing.
|
||||
*❔ This flag can be used to control the inheritance of decorators for nodes in the dialogue graph.
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Combo Input|Action")
|
||||
uint8 bInheritGraphDecorators : 1;
|
||||
|
||||
/**
|
||||
* A list of Decorators that can help out with enhancing the Dialogue flow.
|
||||
* Those Decorators are instanced and exist only as "triggers".
|
||||
* Could be used to start audio, play animation or do some logic behind the curtains, like triggering Cutscene etc.
|
||||
*/
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Combo Input|Action", NoClear, meta=(NoResetToDefault))
|
||||
TArray<FComboActionDecorator> NodeDecorators;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@ -140,31 +126,6 @@ public:
|
||||
|
||||
virtual void PreProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager){}
|
||||
virtual void ProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager);
|
||||
/**
|
||||
* Gets the decorators for this Dialogue Graph Node.
|
||||
*❔ Returns only Valid decorators!
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
TArray<FComboActionDecorator> GetNodeDecorators() const;
|
||||
/**
|
||||
* Returns true if the node can be started.
|
||||
*❗ The implementation of this function is up to the subclass.
|
||||
*❔ Can be used to validate if a node can be started before attempting to start it.
|
||||
*❔ This can be further enhanced by Decorators.
|
||||
* @return True if the node can be started, false otherwise.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
virtual bool CanStartNode() const;
|
||||
virtual bool EvaluateDecorators() const;
|
||||
/**
|
||||
* Returns whether this node inherits decorators from the dialogue graph.
|
||||
* If this is set to true, this node will receive all decorators assigned to the graph.
|
||||
* If it's set to false, the node will only have its own decorators.
|
||||
*
|
||||
* @return Whether this node inherits decorators from the graph.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
bool DoesInheritDecorators() const { return bInheritGraphDecorators; }
|
||||
/**
|
||||
* Returns how many Children Nodes this Node allows to have.
|
||||
*❔ -1 means no limits.
|
||||
@ -388,7 +349,7 @@ public:
|
||||
virtual void OnPasted();
|
||||
|
||||
// Generates default Tooltip body text used for all Nodes
|
||||
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Combo Input|Action", meta=(DevelopmentOnly=true))
|
||||
UFUNCTION(BlueprintPure, Category="Combo Input|Action", meta=(DevelopmentOnly=true))
|
||||
FText GetDefaultTooltipBody() const;
|
||||
virtual void OnCreatedInEditor() {};
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "ComboInputTriggers.h"
|
||||
#include "Engine/DataTable.h"
|
||||
//#include "Helpers/ComboActionGraphHelpers.h"
|
||||
#include "Nodes/ComboActionGraphNode.h"
|
||||
#include "UObject/Object.h"
|
||||
|
||||
@ -28,15 +28,6 @@ public:
|
||||
virtual void ProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager) override;
|
||||
virtual void PreProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager) override;
|
||||
|
||||
/**
|
||||
* Returns the Dialogue Data Table for this graph node.
|
||||
* ❗ Might be null
|
||||
*
|
||||
* @return The Dialogue Data Table for this graph node.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
virtual UDataTable *GetDataTable() const;
|
||||
|
||||
/**
|
||||
* Returns the Dialogue Data Row name.
|
||||
* ❗ Might be invalid
|
||||
@ -44,7 +35,10 @@ public:
|
||||
* @return The Dialogue Data Row name.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
||||
virtual FName GetRowName() const { return RowName; }
|
||||
class UComboInputAsset *GetComboInput() const { return this->ComboInput; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Combo Input|Action")
|
||||
enum EComboActionTriggerEvent GetTriggerEvent() const { return this->TriggerEvent; }
|
||||
|
||||
virtual bool ValidateNodeRuntime_Implementation() const override;
|
||||
|
||||
@ -63,43 +57,18 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The data table containing the dialogue rows.
|
||||
* ❗ Strongly suggested to use 'DialogueRow' based Data Tables
|
||||
*/
|
||||
UPROPERTY(SaveGame, Category="Combo Input|Action", EditAnywhere, BlueprintReadOnly, meta=(DisplayThumbnail=false, NoResetToDefault))
|
||||
UDataTable *DataTable;
|
||||
/** Name of row in the table that we want */
|
||||
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action")
|
||||
TObjectPtr<class UComboInputAsset> ComboInput;
|
||||
|
||||
/** Name of row in the table that we want */
|
||||
UPROPERTY(SaveGame, Category="Combo Input|Action", EditAnywhere, BlueprintReadOnly, meta=(GetOptions ="GetRowNames", NoResetToDefault, EditCondition="DataTable!=nullptr"))
|
||||
FName RowName;
|
||||
|
||||
/**
|
||||
* Flag defining how the Participant is searched for.
|
||||
* Default: False
|
||||
*
|
||||
* If True:
|
||||
* * Participant will be found by its Gameplay Tag, compared to Dialogue Row Data.
|
||||
* * ❗Only exact match is considered success
|
||||
* * ❗ First found is used, so use unique Tags when working with multiple Participants (Player01, Player02, NPC.Andrew etc.)
|
||||
*
|
||||
* If False:
|
||||
* * Participant will be found using Node Type
|
||||
* * Lead Node will use NPC
|
||||
* * Answer Node will use Player
|
||||
* * ❗ This system will be deprecated
|
||||
*
|
||||
* ❗ New feature in version 1.0.5.X.
|
||||
* ❔ Each unique dialogue Participant should be using different Tag, if generic, then use something like `Dialogue.NPC`
|
||||
*/
|
||||
UPROPERTY(SaveGame, Category="Combo Input|Action", EditAnywhere, BlueprintReadOnly, meta=(NoResetToDefault))
|
||||
uint8 bUseGameplayTags : 1;
|
||||
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action"/*, meta=(EditCondition="ComboInput != nullptr")*/)
|
||||
EComboActionTriggerEvent TriggerEvent = EComboActionTriggerEvent::Activated;
|
||||
|
||||
#if WITH_EDITOR
|
||||
|
||||
virtual bool ValidateNode(TArray<FText>& ValidationsMessages, const bool RichFormat) override;
|
||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
||||
virtual bool ValidateNode(TArray<FText> &ValidationMessages, const bool RichFormat) override;
|
||||
virtual void PostEditChangeProperty(FPropertyChangedEvent &PropertyChangedEvent) override;
|
||||
virtual FText GetDescription_Implementation() const override;
|
||||
|
||||
public:
|
||||
@ -108,19 +77,6 @@ public:
|
||||
|
||||
#if WITH_EDITORONLY_DATA
|
||||
public:
|
||||
virtual void UpdatePreviews();
|
||||
virtual void UpdatePreviews() { this->Preview = this->GetPreviews(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
UFUNCTION()
|
||||
TArray<FName> GetRowNames() const
|
||||
{
|
||||
if (DataTable)
|
||||
{
|
||||
return DataTable->GetRowNames();
|
||||
}
|
||||
|
||||
return TArray<FName>();
|
||||
}
|
||||
};
|
||||
|
||||
@ -21,28 +21,28 @@ UEdGraphNode *FAssetSchemaAction_ComboActionGraphSchema_NewNode::PerformAction(U
|
||||
{
|
||||
UEdGraphNode *ResultNode = nullptr;
|
||||
|
||||
if (NodeTemplate != nullptr)
|
||||
if (this->NodeTemplate != nullptr)
|
||||
{
|
||||
const FScopedTransaction Transaction(LOCTEXT("ComboActionGraphEditorNewNode", "Combo Action Graph Editor: New Node"));
|
||||
ParentGraph->Modify();
|
||||
if (FromPin != nullptr)
|
||||
FromPin->Modify();
|
||||
|
||||
NodeTemplate->Rename(nullptr, ParentGraph);
|
||||
ParentGraph->AddNode(NodeTemplate, true, bSelectNewNode);
|
||||
this->NodeTemplate->Rename(nullptr, ParentGraph);
|
||||
ParentGraph->AddNode(this->NodeTemplate, true, bSelectNewNode);
|
||||
|
||||
NodeTemplate->CreateNewGuid();
|
||||
NodeTemplate->PostPlacedNewNode();
|
||||
NodeTemplate->AllocateDefaultPins();
|
||||
NodeTemplate->AutowireNewNode(FromPin);
|
||||
this->NodeTemplate->CreateNewGuid();
|
||||
this->NodeTemplate->PostPlacedNewNode();
|
||||
this->NodeTemplate->AllocateDefaultPins();
|
||||
this->NodeTemplate->AutowireNewNode(FromPin);
|
||||
|
||||
NodeTemplate->NodePosX = Location.X;
|
||||
NodeTemplate->NodePosY = Location.Y;
|
||||
this->NodeTemplate->NodePosX = Location.X;
|
||||
this->NodeTemplate->NodePosY = Location.Y;
|
||||
|
||||
NodeTemplate->ComboActionGraphNode->SetFlags(EObjectFlags::RF_Transactional);
|
||||
NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
||||
this->NodeTemplate->ComboActionGraphNode->SetFlags(EObjectFlags::RF_Transactional);
|
||||
this->NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
||||
|
||||
ResultNode = NodeTemplate;
|
||||
ResultNode = this->NodeTemplate;
|
||||
}
|
||||
|
||||
return ResultNode;
|
||||
@ -51,35 +51,35 @@ UEdGraphNode *FAssetSchemaAction_ComboActionGraphSchema_NewNode::PerformAction(U
|
||||
void FAssetSchemaAction_ComboActionGraphSchema_NewNode::AddReferencedObjects(FReferenceCollector &Collector)
|
||||
{
|
||||
FEdGraphSchemaAction::AddReferencedObjects(Collector);
|
||||
Collector.AddReferencedObject(NodeTemplate);
|
||||
Collector.AddReferencedObject(this->NodeTemplate);
|
||||
}
|
||||
|
||||
UEdGraphNode *FAssetSchemaAction_ComboActionGraphSchema_NewEdge::PerformAction(UEdGraph *ParentGraph, UEdGraphPin *FromPin, const FVector2D Location, bool bSelectNewNode)
|
||||
{
|
||||
UEdGraphNode *ResultNode = nullptr;
|
||||
|
||||
if (NodeTemplate != nullptr)
|
||||
if (this->NodeTemplate != nullptr)
|
||||
{
|
||||
const FScopedTransaction Transaction(LOCTEXT("ComboActionGraphEditorNewEdge", "Combo Action Graph Editor: New Edge"));
|
||||
ParentGraph->Modify();
|
||||
if (FromPin != nullptr)
|
||||
FromPin->Modify();
|
||||
|
||||
NodeTemplate->Rename(nullptr, ParentGraph);
|
||||
ParentGraph->AddNode(NodeTemplate, true, bSelectNewNode);
|
||||
this->NodeTemplate->Rename(nullptr, ParentGraph);
|
||||
ParentGraph->AddNode(this->NodeTemplate, true, bSelectNewNode);
|
||||
|
||||
NodeTemplate->CreateNewGuid();
|
||||
NodeTemplate->PostPlacedNewNode();
|
||||
NodeTemplate->AllocateDefaultPins();
|
||||
NodeTemplate->AutowireNewNode(FromPin);
|
||||
this->NodeTemplate->CreateNewGuid();
|
||||
this->NodeTemplate->PostPlacedNewNode();
|
||||
this->NodeTemplate->AllocateDefaultPins();
|
||||
this->NodeTemplate->AutowireNewNode(FromPin);
|
||||
|
||||
NodeTemplate->NodePosX = Location.X;
|
||||
NodeTemplate->NodePosY = Location.Y;
|
||||
this->NodeTemplate->NodePosX = Location.X;
|
||||
this->NodeTemplate->NodePosY = Location.Y;
|
||||
|
||||
NodeTemplate->ComboActionGraphEdge->SetFlags(EObjectFlags::RF_Transactional);
|
||||
NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
||||
this->NodeTemplate->ComboActionGraphEdge->SetFlags(EObjectFlags::RF_Transactional);
|
||||
this->NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
||||
|
||||
ResultNode = NodeTemplate;
|
||||
ResultNode = this->NodeTemplate;
|
||||
}
|
||||
|
||||
return ResultNode;
|
||||
@ -88,7 +88,7 @@ UEdGraphNode *FAssetSchemaAction_ComboActionGraphSchema_NewEdge::PerformAction(U
|
||||
void FAssetSchemaAction_ComboActionGraphSchema_NewEdge::AddReferencedObjects(FReferenceCollector &Collector)
|
||||
{
|
||||
FEdGraphSchemaAction::AddReferencedObjects(Collector);
|
||||
Collector.AddReferencedObject(NodeTemplate);
|
||||
Collector.AddReferencedObject(this->NodeTemplate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ FText UEdComboActionGraphNode::GetTooltipText() const
|
||||
return this->ComboActionGraphNode->GetNodeTooltipText();
|
||||
}
|
||||
|
||||
return NSLOCTEXT("UEdComboActionGraphNode", "DefaultToolTip", "Mountea Dialogue Node");
|
||||
return NSLOCTEXT("UEdComboActionGraphNode", "DefaultToolTip", "Combo Action Node");
|
||||
}
|
||||
|
||||
FSlateIcon UEdComboActionGraphNode::GetIconAndTint(FLinearColor& OutColor) const
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -41,9 +41,6 @@ public:
|
||||
|
||||
virtual const FSlateBrush *GetNameIcon() const;
|
||||
|
||||
virtual const FSlateBrush *GetInheritsImageBrush() const;
|
||||
virtual FSlateColor GetInheritsImageTint() const;
|
||||
|
||||
const FSlateBrush *GetBulletPointImageBrush() const;
|
||||
|
||||
virtual FText GetIndexOverlayTooltipText() const;
|
||||
@ -55,29 +52,20 @@ public:
|
||||
virtual void OnIndexHoverStateChanged(bool bArg) const;
|
||||
virtual FSlateColor GetOverlayWidgetBackgroundColor(bool bArg) const;
|
||||
|
||||
bool HasGraphDecorators() const;
|
||||
bool HasNodeDecorators() const;
|
||||
|
||||
virtual FText GetDecoratorsText() const;
|
||||
virtual FText GetNumberOfDecorators() const;
|
||||
virtual FText GetDecoratorsInheritanceText() const;
|
||||
|
||||
EVisibility ShowImplementsOnlySlot_Unified() const;
|
||||
EVisibility ShowInheritsDecoratorsSlot_Unified() const;
|
||||
EVisibility ShowImplementsOnlySlot_Stack() const;
|
||||
EVisibility ShowInheritsDecoratorsSlot_Stack() const;
|
||||
EVisibility ShowAllDecorators() const;
|
||||
EVisibility ShowDecoratorsBottomPadding() const;
|
||||
|
||||
FSlateColor GetImplementsRowColor() const;
|
||||
FSlateColor GetBulletPointsImagePointColor() const;
|
||||
|
||||
virtual EComboActionDecoratorsInfoStyle GetDecoratorsStyle() const;
|
||||
EVisibility GetStackVisibility() const;
|
||||
EVisibility GetUnifiedVisibility() const;
|
||||
EVisibility GetResponseStackVisibility() const;
|
||||
|
||||
FText GetTooltipText() const;
|
||||
|
||||
FText GetComboInputName() const;
|
||||
FText GetComboInputTriggerActionName() const;
|
||||
|
||||
protected:
|
||||
TSharedPtr<SBorder> NodeBody;
|
||||
TSharedPtr<SHorizontalBox> OutputPinBox;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "ComboInputAssets.h"
|
||||
#include "Ed/EdComboActionGraphNode.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Nodes/ComboActionGraphNode.h"
|
||||
@ -26,7 +27,10 @@ public:
|
||||
#if WITH_EDITOR
|
||||
static FText GetNodeTitle(UComboActionGraphNode *Node)
|
||||
{
|
||||
if (!Node) return FText::FromString("Invalid Node");
|
||||
if (!Node)
|
||||
{
|
||||
return FText::FromString("Invalid Node");
|
||||
}
|
||||
|
||||
const UComboActionGraphEditorSettings *Settings = GetDefault<UComboActionGraphEditorSettings>();
|
||||
if (Settings)
|
||||
@ -35,12 +39,9 @@ public:
|
||||
{
|
||||
if (const UComboActionGraphNode_ActionNodeBase *DialogueNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(Node))
|
||||
{
|
||||
if (DialogueNodeBase->GetDataTable())
|
||||
if (const UComboInputAsset *ComboInput = DialogueNodeBase->GetComboInput())
|
||||
{
|
||||
FString ReturnString;
|
||||
DialogueNodeBase->GetRowName().ToString(ReturnString);
|
||||
|
||||
return FText::FromString(ReturnString);
|
||||
return FText::FromString(ComboInput->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,21 +8,18 @@ struct FComboActionSearchFilter
|
||||
public:
|
||||
bool IsEmptyFilter() const
|
||||
{
|
||||
return SearchString.IsEmpty()
|
||||
&& bIncludeNodeTitle == false
|
||||
&& bIncludeNodeType == false
|
||||
&& bIncludeNodeDecoratorsTypes == false
|
||||
&& bIncludeNodeData == true
|
||||
&& bIncludeNodeGUID == false;
|
||||
return this->SearchString.IsEmpty()
|
||||
&& this->bIncludeNodeTitle == false
|
||||
&& this->bIncludeNodeType == false
|
||||
&& this->bIncludeNodeData == true
|
||||
&& this->bIncludeNodeGUID == false;
|
||||
}
|
||||
|
||||
public:
|
||||
// Search term that the search items must match
|
||||
FString SearchString;
|
||||
|
||||
bool bIncludeNodeTitle = true;
|
||||
bool bIncludeNodeType = true;
|
||||
bool bIncludeNodeDecoratorsTypes = true;
|
||||
bool bIncludeNodeData = true;
|
||||
bool bIncludeNodeGUID = false;
|
||||
};
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "ComboActionSearchManager.h"
|
||||
|
||||
#include "ComboActionGraph.h"
|
||||
#include "ComboInputAssets.h"
|
||||
|
||||
#include "AssetRegistry/AssetRegistryModule.h"
|
||||
#include "Ed/EdComboActionGraph.h"
|
||||
@ -73,34 +74,17 @@ bool FComboActionSearchManager::QueryGraphNode(const FComboActionSearchFilter &S
|
||||
}
|
||||
}
|
||||
|
||||
// Search by Decorators
|
||||
if (SearchFilter.bIncludeNodeDecoratorsTypes)
|
||||
{
|
||||
const TArray<FComboActionDecorator> &NodeDecorators = Node->GetNodeDecorators();
|
||||
for (int32 Index = 0, Num = NodeDecorators.Num(); Index < Num; Index++)
|
||||
{
|
||||
bContainsSearchString = this->QueryNodeDecorators(
|
||||
SearchFilter,
|
||||
NodeDecorators[Index],
|
||||
TreeGraphNode,
|
||||
Index,
|
||||
TEXT("DecoratorType")
|
||||
)
|
||||
|| bContainsSearchString;
|
||||
}
|
||||
}
|
||||
|
||||
// Search by Node Data
|
||||
if (SearchFilter.bIncludeNodeData)
|
||||
{
|
||||
if (const UComboActionGraphNode_ActionNodeBase *ActionNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(Node))
|
||||
{
|
||||
if (ActionNodeBase->GetRowName().ToString().Contains(SearchFilter.SearchString))
|
||||
if (ActionNodeBase->GetComboInput()->GetName().Contains(SearchFilter.SearchString))
|
||||
{
|
||||
bContainsSearchString = true;
|
||||
this->MakeChildTextNode(
|
||||
TreeGraphNode,
|
||||
FText::FromName(FName(Node->NodeTypeName.ToString() )),
|
||||
FText::FromName(FName(Node->NodeTypeName.ToString())),
|
||||
LOCTEXT("NodeDataRowKey", "Node Data"),
|
||||
TEXT("Node Data")
|
||||
);
|
||||
|
||||
@ -339,26 +339,6 @@ TSharedRef<SWidget> SComboActionSearch::FillFilterEntries()
|
||||
EUserInterfaceActionType::ToggleButton
|
||||
);
|
||||
MenuBuilder.AddMenuEntry
|
||||
(
|
||||
LOCTEXT("IncludeNodeDecoratorsTypes", "Include Node Decorators"),
|
||||
LOCTEXT("IncludeNodeDecoratorsTypes_ToolTip", "Include Node Decorators Types (by name) in the search result"),
|
||||
FSlateIcon(),
|
||||
FUIAction(
|
||||
FExecuteAction::CreateLambda([this]()
|
||||
{
|
||||
this->CurrentFilter.bIncludeNodeDecoratorsTypes = !this->CurrentFilter.bIncludeNodeDecoratorsTypes;
|
||||
this->MakeSearchQuery(this->CurrentFilter);
|
||||
}),
|
||||
FCanExecuteAction(),
|
||||
FIsActionChecked::CreateLambda([this]() -> bool
|
||||
{
|
||||
return this->CurrentFilter.bIncludeNodeDecoratorsTypes;
|
||||
})
|
||||
),
|
||||
NAME_None,
|
||||
EUserInterfaceActionType::ToggleButton
|
||||
);
|
||||
MenuBuilder.AddMenuEntry
|
||||
(
|
||||
LOCTEXT("IncludeNodeData", "Include Node Data Row"),
|
||||
LOCTEXT("IncludeNodeDecoratorsTypes_ToolTip", "Include Node Data Row in the search result"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user