Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save onionmk2/ccc1cde6467f23feaed06b534721bc95 to your computer and use it in GitHub Desktop.
Save onionmk2/ccc1cde6467f23feaed06b534721bc95 to your computer and use it in GitHub Desktop.

Revisions

  1. @rdeioris rdeioris created this gist Apr 11, 2020.
    29 changes: 29 additions & 0 deletions DiscoverBlueprintComments.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@

    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);
    }
    }
    }
    }