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
|
#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 UComboActionGraph::CanStartDialogueGraph() const
|
||||||
{
|
{
|
||||||
bool bSatisfied = true;
|
|
||||||
|
|
||||||
if (this->AllNodes.Num() == 0)
|
if (this->AllNodes.Num() == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& Itr : this->AllNodes)
|
for (const UComboActionGraphNode *Itr : this->AllNodes)
|
||||||
{
|
{
|
||||||
if (!Itr)
|
if (!Itr || !Itr->ValidateNodeRuntime())
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Itr->ValidateNodeRuntime() == false)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TArray<FComboActionDecorator> &Decorators = this->GetAllDecorators();
|
return true;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraph::CreateGraph()
|
void UComboActionGraph::CreateGraph()
|
||||||
{
|
{
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
// We already have existing Graph
|
// We already have an existing graph or start node
|
||||||
if (this->EdGraph != nullptr)
|
if (this->EdGraph != nullptr || this->StartNode != nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We already have existing Start Node
|
this->StartNode = this->ConstructActionNode<UComboActionGraphNode_StartNode>();
|
||||||
if (this->StartNode != nullptr)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->StartNode = ConstructDialogueNode<UComboActionGraphNode_StartNode>();
|
|
||||||
if (this->StartNode != nullptr )
|
if (this->StartNode != nullptr )
|
||||||
{
|
{
|
||||||
this->StartNode->Graph = this;
|
this->StartNode->Graph = this;
|
||||||
@ -168,115 +93,10 @@ void UComboActionGraph::PostInitProperties()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
bool UComboActionGraph::ValidateGraph(TArray<FText>& ValidationErrors, bool RichTextFormat)
|
bool UComboActionGraph::ValidateGraph(TArray<FText> &ValidationErrors, bool RichTextFormat)
|
||||||
{
|
{
|
||||||
bool bReturnValue = true;
|
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)
|
if (this->StartNode == nullptr)
|
||||||
{
|
{
|
||||||
const FString RichTextReturn =
|
const FString RichTextReturn =
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
#include "Nodes/ComboActionGraphNode.h"
|
#include "Nodes/ComboActionGraphNode.h"
|
||||||
|
|
||||||
#include "ComboActionGraph.h"
|
#include "ComboActionGraph.h"
|
||||||
|
#include "ComboInputAssets.h"
|
||||||
|
#include "ComboInputTriggers.h"
|
||||||
|
|
||||||
#include "Data/ComboActionContext.h"
|
#include "Data/ComboActionContext.h"
|
||||||
#include "Decorators/ComboActionDecoratorBase.h"
|
#include "Decorators/ComboActionDecoratorBase.h"
|
||||||
@ -15,28 +17,27 @@ DEFINE_LOG_CATEGORY(LogComboActionGraphNode);
|
|||||||
|
|
||||||
UComboActionGraphNode::UComboActionGraphNode()
|
UComboActionGraphNode::UComboActionGraphNode()
|
||||||
{
|
{
|
||||||
NodeGUID = FGuid::NewGuid();
|
this->NodeGUID = FGuid::NewGuid();
|
||||||
bInheritGraphDecorators = true;
|
|
||||||
|
|
||||||
#if WITH_EDITORONLY_DATA
|
#if WITH_EDITORONLY_DATA
|
||||||
CompatibleGraphType = UComboActionGraph::StaticClass();
|
this->CompatibleGraphType = UComboActionGraph::StaticClass();
|
||||||
|
|
||||||
BackgroundColor = FLinearColor::Black;
|
this->BackgroundColor = FLinearColor::Black;
|
||||||
|
|
||||||
bAllowInputNodes = true;
|
this->bAllowInputNodes = true;
|
||||||
bAllowOutputNodes = true;
|
this->bAllowOutputNodes = true;
|
||||||
|
|
||||||
bAllowCopy = true;
|
this->bAllowCopy = true;
|
||||||
bAllowCut = true;
|
this->bAllowCut = true;
|
||||||
bAllowDelete = true;
|
this->bAllowDelete = true;
|
||||||
bAllowPaste = true;
|
this->bAllowPaste = true;
|
||||||
bAllowManualCreate = true;
|
this->bAllowManualCreate = true;
|
||||||
|
|
||||||
NodeTypeName = LOCTEXT("ComboActionGraphNode_InternalName", "ComboActionGraphNode");
|
this->NodeTypeName = LOCTEXT("ComboActionGraphNode_InternalName", "ComboActionGraphNode");
|
||||||
NodeTooltipText = LOCTEXT("ComboActionGraphNode_Tooltip", "Combo action graph base node. Child nodes provide more information.");
|
this->NodeTooltipText = LOCTEXT("ComboActionGraphNode_Tooltip", "Combo action graph base node. Child nodes provide more information.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bAutoStarts = false;
|
this->bAutoStarts = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraphNode::SetNewWorld(UWorld *NewWorld)
|
void UComboActionGraphNode::SetNewWorld(UWorld *NewWorld)
|
||||||
@ -83,63 +84,6 @@ void UComboActionGraphNode::ProcessNode(const TScriptInterface<IComboActionGraph
|
|||||||
//Manager->GetDialogueNodeStartedEventHandle().Broadcast(Context);
|
//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)
|
void UComboActionGraphNode::SetNodeIndex(const int32 NewIndex)
|
||||||
{
|
{
|
||||||
check(NewIndex>INDEX_NONE);
|
check(NewIndex>INDEX_NONE);
|
||||||
@ -213,6 +157,7 @@ bool UComboActionGraphNode::CanCreateConnection(UComboActionGraphNode *Other, en
|
|||||||
bool UComboActionGraphNode::ValidateNode(TArray<FText> &ValidationsMessages, const bool RichFormat)
|
bool UComboActionGraphNode::ValidateNode(TArray<FText> &ValidationsMessages, const bool RichFormat)
|
||||||
{
|
{
|
||||||
bool bResult = true;
|
bool bResult = true;
|
||||||
|
|
||||||
if (this->ParentNodes.Num() == 0 && this->ChildrenNodes.Num() == 0)
|
if (this->ParentNodes.Num() == 0 && this->ChildrenNodes.Num() == 0)
|
||||||
{
|
{
|
||||||
bResult = false;
|
bResult = false;
|
||||||
@ -240,155 +185,32 @@ bool UComboActionGraphNode::ValidateNode(TArray<FText> &ValidationsMessages, con
|
|||||||
.Append("<RichTextBlock.Bold>")
|
.Append("<RichTextBlock.Bold>")
|
||||||
.Append(this->NodeTitle.ToString())
|
.Append(this->NodeTitle.ToString())
|
||||||
.Append("</>")
|
.Append("</>")
|
||||||
.Append(": This Node requires Inputs, however, none are found!");
|
.Append(": This node requires inputs, however none are found!");
|
||||||
|
|
||||||
const FString TextReturn =
|
const FString TextReturn =
|
||||||
FString(this->NodeTitle.ToString())
|
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));
|
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;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraphNode::OnPasted()
|
void UComboActionGraphNode::OnPasted()
|
||||||
{
|
{
|
||||||
NodeGUID = FGuid::NewGuid();
|
this->NodeGUID = FGuid::NewGuid();
|
||||||
|
|
||||||
ParentNodes.Empty();
|
this->ParentNodes.Empty();
|
||||||
ChildrenNodes.Empty();
|
this->ChildrenNodes.Empty();
|
||||||
Edges.Empty();
|
this->Edges.Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
FText UComboActionGraphNode::GetDefaultTooltipBody() const
|
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);
|
||||||
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);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -25,25 +25,12 @@ UComboActionGraphNode_ActionNode::UComboActionGraphNode_ActionNode()
|
|||||||
this->AllowedInputClasses.Add(UComboActionGraphNode_ActionNode::StaticClass());
|
this->AllowedInputClasses.Add(UComboActionGraphNode_ActionNode::StaticClass());
|
||||||
|
|
||||||
this->bAutoStarts = false;
|
this->bAutoStarts = false;
|
||||||
this->bUseGameplayTags = false;
|
|
||||||
|
|
||||||
this->MaxChildrenNodes = 1;
|
this->MaxChildrenNodes = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraphNode_ActionNode::PreProcessNode(const TScriptInterface<IComboActionGraphManagerInterface> &Manager)
|
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);
|
Super::PreProcessNode(Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||||
|
|
||||||
|
|
||||||
#include "Nodes/ComboActionGraphNode_ActionNodeBase.h"
|
#include "Nodes/ComboActionGraphNode_ActionNodeBase.h"
|
||||||
|
|
||||||
//#include "Helpers/ComboActionSystemBFC.h"
|
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "ComboActionGraphNode_ActionNodeBase"
|
#define LOCTEXT_NAMESPACE "ComboActionGraphNode_ActionNodeBase"
|
||||||
|
|
||||||
|
|
||||||
@ -20,86 +17,34 @@ UComboActionGraphNode_ActionNodeBase::UComboActionGraphNode_ActionNodeBase()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->bAutoStarts = false;
|
this->bAutoStarts = false;
|
||||||
this->bUseGameplayTags = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraphNode_ActionNodeBase::ProcessNode(const TScriptInterface<IComboActionGraphManagerInterface> &Manager)
|
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);
|
Super::ProcessNode(Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraphNode_ActionNodeBase::PreProcessNode(const TScriptInterface<IComboActionGraphManagerInterface> &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);
|
Super::PreProcessNode(Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
UDataTable *UComboActionGraphNode_ActionNodeBase::GetDataTable() const
|
|
||||||
{
|
|
||||||
return this->DataTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UComboActionGraphNode_ActionNodeBase::ValidateNodeRuntime_Implementation() const
|
bool UComboActionGraphNode_ActionNodeBase::ValidateNodeRuntime_Implementation() const
|
||||||
{
|
{
|
||||||
if (this->DataTable == nullptr)
|
if (!this->ComboInput)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (this->RowName.IsNone())
|
if (this->TriggerEvent == EComboActionTriggerEvent::None)
|
||||||
//{
|
{
|
||||||
// return false;
|
return false;
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes)
|
if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes)
|
||||||
{
|
{
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -110,41 +55,41 @@ bool UComboActionGraphNode_ActionNodeBase::ValidateNode(TArray<FText> &Validatio
|
|||||||
{
|
{
|
||||||
bool bResult = Super::ValidateNode(ValidationsMessages, RichFormat);
|
bool bResult = Super::ValidateNode(ValidationsMessages, RichFormat);
|
||||||
|
|
||||||
//if (DataTable == nullptr)
|
if (!this->ComboInput)
|
||||||
//{
|
{
|
||||||
// bResult = false;
|
bResult = false;
|
||||||
|
|
||||||
// const FString RichTextReturn =
|
const FString RichTextReturn =
|
||||||
// FString("* ").
|
FString("* ").
|
||||||
// Append("<RichTextBlock.Bold>").
|
Append("<RichTextBlock.Bold>").
|
||||||
// Append(NodeTitle.ToString()).
|
Append(NodeTitle.ToString()).
|
||||||
// Append("</>").
|
Append("</>").
|
||||||
// Append(": Does not contain any Dialogue Data Table!");
|
Append(": Does not reference a valid combo input!");
|
||||||
|
|
||||||
// const FString TextReturn =
|
const FString TextReturn =
|
||||||
// FString(NodeTitle.ToString()).
|
FString(NodeTitle.ToString()).
|
||||||
// Append(": Does not contain any Dialogue Data Table!");
|
Append(": Does not reference a valid combo input!");
|
||||||
//
|
|
||||||
// ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (this->RowName.IsNone())
|
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
||||||
//{
|
}
|
||||||
// bResult = false;
|
|
||||||
|
|
||||||
// const FString RichTextReturn =
|
if (this->TriggerEvent == EComboActionTriggerEvent::None)
|
||||||
// FString("* ").
|
{
|
||||||
// Append("<RichTextBlock.Bold>").
|
bResult = false;
|
||||||
// Append(NodeTitle.ToString()).
|
|
||||||
// Append("</>").
|
|
||||||
// Append(": Does not contain valid Dialogue Row!");
|
|
||||||
|
|
||||||
// const FString TextReturn =
|
const FString RichTextReturn =
|
||||||
// FString(NodeTitle.ToString()).
|
FString("* ").
|
||||||
// Append(": Does not contain valid Dialogue Row!");
|
Append("<RichTextBlock.Bold>").
|
||||||
//
|
Append(NodeTitle.ToString()).
|
||||||
// ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
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)
|
if (this->MaxChildrenNodes > -1 && this->ChildrenNodes.Num() > this->MaxChildrenNodes)
|
||||||
{
|
{
|
||||||
@ -156,55 +101,13 @@ bool UComboActionGraphNode_ActionNodeBase::ValidateNode(TArray<FText> &Validatio
|
|||||||
.Append("<RichTextBlock.Bold>")
|
.Append("<RichTextBlock.Bold>")
|
||||||
.Append(FString::FromInt(this->MaxChildrenNodes))
|
.Append(FString::FromInt(this->MaxChildrenNodes))
|
||||||
.Append("</>")
|
.Append("</>")
|
||||||
.Append(" Children Nodes!");
|
.Append(" child nodes!");
|
||||||
|
|
||||||
const FString TextReturn = FString(this->NodeTitle.ToString())
|
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));
|
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;
|
return bResult;
|
||||||
}
|
}
|
||||||
@ -213,14 +116,13 @@ void UComboActionGraphNode_ActionNodeBase::PostEditChangeProperty(FPropertyChang
|
|||||||
{
|
{
|
||||||
Super::PostEditChangeProperty(PropertyChangedEvent);
|
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->Preview.Empty();
|
||||||
this->PreviewsUpdated.ExecuteIfBound();
|
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->UpdatePreviews();
|
||||||
this->PreviewsUpdated.ExecuteIfBound();
|
this->PreviewsUpdated.ExecuteIfBound();
|
||||||
@ -252,18 +154,6 @@ TArray<FText> UComboActionGraphNode_ActionNodeBase::GetPreviews() const
|
|||||||
return ReturnValues;
|
return ReturnValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UComboActionGraphNode_ActionNodeBase::UpdatePreviews()
|
|
||||||
{
|
|
||||||
if (!this->DataTable)
|
|
||||||
{
|
|
||||||
this->Preview.Empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Preview.Empty();
|
|
||||||
|
|
||||||
this->Preview = this->GetPreviews();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef LOCTEXT_NAMESPACE
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
|||||||
@ -56,23 +56,6 @@ bool UComboActionGraphNode_StartNode::ValidateNode(TArray<FText>& ValidationsMes
|
|||||||
ValidationsMessages.Add(FText::FromString(RichFormat ? RichTextReturn : TextReturn));
|
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;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,15 +30,6 @@ public:
|
|||||||
#pragma region Variables
|
#pragma region Variables
|
||||||
|
|
||||||
protected:
|
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.
|
* A set of gameplay tags associated with this dialogue graph.
|
||||||
*/
|
*/
|
||||||
@ -109,20 +100,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
||||||
UComboActionGraphNode *GetStartNode() const { return this->StartNode; }
|
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.
|
* Determines whether the dialogue graph can be started.
|
||||||
*
|
*
|
||||||
@ -160,12 +137,12 @@ public:
|
|||||||
|
|
||||||
// Construct and initialize a node within this Dialogue.
|
// Construct and initialize a node within this Dialogue.
|
||||||
template<class T>
|
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
|
// Set flag to be transactional so it registers with undo system
|
||||||
T *DialogueNode = NewObject<T>(this, DialogueNodeClass, NAME_None, EObjectFlags::RF_Transactional);
|
T *ActionNode = NewObject<T>(this, DialogueNodeClass, NAME_None, EObjectFlags::RF_Transactional);
|
||||||
DialogueNode->OnCreatedInEditor();
|
ActionNode->OnCreatedInEditor();
|
||||||
return DialogueNode;
|
return ActionNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
#include "Decorators/ComboActionDecoratorBase.h"
|
#include "Decorators/ComboActionDecoratorBase.h"
|
||||||
|
|
||||||
#include "ComboActionGraphNode.generated.h"
|
#include "ComboActionGraphNode.generated.h"
|
||||||
@ -100,21 +101,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category="Combo Input|Action")
|
||||||
int32 MaxChildrenNodes = -1;
|
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
|
#pragma endregion
|
||||||
|
|
||||||
@ -140,31 +126,6 @@ public:
|
|||||||
|
|
||||||
virtual void PreProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager){}
|
virtual void PreProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager){}
|
||||||
virtual void ProcessNode(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.
|
* Returns how many Children Nodes this Node allows to have.
|
||||||
*❔ -1 means no limits.
|
*❔ -1 means no limits.
|
||||||
@ -388,7 +349,7 @@ public:
|
|||||||
virtual void OnPasted();
|
virtual void OnPasted();
|
||||||
|
|
||||||
// Generates default Tooltip body text used for all Nodes
|
// 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;
|
FText GetDefaultTooltipBody() const;
|
||||||
virtual void OnCreatedInEditor() {};
|
virtual void OnCreatedInEditor() {};
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
|
#include "ComboInputTriggers.h"
|
||||||
#include "Engine/DataTable.h"
|
#include "Engine/DataTable.h"
|
||||||
//#include "Helpers/ComboActionGraphHelpers.h"
|
|
||||||
#include "Nodes/ComboActionGraphNode.h"
|
#include "Nodes/ComboActionGraphNode.h"
|
||||||
#include "UObject/Object.h"
|
#include "UObject/Object.h"
|
||||||
|
|
||||||
@ -28,15 +28,6 @@ public:
|
|||||||
virtual void ProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager) override;
|
virtual void ProcessNode(const TScriptInterface<class IComboActionGraphManagerInterface> &Manager) override;
|
||||||
virtual void PreProcessNode(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.
|
* Returns the Dialogue Data Row name.
|
||||||
* ❗ Might be invalid
|
* ❗ Might be invalid
|
||||||
@ -44,7 +35,10 @@ public:
|
|||||||
* @return The Dialogue Data Row name.
|
* @return The Dialogue Data Row name.
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Combo Input|Action")
|
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;
|
virtual bool ValidateNodeRuntime_Implementation() const override;
|
||||||
|
|
||||||
@ -63,43 +57,18 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** Name of row in the table that we want */
|
||||||
/**
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action")
|
||||||
* The data table containing the dialogue rows.
|
TObjectPtr<class UComboInputAsset> ComboInput;
|
||||||
* ❗ 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 */
|
/** Name of row in the table that we want */
|
||||||
UPROPERTY(SaveGame, Category="Combo Input|Action", EditAnywhere, BlueprintReadOnly, meta=(GetOptions ="GetRowNames", NoResetToDefault, EditCondition="DataTable!=nullptr"))
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Combo Input|Action"/*, meta=(EditCondition="ComboInput != nullptr")*/)
|
||||||
FName RowName;
|
EComboActionTriggerEvent TriggerEvent = EComboActionTriggerEvent::Activated;
|
||||||
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
|
|
||||||
virtual bool ValidateNode(TArray<FText>& ValidationsMessages, const bool RichFormat) override;
|
virtual bool ValidateNode(TArray<FText> &ValidationMessages, const bool RichFormat) override;
|
||||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
virtual void PostEditChangeProperty(FPropertyChangedEvent &PropertyChangedEvent) override;
|
||||||
virtual FText GetDescription_Implementation() const override;
|
virtual FText GetDescription_Implementation() const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -108,19 +77,6 @@ public:
|
|||||||
|
|
||||||
#if WITH_EDITORONLY_DATA
|
#if WITH_EDITORONLY_DATA
|
||||||
public:
|
public:
|
||||||
virtual void UpdatePreviews();
|
virtual void UpdatePreviews() { this->Preview = this->GetPreviews(); }
|
||||||
#endif
|
#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;
|
UEdGraphNode *ResultNode = nullptr;
|
||||||
|
|
||||||
if (NodeTemplate != nullptr)
|
if (this->NodeTemplate != nullptr)
|
||||||
{
|
{
|
||||||
const FScopedTransaction Transaction(LOCTEXT("ComboActionGraphEditorNewNode", "Combo Action Graph Editor: New Node"));
|
const FScopedTransaction Transaction(LOCTEXT("ComboActionGraphEditorNewNode", "Combo Action Graph Editor: New Node"));
|
||||||
ParentGraph->Modify();
|
ParentGraph->Modify();
|
||||||
if (FromPin != nullptr)
|
if (FromPin != nullptr)
|
||||||
FromPin->Modify();
|
FromPin->Modify();
|
||||||
|
|
||||||
NodeTemplate->Rename(nullptr, ParentGraph);
|
this->NodeTemplate->Rename(nullptr, ParentGraph);
|
||||||
ParentGraph->AddNode(NodeTemplate, true, bSelectNewNode);
|
ParentGraph->AddNode(this->NodeTemplate, true, bSelectNewNode);
|
||||||
|
|
||||||
NodeTemplate->CreateNewGuid();
|
this->NodeTemplate->CreateNewGuid();
|
||||||
NodeTemplate->PostPlacedNewNode();
|
this->NodeTemplate->PostPlacedNewNode();
|
||||||
NodeTemplate->AllocateDefaultPins();
|
this->NodeTemplate->AllocateDefaultPins();
|
||||||
NodeTemplate->AutowireNewNode(FromPin);
|
this->NodeTemplate->AutowireNewNode(FromPin);
|
||||||
|
|
||||||
NodeTemplate->NodePosX = Location.X;
|
this->NodeTemplate->NodePosX = Location.X;
|
||||||
NodeTemplate->NodePosY = Location.Y;
|
this->NodeTemplate->NodePosY = Location.Y;
|
||||||
|
|
||||||
NodeTemplate->ComboActionGraphNode->SetFlags(EObjectFlags::RF_Transactional);
|
this->NodeTemplate->ComboActionGraphNode->SetFlags(EObjectFlags::RF_Transactional);
|
||||||
NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
this->NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
||||||
|
|
||||||
ResultNode = NodeTemplate;
|
ResultNode = this->NodeTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultNode;
|
return ResultNode;
|
||||||
@ -51,35 +51,35 @@ UEdGraphNode *FAssetSchemaAction_ComboActionGraphSchema_NewNode::PerformAction(U
|
|||||||
void FAssetSchemaAction_ComboActionGraphSchema_NewNode::AddReferencedObjects(FReferenceCollector &Collector)
|
void FAssetSchemaAction_ComboActionGraphSchema_NewNode::AddReferencedObjects(FReferenceCollector &Collector)
|
||||||
{
|
{
|
||||||
FEdGraphSchemaAction::AddReferencedObjects(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 *FAssetSchemaAction_ComboActionGraphSchema_NewEdge::PerformAction(UEdGraph *ParentGraph, UEdGraphPin *FromPin, const FVector2D Location, bool bSelectNewNode)
|
||||||
{
|
{
|
||||||
UEdGraphNode *ResultNode = nullptr;
|
UEdGraphNode *ResultNode = nullptr;
|
||||||
|
|
||||||
if (NodeTemplate != nullptr)
|
if (this->NodeTemplate != nullptr)
|
||||||
{
|
{
|
||||||
const FScopedTransaction Transaction(LOCTEXT("ComboActionGraphEditorNewEdge", "Combo Action Graph Editor: New Edge"));
|
const FScopedTransaction Transaction(LOCTEXT("ComboActionGraphEditorNewEdge", "Combo Action Graph Editor: New Edge"));
|
||||||
ParentGraph->Modify();
|
ParentGraph->Modify();
|
||||||
if (FromPin != nullptr)
|
if (FromPin != nullptr)
|
||||||
FromPin->Modify();
|
FromPin->Modify();
|
||||||
|
|
||||||
NodeTemplate->Rename(nullptr, ParentGraph);
|
this->NodeTemplate->Rename(nullptr, ParentGraph);
|
||||||
ParentGraph->AddNode(NodeTemplate, true, bSelectNewNode);
|
ParentGraph->AddNode(this->NodeTemplate, true, bSelectNewNode);
|
||||||
|
|
||||||
NodeTemplate->CreateNewGuid();
|
this->NodeTemplate->CreateNewGuid();
|
||||||
NodeTemplate->PostPlacedNewNode();
|
this->NodeTemplate->PostPlacedNewNode();
|
||||||
NodeTemplate->AllocateDefaultPins();
|
this->NodeTemplate->AllocateDefaultPins();
|
||||||
NodeTemplate->AutowireNewNode(FromPin);
|
this->NodeTemplate->AutowireNewNode(FromPin);
|
||||||
|
|
||||||
NodeTemplate->NodePosX = Location.X;
|
this->NodeTemplate->NodePosX = Location.X;
|
||||||
NodeTemplate->NodePosY = Location.Y;
|
this->NodeTemplate->NodePosY = Location.Y;
|
||||||
|
|
||||||
NodeTemplate->ComboActionGraphEdge->SetFlags(EObjectFlags::RF_Transactional);
|
this->NodeTemplate->ComboActionGraphEdge->SetFlags(EObjectFlags::RF_Transactional);
|
||||||
NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
this->NodeTemplate->SetFlags(EObjectFlags::RF_Transactional);
|
||||||
|
|
||||||
ResultNode = NodeTemplate;
|
ResultNode = this->NodeTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultNode;
|
return ResultNode;
|
||||||
@ -88,7 +88,7 @@ UEdGraphNode *FAssetSchemaAction_ComboActionGraphSchema_NewEdge::PerformAction(U
|
|||||||
void FAssetSchemaAction_ComboActionGraphSchema_NewEdge::AddReferencedObjects(FReferenceCollector &Collector)
|
void FAssetSchemaAction_ComboActionGraphSchema_NewEdge::AddReferencedObjects(FReferenceCollector &Collector)
|
||||||
{
|
{
|
||||||
FEdGraphSchemaAction::AddReferencedObjects(Collector);
|
FEdGraphSchemaAction::AddReferencedObjects(Collector);
|
||||||
Collector.AddReferencedObject(NodeTemplate);
|
Collector.AddReferencedObject(this->NodeTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,7 @@ FText UEdComboActionGraphNode::GetTooltipText() const
|
|||||||
return this->ComboActionGraphNode->GetNodeTooltipText();
|
return this->ComboActionGraphNode->GetNodeTooltipText();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NSLOCTEXT("UEdComboActionGraphNode", "DefaultToolTip", "Mountea Dialogue Node");
|
return NSLOCTEXT("UEdComboActionGraphNode", "DefaultToolTip", "Combo Action Node");
|
||||||
}
|
}
|
||||||
|
|
||||||
FSlateIcon UEdComboActionGraphNode::GetIconAndTint(FLinearColor& OutColor) const
|
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 *GetNameIcon() const;
|
||||||
|
|
||||||
virtual const FSlateBrush *GetInheritsImageBrush() const;
|
|
||||||
virtual FSlateColor GetInheritsImageTint() const;
|
|
||||||
|
|
||||||
const FSlateBrush *GetBulletPointImageBrush() const;
|
const FSlateBrush *GetBulletPointImageBrush() const;
|
||||||
|
|
||||||
virtual FText GetIndexOverlayTooltipText() const;
|
virtual FText GetIndexOverlayTooltipText() const;
|
||||||
@ -54,30 +51,21 @@ public:
|
|||||||
|
|
||||||
virtual void OnIndexHoverStateChanged(bool bArg) const;
|
virtual void OnIndexHoverStateChanged(bool bArg) const;
|
||||||
virtual FSlateColor GetOverlayWidgetBackgroundColor(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 ShowImplementsOnlySlot_Unified() const;
|
||||||
EVisibility ShowInheritsDecoratorsSlot_Unified() const;
|
|
||||||
EVisibility ShowImplementsOnlySlot_Stack() const;
|
EVisibility ShowImplementsOnlySlot_Stack() const;
|
||||||
EVisibility ShowInheritsDecoratorsSlot_Stack() const;
|
EVisibility ShowInheritsDecoratorsSlot_Stack() const;
|
||||||
EVisibility ShowAllDecorators() const;
|
EVisibility ShowAllDecorators() const;
|
||||||
EVisibility ShowDecoratorsBottomPadding() const;
|
EVisibility ShowDecoratorsBottomPadding() const;
|
||||||
|
|
||||||
FSlateColor GetImplementsRowColor() const;
|
|
||||||
FSlateColor GetBulletPointsImagePointColor() const;
|
|
||||||
|
|
||||||
virtual EComboActionDecoratorsInfoStyle GetDecoratorsStyle() const;
|
virtual EComboActionDecoratorsInfoStyle GetDecoratorsStyle() const;
|
||||||
EVisibility GetStackVisibility() const;
|
EVisibility GetResponseStackVisibility() const;
|
||||||
EVisibility GetUnifiedVisibility() const;
|
|
||||||
|
|
||||||
FText GetTooltipText() const;
|
FText GetTooltipText() const;
|
||||||
|
|
||||||
|
FText GetComboInputName() const;
|
||||||
|
FText GetComboInputTriggerActionName() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TSharedPtr<SBorder> NodeBody;
|
TSharedPtr<SBorder> NodeBody;
|
||||||
TSharedPtr<SHorizontalBox> OutputPinBox;
|
TSharedPtr<SHorizontalBox> OutputPinBox;
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
|
#include "ComboInputAssets.h"
|
||||||
#include "Ed/EdComboActionGraphNode.h"
|
#include "Ed/EdComboActionGraphNode.h"
|
||||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "Nodes/ComboActionGraphNode.h"
|
#include "Nodes/ComboActionGraphNode.h"
|
||||||
@ -26,7 +27,10 @@ public:
|
|||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
static FText GetNodeTitle(UComboActionGraphNode *Node)
|
static FText GetNodeTitle(UComboActionGraphNode *Node)
|
||||||
{
|
{
|
||||||
if (!Node) return FText::FromString("Invalid Node");
|
if (!Node)
|
||||||
|
{
|
||||||
|
return FText::FromString("Invalid Node");
|
||||||
|
}
|
||||||
|
|
||||||
const UComboActionGraphEditorSettings *Settings = GetDefault<UComboActionGraphEditorSettings>();
|
const UComboActionGraphEditorSettings *Settings = GetDefault<UComboActionGraphEditorSettings>();
|
||||||
if (Settings)
|
if (Settings)
|
||||||
@ -35,12 +39,9 @@ public:
|
|||||||
{
|
{
|
||||||
if (const UComboActionGraphNode_ActionNodeBase *DialogueNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(Node))
|
if (const UComboActionGraphNode_ActionNodeBase *DialogueNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(Node))
|
||||||
{
|
{
|
||||||
if (DialogueNodeBase->GetDataTable())
|
if (const UComboInputAsset *ComboInput = DialogueNodeBase->GetComboInput())
|
||||||
{
|
{
|
||||||
FString ReturnString;
|
return FText::FromString(ComboInput->GetName());
|
||||||
DialogueNodeBase->GetRowName().ToString(ReturnString);
|
|
||||||
|
|
||||||
return FText::FromString(ReturnString);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,21 +8,18 @@ struct FComboActionSearchFilter
|
|||||||
public:
|
public:
|
||||||
bool IsEmptyFilter() const
|
bool IsEmptyFilter() const
|
||||||
{
|
{
|
||||||
return SearchString.IsEmpty()
|
return this->SearchString.IsEmpty()
|
||||||
&& bIncludeNodeTitle == false
|
&& this->bIncludeNodeTitle == false
|
||||||
&& bIncludeNodeType == false
|
&& this->bIncludeNodeType == false
|
||||||
&& bIncludeNodeDecoratorsTypes == false
|
&& this->bIncludeNodeData == true
|
||||||
&& bIncludeNodeData == true
|
&& this->bIncludeNodeGUID == false;
|
||||||
&& bIncludeNodeGUID == false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
// Search term that the search items must match
|
// Search term that the search items must match
|
||||||
FString SearchString;
|
FString SearchString;
|
||||||
|
|
||||||
bool bIncludeNodeTitle = true;
|
bool bIncludeNodeTitle = true;
|
||||||
bool bIncludeNodeType = true;
|
bool bIncludeNodeType = true;
|
||||||
bool bIncludeNodeDecoratorsTypes = true;
|
|
||||||
bool bIncludeNodeData = true;
|
bool bIncludeNodeData = true;
|
||||||
bool bIncludeNodeGUID = false;
|
bool bIncludeNodeGUID = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include "ComboActionSearchManager.h"
|
#include "ComboActionSearchManager.h"
|
||||||
|
|
||||||
#include "ComboActionGraph.h"
|
#include "ComboActionGraph.h"
|
||||||
|
#include "ComboInputAssets.h"
|
||||||
|
|
||||||
#include "AssetRegistry/AssetRegistryModule.h"
|
#include "AssetRegistry/AssetRegistryModule.h"
|
||||||
#include "Ed/EdComboActionGraph.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
|
// Search by Node Data
|
||||||
if (SearchFilter.bIncludeNodeData)
|
if (SearchFilter.bIncludeNodeData)
|
||||||
{
|
{
|
||||||
if (const UComboActionGraphNode_ActionNodeBase *ActionNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(Node))
|
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;
|
bContainsSearchString = true;
|
||||||
this->MakeChildTextNode(
|
this->MakeChildTextNode(
|
||||||
TreeGraphNode,
|
TreeGraphNode,
|
||||||
FText::FromName(FName(Node->NodeTypeName.ToString() )),
|
FText::FromName(FName(Node->NodeTypeName.ToString())),
|
||||||
LOCTEXT("NodeDataRowKey", "Node Data"),
|
LOCTEXT("NodeDataRowKey", "Node Data"),
|
||||||
TEXT("Node Data")
|
TEXT("Node Data")
|
||||||
);
|
);
|
||||||
|
|||||||
@ -339,26 +339,6 @@ TSharedRef<SWidget> SComboActionSearch::FillFilterEntries()
|
|||||||
EUserInterfaceActionType::ToggleButton
|
EUserInterfaceActionType::ToggleButton
|
||||||
);
|
);
|
||||||
MenuBuilder.AddMenuEntry
|
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("IncludeNodeData", "Include Node Data Row"),
|
||||||
LOCTEXT("IncludeNodeDecoratorsTypes_ToolTip", "Include Node Data Row in the search result"),
|
LOCTEXT("IncludeNodeDecoratorsTypes_ToolTip", "Include Node Data Row in the search result"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user