Files
DS-Asset_Export_to_JSON/MERGE_INSTRUCTIONS.md
jinilkim 3d9d6cc664 Add Asset Export to JSON feature for LLM combat balance analysis
Features:
- Export DataTable, Blueprint, AnimMontage, CurveTable to JSON
- INI-based configuration via UDeveloperSettings
- Comprehensive Blueprint EventGraph extraction
- Enhanced AnimMontage with CustomProperties from Notifies
- Project Settings integration (Edit -> Project Settings -> Plugins)
- Tools menu integration (Tools -> WorldStalker -> Export Assets to JSON)

Files added:
- AssetExportSettings.h/cpp - UDeveloperSettings configuration class
- AssetExporterToJSON.h/cpp - Core export implementation
- README.md - Comprehensive feature documentation
- MERGE_INSTRUCTIONS.md - Integration guide for existing files

Unreal Engine 5.5.4 compatible
2025-10-22 15:14:50 +09:00

6.0 KiB

Merge Instructions for Existing Files

This document describes the changes that need to be merged into existing WorldStalkerEditor module files.

Overview

The Asset Export to JSON feature requires minimal modifications to existing files:

  • WorldStalkerEditor.h: Add two private method declarations
  • WorldStalkerEditor.cpp: Add include directive and implement menu registration

File: WorldStalkerEditor.h

Location of Changes

Line 18-20 (after existing private member variables)

Changes to Add

private:
	void RegisterMenuExtensions();
	void AddToolbarMenuEntry(class FMenuBuilder& MenuBuilder);

Complete Modified Section

class FWorldStalkerEditorModule : public IModuleInterface
{
public:
	virtual void StartupModule() override;
	virtual void ShutdownModule() override;

private:
	// ADD THESE TWO LINES:
	void RegisterMenuExtensions();
	void AddToolbarMenuEntry(class FMenuBuilder& MenuBuilder);

	TSharedPtr<class FUICommandList> PluginCommands;
    TSharedPtr<class FDataTableNoticeListener> DataTableListener;
    TSharedPtr<class FObjectSaveEventListener> ObjectSaveEventListener;
};

Note: The AddToolbarMenuEntry method is kept for backward compatibility but is not actively used.


File: WorldStalkerEditor.cpp

Change 1: Add Include Directive

Location: Line 4 (after existing includes)

Add this line:

#include "Utility/AssetExporterToJSON.h"

Complete Include Section:

#include "WorldStalkerEditor.h"
#include "DataTable/DataTableNoticeListener.h"
#include "Asset/ObjectSaveEventListener.h"
#include "Utility/AssetExporterToJSON.h"  // ADD THIS LINE
#include "ToolMenus.h"

Change 2: Register Menu Extensions in StartupModule

Location: Inside StartupModule() method (after existing initialization)

Add these lines:

// Register editor menu extensions
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FWorldStalkerEditorModule::RegisterMenuExtensions));

Complete StartupModule Method:

void FWorldStalkerEditorModule::StartupModule()
{
    DataTableListener = MakeShared<FDataTableNoticeListener>();
    ObjectSaveEventListener = MakeShared<FObjectSaveEventListener>();

	// ADD THESE TWO LINES:
	// Register editor menu extensions
	UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FWorldStalkerEditorModule::RegisterMenuExtensions));
}

Change 3: Cleanup in ShutdownModule

Location: Inside ShutdownModule() method (after existing cleanup)

Add these lines:

// Unregister all tool menus
UToolMenus::UnRegisterStartupCallback(this);
UToolMenus::UnregisterOwner(this);

Complete ShutdownModule Method:

void FWorldStalkerEditorModule::ShutdownModule()
{
    DataTableListener.Reset();
    ObjectSaveEventListener.Reset();

	// ADD THESE TWO LINES:
	// Unregister all tool menus
	UToolMenus::UnRegisterStartupCallback(this);
	UToolMenus::UnregisterOwner(this);
}

Change 4: Add New Method Implementations

Location: After ShutdownModule() method (before #undef LOCTEXT_NAMESPACE)

Add these two complete methods:

void FWorldStalkerEditorModule::RegisterMenuExtensions()
{
	UToolMenu* ToolsMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Tools");
	if (!ToolsMenu)
	{
		return;
	}

	FToolMenuSection& Section = ToolsMenu->FindOrAddSection("WorldStalkerTools");
	Section.Label = LOCTEXT("WorldStalkerToolsSection", "WorldStalker");

	Section.AddMenuEntry(
		"ExportAssetsToJSON",
		LOCTEXT("ExportAssetsToJSON", "Export Assets to JSON"),
		LOCTEXT("ExportAssetsToJSONTooltip", "Export DataTable, Blueprint, AnimMontage, and CurveTable assets to JSON format for LLM analysis"),
		FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.StatsViewer"),
		FUIAction(FExecuteAction::CreateStatic(&FAssetExporterToJSON::ExportAssetsToJSON))
	);
}

void FWorldStalkerEditorModule::AddToolbarMenuEntry(FMenuBuilder& MenuBuilder)
{
	// This method is no longer used but kept for backward compatibility
}

Build Configuration

Ensure WorldStalkerEditor.Build.cs includes these dependencies:

PublicDependencyModuleNames.AddRange(new string[] {
    "AssetRegistry",
    "Json",
    "JsonUtilities"
});

PrivateDependencyModuleNames.AddRange(new string[] {
    "UnrealEd",
    "Engine",
    "Slate",
    "SlateCore",
    "ToolMenus",
    "DeveloperSettings"
});

Note: Most of these dependencies likely already exist in your module. Only add the ones that are missing.


Summary of Changes

WorldStalkerEditor.h

  • Lines Added: 2 method declarations
  • Purpose: Declare menu registration methods

WorldStalkerEditor.cpp

  • Lines Added:
    • 1 include directive
    • 2 lines in StartupModule()
    • 2 lines in ShutdownModule()
    • 2 complete method implementations (~24 lines)
  • Total: ~29 lines added
  • Purpose: Implement Tools menu integration

Testing After Merge

  1. Rebuild the WorldStalkerEditor module
  2. Launch Unreal Editor
  3. Navigate to Tools → WorldStalker → Export Assets to JSON
  4. Configure settings in Edit → Project Settings → Plugins → Asset Export to JSON
  5. Run export and verify JSON files are created in Content/Exports/

Rollback Instructions

If you need to remove this feature:

  1. Delete the four new files:

    • AssetExportSettings.h
    • AssetExportSettings.cpp
    • AssetExporterToJSON.h
    • AssetExporterToJSON.cpp
  2. Remove changes from WorldStalkerEditor.h:

    • Delete the two method declarations
  3. Remove changes from WorldStalkerEditor.cpp:

    • Remove the #include "Utility/AssetExporterToJSON.h" line
    • Remove UToolMenus registration from StartupModule()
    • Remove UToolMenus cleanup from ShutdownModule()
    • Delete the two method implementations
  4. Rebuild the module


Contact

For questions about merging these changes: