A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueBlueprintUtilities.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5#include "Kismet2/BlueprintEditorUtils.h"
6
8#include "DlgManager.h"
9
11{
12public:
13 // Gets the blueprint for the provided Node
14 static UBlueprint* GetBlueprintForGraphNode(const UK2Node* Node)
15 {
16 if (!IsValid(Node))
17 {
18 return nullptr;
19 }
20
21 // NOTE we can't call Node->GetBlueprint() because this is called in strange places ;)
22 if (const UEdGraph* Graph = Cast<UEdGraph>(Node->GetOuter()))
23 {
24 return FBlueprintEditorUtils::FindBlueprintForGraph(Graph);
25 }
26
27 return nullptr;
28 }
29
30 // Checks if the Blueprint for the Node is loaded or not.
31 static bool IsBlueprintLoadedForGraphNode(const UK2Node* Node)
32 {
33 if (UBlueprint* Blueprint = GetBlueprintForGraphNode(Node))
34 {
35 return !Blueprint->HasAnyFlags(RF_NeedLoad | RF_NeedPostLoad);
36 }
37 return false;
38 }
39
44 static FName GetParticipantNameFromNode(const UK2Node* Node)
45 {
46 if (const UBlueprint* Blueprint = GetBlueprintForGraphNode(Node))
47 {
49 {
50 return IDlgDialogueParticipant::Execute_GetParticipantName(Blueprint->GeneratedClass->GetDefaultObject());
51 }
52 }
53
54 return NAME_None;
55 }
56};
static FName GetParticipantNameFromNode(const UK2Node *Node)
static UBlueprint * GetBlueprintForGraphNode(const UK2Node *Node)
static bool IsBlueprintLoadedForGraphNode(const UK2Node *Node)
static bool DoesObjectImplementDialogueParticipantInterface(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper")