# 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 ```cpp private: void RegisterMenuExtensions(); void AddToolbarMenuEntry(class FMenuBuilder& MenuBuilder); ``` ### Complete Modified Section ```cpp 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 PluginCommands; TSharedPtr DataTableListener; TSharedPtr 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**: ```cpp #include "Utility/AssetExporterToJSON.h" ``` **Complete Include Section**: ```cpp #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**: ```cpp // Register editor menu extensions UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FWorldStalkerEditorModule::RegisterMenuExtensions)); ``` **Complete StartupModule Method**: ```cpp void FWorldStalkerEditorModule::StartupModule() { DataTableListener = MakeShared(); ObjectSaveEventListener = MakeShared(); // 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**: ```cpp // Unregister all tool menus UToolMenus::UnRegisterStartupCallback(this); UToolMenus::UnregisterOwner(this); ``` **Complete ShutdownModule Method**: ```cpp 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**: ```cpp 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: ```csharp 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: - Author: jinilkim@actionsquare.com - Project: WorldStalker (DungeonStalkers) - Module: WorldStalkerEditor