Skip to content

Commit 02f5a84

Browse files
Ensure a few directories get created as necessary and skip event nodes
1 parent 5699800 commit 02f5a84

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Source/KantanDocGen/Private/NodeDocsGenerator.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ bool FNodeDocsGenerator::GenerateNodeImage(UEdGraphNode* Node, FNodeProcessingSt
199199

200200
State.RelImageBasePath = TEXT("../img");
201201
FString ImageBasePath = State.ClassDocsPath / TEXT("img"); // State.RelImageBasePath;
202+
if (!IFileManager::Get().DirectoryExists(*ImageBasePath))
203+
{
204+
IFileManager::Get().MakeDirectory(*ImageBasePath, true);
205+
}
202206
FString ImgFilename = FString::Printf(TEXT("nd_img_%s.png"), *NodeName);
203207
FString ScreenshotSaveName = ImageBasePath / ImgFilename;
204208

@@ -396,6 +400,9 @@ inline bool ShouldDocumentPin(UEdGraphPin* Pin)
396400

397401
bool FNodeDocsGenerator::GenerateNodeDocTree(UK2Node* Node, FNodeProcessingState& State)
398402
{
403+
if (auto EventNode = Cast<UK2Node_Event>(Node)) {
404+
return true; //Skip events
405+
}
399406
SCOPE_SECONDS_COUNTER(GenerateNodeDocsTime);
400407

401408
auto NodeDocsPath = State.ClassDocsPath / TEXT("nodes");
@@ -489,6 +496,15 @@ bool FNodeDocsGenerator::GenerateNodeDocTree(UK2Node* Node, FNodeProcessingState
489496
}
490497
}
491498
}
499+
else
500+
{
501+
UE_LOG(LogKantanDocGen, Warning, TEXT("[KantanDocGen] Failed to get target function for node %s "), *NodeFullTitle);
502+
}
503+
}
504+
else
505+
{
506+
UE_LOG(LogKantanDocGen, Warning, TEXT("[KantanDocGen] Cannot get type for node %s "),
507+
*NodeFullTitle);
492508
}
493509
auto InputNode = NodeDocFile->AppendChild("inputs");
494510

Source/KantanDocGen/Private/OutputFormats/DocGenJsonOutputProcessor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,13 @@ EIntermediateProcessingResult DocGenJsonOutputProcessor::ConvertJsonToAdoc(FStri
197197
}
198198
*/
199199
BufferedText += FPlatformProcess::ReadPipe(PipeRead);
200-
201200
int32 EndOfLineIdx;
202201
while (BufferedText.FindChar('\n', EndOfLineIdx))
203202
{
204203
FString Line = BufferedText.Left(EndOfLineIdx);
205204
Line.RemoveFromEnd(TEXT("\r"));
206205

207-
UE_LOG(LogKantanDocGen, Log, TEXT("[KantanDocGen] %s"), *Line);
206+
UE_LOG(LogKantanDocGen, Error, TEXT("[KantanDocGen] %s"), *Line);
208207

209208
BufferedText = BufferedText.Mid(EndOfLineIdx + 1);
210209
}
@@ -233,6 +232,7 @@ EIntermediateProcessingResult DocGenJsonOutputProcessor::ConvertJsonToAdoc(FStri
233232
EIntermediateProcessingResult DocGenJsonOutputProcessor::ConvertAdocToHTML(FString IntermediateDir, FString OutputDir)
234233
{
235234
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
235+
PlatformFile.CreateDirectory(*(OutputDir / "img"));
236236
PlatformFile.CopyDirectoryTree(*(OutputDir / "img"), *(BinaryPath.Path / "img"), true);
237237

238238
const FFilePath InAdocPath {IntermediateDir / "docs.adoc"};

0 commit comments

Comments
 (0)