-
-
Save onionmk2/ccc1cde6467f23feaed06b534721bc95 to your computer and use it in GitHub Desktop.
How to extract Unreal Engine Blueprint comments via c++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry"); | |
TArray<FAssetData> AssetData; | |
AssetRegistryModule.Get().GetAssetsByClass(UBlueprint::StaticClass()->GetFName(), AssetData, true); | |
for (FAssetData& Asset : AssetData) | |
{ | |
if (Asset.ObjectPath.ToString().StartsWith("/Game/")) | |
{ | |
UE_LOG(LogTemp, Log, TEXT("Found Asset: %s %s %s"), *Asset.AssetName.ToString(), *Asset.AssetClass.ToString(), *Asset.ObjectPath.ToString()); | |
UBlueprint* Blueprint = Cast<UBlueprint>(Asset.GetAsset()); | |
if (!Blueprint) | |
{ | |
UE_LOG(LogTemp, Error, TEXT("Unable to load asset %s"), *Asset.ObjectPath.ToString()); | |
continue; | |
} | |
for (UEdGraph* Graph : Blueprint->FunctionGraphs) | |
{ | |
TArray<UEdGraphNode_Comment*> Nodes; | |
Graph->GetNodesOfClass<UEdGraphNode_Comment>(Nodes); | |
for (UEdGraphNode_Comment* Node : Nodes) | |
{ | |
UE_LOG(LogTemp, Log, TEXT("Found comment for %s:%s: %s"), *Asset.ObjectPath.ToString(), *Graph->GetName(), *Node->NodeComment); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment