46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||
|
|
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "CoreMinimal.h"
|
||
|
|
#include "EdGraph/EdGraphSchema.h"
|
||
|
|
#include "DialogueGraphSchema.generated.h"
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建节点的Action
|
||
|
|
*/
|
||
|
|
USTRUCT()
|
||
|
|
struct FDialogueGraphSchemaAction_NewNode : public FEdGraphSchemaAction
|
||
|
|
{
|
||
|
|
GENERATED_BODY()
|
||
|
|
|
||
|
|
public:
|
||
|
|
FDialogueGraphSchemaAction_NewNode() : FEdGraphSchemaAction() {}
|
||
|
|
|
||
|
|
FDialogueGraphSchemaAction_NewNode(UClass* InClassTemplate, FText InNodeCategory, FText InMenuDesc, FText InToolTip)
|
||
|
|
: FEdGraphSchemaAction(InNodeCategory, InMenuDesc, InToolTip, 0), ClassTemplate(InClassTemplate) {}
|
||
|
|
|
||
|
|
virtual UEdGraphNode* PerformAction(UEdGraph* ParentGraph, UEdGraphPin* FromPin, const FVector2D Location, bool bSelectNewNode = true) override;
|
||
|
|
|
||
|
|
protected:
|
||
|
|
UClass* ClassTemplate = nullptr;
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 对话图表规则
|
||
|
|
*/
|
||
|
|
UCLASS()
|
||
|
|
class DIALOGUEEDITOR_API UDialogueGraphSchema : public UEdGraphSchema
|
||
|
|
{
|
||
|
|
GENERATED_BODY()
|
||
|
|
|
||
|
|
public:
|
||
|
|
/** UEdGraphSchema */
|
||
|
|
virtual void CreateDefaultNodesForGraph(UEdGraph& Graph) const override;
|
||
|
|
// 右键菜单创建节点
|
||
|
|
virtual void GetGraphContextActions(FGraphContextMenuBuilder& ContextMenuBuilder) const override;
|
||
|
|
|
||
|
|
// 连接规则
|
||
|
|
virtual const FPinConnectionResponse CanCreateConnection(const UEdGraphPin* A, const UEdGraphPin* B) const override;
|
||
|
|
};
|