87 lines
2.0 KiB
C++
87 lines
2.0 KiB
C++
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
#include "Ed/EdComboActionGraphNode.h"
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
|
#include "Nodes/ComboActionGraphNode.h"
|
|
#include "Nodes/ComboActionGraphNode_ActionNodeBase.h"
|
|
#include "Settings/ComboActionGraphEditorSettings.h"
|
|
|
|
#include "ComboActionEditorBFC.generated.h"
|
|
|
|
|
|
/**
|
|
* Editor Only helper functions.
|
|
*/
|
|
UCLASS()
|
|
class UComboActionEditorBFC : public UBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
#if WITH_EDITOR
|
|
static FText GetNodeTitle(UComboActionGraphNode *Node)
|
|
{
|
|
if (!Node) return FText::FromString("Invalid Node");
|
|
|
|
const UComboActionGraphEditorSettings *Settings = GetDefault<UComboActionGraphEditorSettings>();
|
|
if (Settings)
|
|
{
|
|
if (Settings->ShowAutomaticNames())
|
|
{
|
|
if (const UComboActionGraphNode_ActionNodeBase *DialogueNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(Node))
|
|
{
|
|
if (DialogueNodeBase->GetDataTable())
|
|
{
|
|
FString ReturnString;
|
|
DialogueNodeBase->GetRowName().ToString(ReturnString);
|
|
|
|
return FText::FromString(ReturnString);
|
|
}
|
|
}
|
|
|
|
return Node->GetInternalName();
|
|
}
|
|
}
|
|
|
|
return Node->GetNodeTitle();
|
|
}
|
|
|
|
static EComboActionNodeTheme GetNodeTheme()
|
|
{
|
|
const UComboActionGraphEditorSettings *Settings = GetDefault<UComboActionGraphEditorSettings>();
|
|
if (Settings != nullptr)
|
|
{
|
|
return Settings->GetNodeTheme();
|
|
}
|
|
|
|
return EComboActionNodeTheme::DarkTheme;
|
|
}
|
|
|
|
static void TriggerPreviewRefresh(TArray<UObject*> NodeObjects)
|
|
{
|
|
for (auto Itr : NodeObjects)
|
|
{
|
|
UEdComboActionGraphNode *SelectedNode = Cast<UEdComboActionGraphNode>(Itr);
|
|
if (!SelectedNode || !SelectedNode->ComboActionGraphNode)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
UComboActionGraphNode_ActionNodeBase *DialogueNodeBase = Cast<UComboActionGraphNode_ActionNodeBase>(SelectedNode->ComboActionGraphNode);
|
|
if (!DialogueNodeBase)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
DialogueNodeBase->UpdatePreviews();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
};
|