4#include "Commandlets/Commandlet.h"
6#include "DlgExportTwineCommandlet.generated.h"
28 int32 Main(const FString& Params) override;
30 FString CreateTwineStoryData(const FString&
Name, const FGuid& DialogueGuid, int32 StartNodeIndex, const FString& PassagesData);
35 FString CreateTwinePassageData(int32 Pid, const FString&
Name, const FString& Tags, const FIntPoint& Position, const FIntPoint& Size, const FString& Content);
37 FString CreateTwineCustomCss();
39 FORCEINLINE FIntPoint GraphNodeToTwineCanvas(int32 PositionX, int32 PositionY)
42 const int32 NewX = FMath::Abs(MinimumGraphX) + PositionX;
43 const int32 NewY = FMath::Abs(MinimumGraphY) + PositionY;
44 return FIntPoint(NewX, NewY);
47 bool GetBoxThatConflicts(
const FBox2D& Box, FBox2D& OutConflict);
48 FIntPoint GetNonConflictingPointFor(
const FIntPoint& InPoint,
const FIntPoint& Size,
const FIntPoint& Padding);
50 static FString CreateTwineTagColorsData();
52 FString GetNodeNameFromNode(
const UDlgNode& Node, int32 NodeIndex,
bool bIsRootNode =
false);
54 FORCEINLINE
static FString& EscapeHtml(FString&
String)
56 String.ReplaceInline(TEXT(
"&"), TEXT(
"&"), ESearchCase::CaseSensitive);
57 String.ReplaceInline(TEXT(
"\""), TEXT(
"""), ESearchCase::CaseSensitive);
58 String.ReplaceInline(TEXT(
"'"), TEXT(
"'"), ESearchCase::CaseSensitive);
59 String.ReplaceInline(TEXT(
"<"), TEXT(
"<"), ESearchCase::CaseSensitive);
60 String.ReplaceInline(TEXT(
">"), TEXT(
">"), ESearchCase::CaseSensitive);
64 FORCEINLINE
static FString EscapeHtml(
const FString&
String)
67 NewString.ReplaceInline(TEXT(
"&"), TEXT(
"&"), ESearchCase::CaseSensitive);
68 NewString.ReplaceInline(TEXT(
"\""), TEXT(
"""), ESearchCase::CaseSensitive);
69 NewString.ReplaceInline(TEXT(
"'"), TEXT(
"'"), ESearchCase::CaseSensitive);
70 NewString.ReplaceInline(TEXT(
"<"), TEXT(
"<"), ESearchCase::CaseSensitive);
71 NewString.ReplaceInline(TEXT(
">"), TEXT(
">"), ESearchCase::CaseSensitive);
76 static void InitTwinetagNodesColors();
79 FString OutputDirectory;
82 bool bFlatten =
false;
85 int32 MinimumGraphX = 0;
86 int32 MinimumGraphY = 0;
89 TArray<FBox2D> CurrentNodesAreas;
94 static TMap<FString, FString> TwineTagNodesColorsMap;
96 static const FIntPoint SizeSmall;
97 static const FIntPoint SizeWide;
98 static const FIntPoint SizeTall;
99 static const FIntPoint SizeLarge;
101 static const FString TagNodeStart;
102 static const FString TagNodeEnd;
103 static const FString TagNodeVirtualParent;
104 static const FString TagNodeSpeech;
105 static const FString TagNodeSpeechSequence;
106 static const FString TagNodeSelectorFirst;
107 static const FString TagNodeSelectorRandom;
DECLARE_LOG_CATEGORY_EXTERN(LogDlgExportTwineCommandlet, All, All)
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
static const FIntPoint SizeWide
FString CreateTwineStoryData(const FString &Name, const FGuid &DialogueGuid, int32 StartNodeIndex, const FString &PassagesData)
static const FString TagNodeVirtualParent
int32 Main(const FString &Params) override
static TMap< FString, FString > TwineTagNodesColorsMap
static const FIntPoint SizeTall
static const FString TagNodeSpeechSequence
FString CreateTwineCustomCss()
static const FIntPoint SizeLarge
static const FString TagNodeStart
static FORCEINLINE FString & EscapeHtml(FString &String)
UDlgExportTwineCommandlet()
FString CreateTwinePassageDataLinksFromEdges(const UDlgDialogue &Dialogue, const TArray< FDlgEdge > &Edges, bool bNoTextOnEdges=false)
FString GetNodeNameFromNode(const UDlgNode &Node, int32 NodeIndex, bool bIsRootNode=false)
TArray< FBox2D > CurrentNodesAreas
FString CreateTwinePassageData(int32 Pid, const FString &Name, const FString &Tags, const FIntPoint &Position, const FIntPoint &Size, const FString &Content)
static const FString TagNodeSelectorRandom
static const FString TagNodeSpeech
static void InitTwinetagNodesColors()
bool GetBoxThatConflicts(const FBox2D &Box, FBox2D &OutConflict)
FIntPoint GetNonConflictingPointFor(const FIntPoint &InPoint, const FIntPoint &Size, const FIntPoint &Padding)
FORCEINLINE FIntPoint GraphNodeToTwineCanvas(int32 PositionX, int32 PositionY)
static FString CreateTwineTagColorsData()
static const FIntPoint SizeSmall
static const FString TagNodeEnd
FString CreateTwinePassageDataFromNode(const UDlgDialogue &Dialogue, const UDlgNode &Node, int32 NodeIndex)
static const FString TagNodeSelectorFirst
static FORCEINLINE FString EscapeHtml(const FString &String)
UCLASS(BlueprintType, Abstract, EditInlineNew, ClassGroup = "Dialogue")