Files
DS-Asset_Export_to_JSON/AssetExporterToJSON.h

106 lines
3.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
/**
* Utility class for exporting various asset types to JSON format
* Supports: DataTable, Blueprint, AnimMontage, CurveTable
* Purpose: Extract asset data for LLM-based combat balance analysis
*/
class WORLDSTALKEREDITOR_API FAssetExporterToJSON
{
public:
/**
* Main entry point for JSON export
* Opens folder picker dialog and exports all supported assets from selected folder
*/
static void ExportAssetsToJSON();
/**
* Export a single asset to JSON (for right-click context menu)
* @param AssetData - Asset to export
*/
static void ExportSingleAssetToJSON(const struct FAssetData& AssetData);
private:
/**
* Export all DataTables from the specified path to JSON
* @param FolderPath - Root folder path to search (recursively)
* @param OutJsonArray - Output array to store exported data
* @return Number of assets exported
*/
static int32 ExportDataTables(const FString& FolderPath, TArray<TSharedPtr<FJsonValue>>& OutJsonArray);
/**
* Export all Blueprints from the specified path to JSON
* Extracts: Variables, Functions, Components, Parent Class
* @param FolderPath - Root folder path to search (recursively)
* @param OutJsonArray - Output array to store exported data
* @return Number of assets exported
*/
static int32 ExportBlueprints(const FString& FolderPath, TArray<TSharedPtr<FJsonValue>>& OutJsonArray);
/**
* Export all AnimMontages from the specified path to JSON
* @param FolderPath - Root folder path to search (recursively)
* @param OutJsonArray - Output array to store exported data
* @return Number of assets exported
*/
static int32 ExportAnimMontages(const FString& FolderPath, TArray<TSharedPtr<FJsonValue>>& OutJsonArray);
/**
* Export all CurveTables from the specified path to JSON
* @param FolderPath - Root folder path to search (recursively)
* @param OutJsonArray - Output array to store exported data
* @return Number of assets exported
*/
static int32 ExportCurveTables(const FString& FolderPath, TArray<TSharedPtr<FJsonValue>>& OutJsonArray);
/**
* Helper: Extract detailed Blueprint information
* @param Blueprint - Blueprint asset to extract from
* @return JSON object containing blueprint data
*/
static TSharedPtr<FJsonObject> ExtractBlueprintDetails(class UBlueprint* Blueprint);
/**
* Helper: Extract Blueprint variables
* @param Blueprint - Blueprint asset
* @return JSON array of variables with name, type, default value
*/
static TArray<TSharedPtr<FJsonValue>> ExtractBlueprintVariables(class UBlueprint* Blueprint);
/**
* Helper: Extract Blueprint functions
* @param Blueprint - Blueprint asset
* @return JSON array of functions with name, inputs, outputs
*/
static TArray<TSharedPtr<FJsonValue>> ExtractBlueprintFunctions(class UBlueprint* Blueprint);
/**
* Helper: Extract Blueprint component hierarchy
* @param Blueprint - Blueprint asset
* @return JSON array of components
*/
static TArray<TSharedPtr<FJsonValue>> ExtractBlueprintComponents(class UBlueprint* Blueprint);
/**
* Helper: Extract Blueprint event graphs
* @param Blueprint - Blueprint asset
* @return JSON array of event graphs with nodes and connections
*/
static TArray<TSharedPtr<FJsonValue>> ExtractBlueprintEventGraphs(class UBlueprint* Blueprint);
/**
* Helper: Save JSON array to file
* @param JsonArray - Array of JSON values to save
* @param FileName - Name of output file (e.g., "DataTable.json")
* @param OutputPath - Directory to save the file
* @return true if successful
*/
static bool SaveJsonToFile(const TArray<TSharedPtr<FJsonValue>>& JsonArray, const FString& FileName, const FString& OutputPath);
};