unreal-engine-mcp-server 0.4.7 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +26 -0
- package/.env.production +38 -7
- package/.eslintrc.json +0 -54
- package/.eslintrc.override.json +8 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +94 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +56 -0
- package/.github/copilot-instructions.md +478 -45
- package/.github/dependabot.yml +19 -0
- package/.github/labeler.yml +24 -0
- package/.github/labels.yml +70 -0
- package/.github/pull_request_template.md +42 -0
- package/.github/release-drafter.yml +148 -0
- package/.github/workflows/auto-merge.yml +38 -0
- package/.github/workflows/ci.yml +38 -0
- package/.github/workflows/dependency-review.yml +17 -0
- package/.github/workflows/gemini-issue-triage.yml +172 -0
- package/.github/workflows/greetings.yml +23 -0
- package/.github/workflows/labeler.yml +16 -0
- package/.github/workflows/links.yml +80 -0
- package/.github/workflows/pr-size-labeler.yml +137 -0
- package/.github/workflows/publish-mcp.yml +12 -7
- package/.github/workflows/release-drafter.yml +23 -0
- package/.github/workflows/release.yml +112 -0
- package/.github/workflows/semantic-pull-request.yml +35 -0
- package/.github/workflows/smoke-test.yml +36 -0
- package/.github/workflows/stale.yml +28 -0
- package/CHANGELOG.md +267 -31
- package/CONTRIBUTING.md +140 -0
- package/README.md +166 -71
- package/claude_desktop_config_example.json +7 -6
- package/dist/automation/bridge.d.ts +50 -0
- package/dist/automation/bridge.js +452 -0
- package/dist/automation/connection-manager.d.ts +23 -0
- package/dist/automation/connection-manager.js +107 -0
- package/dist/automation/handshake.d.ts +11 -0
- package/dist/automation/handshake.js +89 -0
- package/dist/automation/index.d.ts +3 -0
- package/dist/automation/index.js +3 -0
- package/dist/automation/message-handler.d.ts +12 -0
- package/dist/automation/message-handler.js +149 -0
- package/dist/automation/request-tracker.d.ts +25 -0
- package/dist/automation/request-tracker.js +98 -0
- package/dist/automation/types.d.ts +130 -0
- package/dist/automation/types.js +2 -0
- package/dist/cli.js +32 -5
- package/dist/config.d.ts +27 -0
- package/dist/config.js +60 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +12 -0
- package/dist/graphql/resolvers.d.ts +268 -0
- package/dist/graphql/resolvers.js +743 -0
- package/dist/graphql/schema.d.ts +5 -0
- package/dist/graphql/schema.js +437 -0
- package/dist/graphql/server.d.ts +26 -0
- package/dist/graphql/server.js +115 -0
- package/dist/graphql/types.d.ts +7 -0
- package/dist/graphql/types.js +2 -0
- package/dist/handlers/resource-handlers.d.ts +20 -0
- package/dist/handlers/resource-handlers.js +180 -0
- package/dist/index.d.ts +31 -18
- package/dist/index.js +119 -619
- package/dist/prompts/index.js +4 -4
- package/dist/resources/actors.d.ts +17 -12
- package/dist/resources/actors.js +56 -76
- package/dist/resources/assets.d.ts +6 -14
- package/dist/resources/assets.js +115 -147
- package/dist/resources/levels.d.ts +13 -13
- package/dist/resources/levels.js +25 -34
- package/dist/server/resource-registry.d.ts +20 -0
- package/dist/server/resource-registry.js +37 -0
- package/dist/server/tool-registry.d.ts +23 -0
- package/dist/server/tool-registry.js +322 -0
- package/dist/server-setup.d.ts +21 -0
- package/dist/server-setup.js +111 -0
- package/dist/services/health-monitor.d.ts +34 -0
- package/dist/services/health-monitor.js +105 -0
- package/dist/services/metrics-server.d.ts +11 -0
- package/dist/services/metrics-server.js +105 -0
- package/dist/tools/actors.d.ts +147 -9
- package/dist/tools/actors.js +350 -311
- package/dist/tools/animation.d.ts +135 -4
- package/dist/tools/animation.js +510 -411
- package/dist/tools/assets.d.ts +117 -19
- package/dist/tools/assets.js +259 -284
- package/dist/tools/audio.d.ts +102 -42
- package/dist/tools/audio.js +272 -685
- package/dist/tools/base-tool.d.ts +17 -0
- package/dist/tools/base-tool.js +46 -0
- package/dist/tools/behavior-tree.d.ts +94 -0
- package/dist/tools/behavior-tree.js +39 -0
- package/dist/tools/blueprint/helpers.d.ts +29 -0
- package/dist/tools/blueprint/helpers.js +182 -0
- package/dist/tools/blueprint.d.ts +228 -118
- package/dist/tools/blueprint.js +685 -832
- package/dist/tools/consolidated-tool-definitions.d.ts +5462 -1781
- package/dist/tools/consolidated-tool-definitions.js +829 -496
- package/dist/tools/consolidated-tool-handlers.d.ts +2 -1
- package/dist/tools/consolidated-tool-handlers.js +211 -1026
- package/dist/tools/debug.d.ts +143 -85
- package/dist/tools/debug.js +234 -180
- package/dist/tools/dynamic-handler-registry.d.ts +11 -0
- package/dist/tools/dynamic-handler-registry.js +101 -0
- package/dist/tools/editor.d.ts +139 -18
- package/dist/tools/editor.js +239 -244
- package/dist/tools/engine.d.ts +10 -4
- package/dist/tools/engine.js +13 -5
- package/dist/tools/environment.d.ts +36 -0
- package/dist/tools/environment.js +267 -0
- package/dist/tools/foliage.d.ts +105 -14
- package/dist/tools/foliage.js +219 -331
- package/dist/tools/handlers/actor-handlers.d.ts +3 -0
- package/dist/tools/handlers/actor-handlers.js +232 -0
- package/dist/tools/handlers/animation-handlers.d.ts +3 -0
- package/dist/tools/handlers/animation-handlers.js +185 -0
- package/dist/tools/handlers/argument-helper.d.ts +16 -0
- package/dist/tools/handlers/argument-helper.js +80 -0
- package/dist/tools/handlers/asset-handlers.d.ts +3 -0
- package/dist/tools/handlers/asset-handlers.js +496 -0
- package/dist/tools/handlers/audio-handlers.d.ts +3 -0
- package/dist/tools/handlers/audio-handlers.js +166 -0
- package/dist/tools/handlers/blueprint-handlers.d.ts +4 -0
- package/dist/tools/handlers/blueprint-handlers.js +358 -0
- package/dist/tools/handlers/common-handlers.d.ts +14 -0
- package/dist/tools/handlers/common-handlers.js +56 -0
- package/dist/tools/handlers/editor-handlers.d.ts +3 -0
- package/dist/tools/handlers/editor-handlers.js +119 -0
- package/dist/tools/handlers/effect-handlers.d.ts +3 -0
- package/dist/tools/handlers/effect-handlers.js +171 -0
- package/dist/tools/handlers/environment-handlers.d.ts +3 -0
- package/dist/tools/handlers/environment-handlers.js +170 -0
- package/dist/tools/handlers/graph-handlers.d.ts +3 -0
- package/dist/tools/handlers/graph-handlers.js +90 -0
- package/dist/tools/handlers/input-handlers.d.ts +3 -0
- package/dist/tools/handlers/input-handlers.js +21 -0
- package/dist/tools/handlers/inspect-handlers.d.ts +3 -0
- package/dist/tools/handlers/inspect-handlers.js +383 -0
- package/dist/tools/handlers/level-handlers.d.ts +3 -0
- package/dist/tools/handlers/level-handlers.js +237 -0
- package/dist/tools/handlers/lighting-handlers.d.ts +3 -0
- package/dist/tools/handlers/lighting-handlers.js +144 -0
- package/dist/tools/handlers/performance-handlers.d.ts +3 -0
- package/dist/tools/handlers/performance-handlers.js +130 -0
- package/dist/tools/handlers/pipeline-handlers.d.ts +3 -0
- package/dist/tools/handlers/pipeline-handlers.js +110 -0
- package/dist/tools/handlers/sequence-handlers.d.ts +3 -0
- package/dist/tools/handlers/sequence-handlers.js +376 -0
- package/dist/tools/handlers/system-handlers.d.ts +4 -0
- package/dist/tools/handlers/system-handlers.js +506 -0
- package/dist/tools/input.d.ts +19 -0
- package/dist/tools/input.js +89 -0
- package/dist/tools/introspection.d.ts +103 -40
- package/dist/tools/introspection.js +425 -568
- package/dist/tools/landscape.d.ts +97 -36
- package/dist/tools/landscape.js +280 -409
- package/dist/tools/level.d.ts +130 -10
- package/dist/tools/level.js +639 -675
- package/dist/tools/lighting.d.ts +77 -38
- package/dist/tools/lighting.js +441 -943
- package/dist/tools/logs.d.ts +3 -3
- package/dist/tools/logs.js +5 -57
- package/dist/tools/materials.d.ts +91 -24
- package/dist/tools/materials.js +190 -118
- package/dist/tools/niagara.d.ts +149 -39
- package/dist/tools/niagara.js +232 -182
- package/dist/tools/performance.d.ts +27 -12
- package/dist/tools/performance.js +204 -122
- package/dist/tools/physics.d.ts +32 -77
- package/dist/tools/physics.js +171 -582
- package/dist/tools/property-dictionary.d.ts +13 -0
- package/dist/tools/property-dictionary.js +82 -0
- package/dist/tools/sequence.d.ts +73 -48
- package/dist/tools/sequence.js +196 -748
- package/dist/tools/tool-definition-utils.d.ts +59 -0
- package/dist/tools/tool-definition-utils.js +35 -0
- package/dist/tools/ui.d.ts +66 -34
- package/dist/tools/ui.js +134 -214
- package/dist/types/env.d.ts +0 -3
- package/dist/types/env.js +0 -7
- package/dist/types/tool-interfaces.d.ts +898 -0
- package/dist/types/tool-interfaces.js +2 -0
- package/dist/types/tool-types.d.ts +183 -19
- package/dist/types/tool-types.js +0 -4
- package/dist/unreal-bridge.d.ts +24 -131
- package/dist/unreal-bridge.js +364 -1506
- package/dist/utils/command-validator.d.ts +9 -0
- package/dist/utils/command-validator.js +67 -0
- package/dist/utils/elicitation.d.ts +1 -1
- package/dist/utils/elicitation.js +12 -15
- package/dist/utils/error-handler.d.ts +2 -51
- package/dist/utils/error-handler.js +11 -87
- package/dist/utils/ini-reader.d.ts +3 -0
- package/dist/utils/ini-reader.js +69 -0
- package/dist/utils/logger.js +9 -6
- package/dist/utils/normalize.d.ts +3 -0
- package/dist/utils/normalize.js +56 -0
- package/dist/utils/response-factory.d.ts +7 -0
- package/dist/utils/response-factory.js +33 -0
- package/dist/utils/response-validator.d.ts +3 -24
- package/dist/utils/response-validator.js +130 -81
- package/dist/utils/result-helpers.d.ts +4 -5
- package/dist/utils/result-helpers.js +15 -16
- package/dist/utils/safe-json.js +5 -11
- package/dist/utils/unreal-command-queue.d.ts +24 -0
- package/dist/utils/unreal-command-queue.js +120 -0
- package/dist/utils/validation.d.ts +0 -40
- package/dist/utils/validation.js +1 -78
- package/dist/wasm/index.d.ts +70 -0
- package/dist/wasm/index.js +535 -0
- package/docs/GraphQL-API.md +888 -0
- package/docs/Migration-Guide-v0.5.0.md +692 -0
- package/docs/Roadmap.md +53 -0
- package/docs/WebAssembly-Integration.md +628 -0
- package/docs/editor-plugin-extension.md +370 -0
- package/docs/handler-mapping.md +242 -0
- package/docs/native-automation-progress.md +128 -0
- package/docs/testing-guide.md +423 -0
- package/mcp-config-example.json +6 -6
- package/package.json +60 -27
- package/plugins/McpAutomationBridge/Config/FilterPlugin.ini +8 -0
- package/plugins/McpAutomationBridge/McpAutomationBridge.uplugin +64 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/McpAutomationBridge.Build.cs +189 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeGlobals.cpp +22 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeGlobals.h +30 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeHelpers.h +1983 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeModule.cpp +72 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeSettings.cpp +46 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridgeSubsystem.cpp +581 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_AnimationHandlers.cpp +2394 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_AssetQueryHandlers.cpp +300 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_AssetWorkflowHandlers.cpp +2807 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_AudioHandlers.cpp +1087 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BehaviorTreeHandlers.cpp +488 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintCreationHandlers.cpp +643 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintCreationHandlers.h +31 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintGraphHandlers.cpp +1184 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintHandlers.cpp +5652 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_BlueprintHandlers_List.cpp +152 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_ControlHandlers.cpp +2614 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_DebugHandlers.cpp +42 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_EditorFunctionHandlers.cpp +1237 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_EffectHandlers.cpp +1701 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_EnvironmentHandlers.cpp +2145 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_FoliageHandlers.cpp +954 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_InputHandlers.cpp +209 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_InsightsHandlers.cpp +41 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_LandscapeHandlers.cpp +1164 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_LevelHandlers.cpp +762 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_LightingHandlers.cpp +634 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_LogHandlers.cpp +136 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_MaterialGraphHandlers.cpp +494 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_NiagaraGraphHandlers.cpp +278 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_NiagaraHandlers.cpp +625 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_PerformanceHandlers.cpp +401 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_PipelineHandlers.cpp +67 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_ProcessRequest.cpp +735 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_PropertyHandlers.cpp +2634 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_RenderHandlers.cpp +189 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_SCSHandlers.cpp +917 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_SCSHandlers.h +39 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_SequenceHandlers.cpp +2670 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_SequencerHandlers.cpp +519 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_TestHandlers.cpp +38 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_UiHandlers.cpp +668 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_WorldPartitionHandlers.cpp +346 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpBridgeWebSocket.cpp +1330 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpBridgeWebSocket.h +149 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpConnectionManager.cpp +783 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Public/McpAutomationBridgeSettings.h +115 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Public/McpAutomationBridgeSubsystem.h +796 -0
- package/plugins/McpAutomationBridge/Source/McpAutomationBridge/Public/McpConnectionManager.h +117 -0
- package/scripts/check-unreal-connection.mjs +19 -0
- package/scripts/clean-tmp.js +23 -0
- package/scripts/patch-wasm.js +26 -0
- package/scripts/run-all-tests.mjs +131 -0
- package/scripts/smoke-test.ts +94 -0
- package/scripts/sync-mcp-plugin.js +143 -0
- package/scripts/test-no-plugin-alternates.mjs +113 -0
- package/scripts/validate-server.js +46 -0
- package/scripts/verify-automation-bridge.js +200 -0
- package/server.json +57 -21
- package/src/automation/bridge.ts +558 -0
- package/src/automation/connection-manager.ts +130 -0
- package/src/automation/handshake.ts +99 -0
- package/src/automation/index.ts +2 -0
- package/src/automation/message-handler.ts +167 -0
- package/src/automation/request-tracker.ts +123 -0
- package/src/automation/types.ts +107 -0
- package/src/cli.ts +33 -6
- package/src/config.ts +73 -0
- package/src/constants.ts +12 -0
- package/src/graphql/resolvers.ts +1010 -0
- package/src/graphql/schema.ts +452 -0
- package/src/graphql/server.ts +154 -0
- package/src/graphql/types.ts +7 -0
- package/src/handlers/resource-handlers.ts +186 -0
- package/src/index.ts +152 -663
- package/src/prompts/index.ts +4 -4
- package/src/resources/actors.ts +58 -76
- package/src/resources/assets.ts +147 -134
- package/src/resources/levels.ts +28 -33
- package/src/server/resource-registry.ts +47 -0
- package/src/server/tool-registry.ts +354 -0
- package/src/server-setup.ts +148 -0
- package/src/services/health-monitor.ts +132 -0
- package/src/services/metrics-server.ts +142 -0
- package/src/tools/actors.ts +417 -322
- package/src/tools/animation.ts +671 -461
- package/src/tools/assets.ts +353 -289
- package/src/tools/audio.ts +323 -766
- package/src/tools/base-tool.ts +52 -0
- package/src/tools/behavior-tree.ts +45 -0
- package/src/tools/blueprint/helpers.ts +189 -0
- package/src/tools/blueprint.ts +787 -965
- package/src/tools/consolidated-tool-definitions.ts +993 -515
- package/src/tools/consolidated-tool-handlers.ts +272 -1139
- package/src/tools/debug.ts +292 -187
- package/src/tools/dynamic-handler-registry.ts +151 -0
- package/src/tools/editor.ts +309 -246
- package/src/tools/engine.ts +14 -3
- package/src/tools/environment.ts +287 -0
- package/src/tools/foliage.ts +314 -379
- package/src/tools/handlers/actor-handlers.ts +271 -0
- package/src/tools/handlers/animation-handlers.ts +237 -0
- package/src/tools/handlers/argument-helper.ts +142 -0
- package/src/tools/handlers/asset-handlers.ts +532 -0
- package/src/tools/handlers/audio-handlers.ts +194 -0
- package/src/tools/handlers/blueprint-handlers.ts +380 -0
- package/src/tools/handlers/common-handlers.ts +87 -0
- package/src/tools/handlers/editor-handlers.ts +123 -0
- package/src/tools/handlers/effect-handlers.ts +220 -0
- package/src/tools/handlers/environment-handlers.ts +183 -0
- package/src/tools/handlers/graph-handlers.ts +116 -0
- package/src/tools/handlers/input-handlers.ts +28 -0
- package/src/tools/handlers/inspect-handlers.ts +450 -0
- package/src/tools/handlers/level-handlers.ts +252 -0
- package/src/tools/handlers/lighting-handlers.ts +147 -0
- package/src/tools/handlers/performance-handlers.ts +132 -0
- package/src/tools/handlers/pipeline-handlers.ts +127 -0
- package/src/tools/handlers/sequence-handlers.ts +415 -0
- package/src/tools/handlers/system-handlers.ts +564 -0
- package/src/tools/input.ts +101 -0
- package/src/tools/introspection.ts +493 -584
- package/src/tools/landscape.ts +394 -489
- package/src/tools/level.ts +752 -694
- package/src/tools/lighting.ts +583 -984
- package/src/tools/logs.ts +9 -57
- package/src/tools/materials.ts +231 -121
- package/src/tools/niagara.ts +293 -168
- package/src/tools/performance.ts +320 -168
- package/src/tools/physics.ts +268 -613
- package/src/tools/property-dictionary.ts +98 -0
- package/src/tools/sequence.ts +255 -815
- package/src/tools/tool-definition-utils.ts +35 -0
- package/src/tools/ui.ts +207 -283
- package/src/types/env.ts +0 -10
- package/src/types/tool-interfaces.ts +250 -0
- package/src/types/tool-types.ts +243 -21
- package/src/unreal-bridge.ts +460 -1550
- package/src/utils/command-validator.ts +75 -0
- package/src/utils/elicitation.ts +10 -7
- package/src/utils/error-handler.ts +14 -90
- package/src/utils/ini-reader.ts +86 -0
- package/src/utils/logger.ts +8 -3
- package/src/utils/normalize.ts +60 -0
- package/src/utils/response-factory.ts +39 -0
- package/src/utils/response-validator.ts +176 -56
- package/src/utils/result-helpers.ts +21 -19
- package/src/utils/safe-json.ts +14 -11
- package/src/utils/unreal-command-queue.ts +152 -0
- package/src/utils/validation.ts +4 -1
- package/src/wasm/index.ts +838 -0
- package/test-server.mjs +100 -0
- package/tests/run-unreal-tool-tests.mjs +242 -14
- package/tests/test-animation.mjs +44 -0
- package/tests/test-asset-advanced.mjs +82 -0
- package/tests/test-asset-errors.mjs +35 -0
- package/tests/test-audio.mjs +219 -0
- package/tests/test-automation-timeouts.mjs +98 -0
- package/tests/test-behavior-tree.mjs +261 -0
- package/tests/test-blueprint-events.mjs +35 -0
- package/tests/test-blueprint-graph.mjs +79 -0
- package/tests/test-blueprint.mjs +577 -0
- package/tests/test-client-mode.mjs +86 -0
- package/tests/test-console-command.mjs +56 -0
- package/tests/test-control-actor.mjs +425 -0
- package/tests/test-control-editor.mjs +80 -0
- package/tests/test-extra-tools.mjs +38 -0
- package/tests/test-graphql.mjs +322 -0
- package/tests/test-inspect.mjs +72 -0
- package/tests/test-landscape.mjs +60 -0
- package/tests/test-manage-asset.mjs +438 -0
- package/tests/test-manage-level.mjs +70 -0
- package/tests/test-materials.mjs +356 -0
- package/tests/test-niagara.mjs +185 -0
- package/tests/test-no-inline-python.mjs +122 -0
- package/tests/test-plugin-handshake.mjs +82 -0
- package/tests/test-render.mjs +33 -0
- package/tests/test-runner.mjs +933 -0
- package/tests/test-search-assets.mjs +66 -0
- package/tests/test-sequence.mjs +68 -0
- package/tests/test-system.mjs +57 -0
- package/tests/test-wasm.mjs +193 -0
- package/tests/test-world-partition.mjs +215 -0
- package/tsconfig.json +3 -3
- package/wasm/Cargo.lock +363 -0
- package/wasm/Cargo.toml +42 -0
- package/wasm/LICENSE +21 -0
- package/wasm/README.md +253 -0
- package/wasm/src/dependency_resolver.rs +377 -0
- package/wasm/src/lib.rs +153 -0
- package/wasm/src/property_parser.rs +271 -0
- package/wasm/src/transform_math.rs +396 -0
- package/wasm/tests/integration.rs +109 -0
- package/.github/workflows/smithery-build.yml +0 -29
- package/dist/tools/build_environment_advanced.d.ts +0 -65
- package/dist/tools/build_environment_advanced.js +0 -633
- package/dist/tools/rc.d.ts +0 -110
- package/dist/tools/rc.js +0 -437
- package/dist/tools/visual.d.ts +0 -40
- package/dist/tools/visual.js +0 -282
- package/dist/utils/http.d.ts +0 -6
- package/dist/utils/http.js +0 -151
- package/dist/utils/python-output.d.ts +0 -18
- package/dist/utils/python-output.js +0 -290
- package/dist/utils/python.d.ts +0 -2
- package/dist/utils/python.js +0 -4
- package/dist/utils/stdio-redirect.d.ts +0 -2
- package/dist/utils/stdio-redirect.js +0 -20
- package/docs/unreal-tool-test-cases.md +0 -574
- package/smithery.yaml +0 -29
- package/src/tools/build_environment_advanced.ts +0 -732
- package/src/tools/rc.ts +0 -515
- package/src/tools/visual.ts +0 -281
- package/src/utils/http.ts +0 -187
- package/src/utils/python-output.ts +0 -351
- package/src/utils/python.ts +0 -3
- package/src/utils/stdio-redirect.ts +0 -18
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
#include "McpAutomationBridgeGlobals.h"
|
|
2
|
+
#include "McpAutomationBridgeHelpers.h"
|
|
3
|
+
#include "McpAutomationBridgeSubsystem.h"
|
|
4
|
+
|
|
5
|
+
#include "Components/ExponentialHeightFogComponent.h"
|
|
6
|
+
#include "Engine/ExponentialHeightFog.h"
|
|
7
|
+
#include "Engine/TextureCube.h"
|
|
8
|
+
|
|
9
|
+
#if WITH_EDITOR
|
|
10
|
+
#include "Components/DirectionalLightComponent.h"
|
|
11
|
+
#include "Components/PointLightComponent.h"
|
|
12
|
+
#include "Components/RectLightComponent.h"
|
|
13
|
+
#include "Components/SkyLightComponent.h"
|
|
14
|
+
#include "Components/SpotLightComponent.h"
|
|
15
|
+
#include "Engine/DirectionalLight.h"
|
|
16
|
+
#include "Engine/PointLight.h"
|
|
17
|
+
#include "Engine/RectLight.h"
|
|
18
|
+
#include "Engine/SkyLight.h"
|
|
19
|
+
#include "Engine/SpotLight.h"
|
|
20
|
+
#include "Lightmass/LightmassImportanceVolume.h"
|
|
21
|
+
|
|
22
|
+
/* UE5.6: LightingBuildOptions.h removed; use console exec */
|
|
23
|
+
#include "Editor/UnrealEd/Public/Editor.h"
|
|
24
|
+
#include "FileHelpers.h"
|
|
25
|
+
#include "Kismet/GameplayStatics.h"
|
|
26
|
+
#include "LevelEditor.h"
|
|
27
|
+
#include "Subsystems/EditorActorSubsystem.h"
|
|
28
|
+
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
bool UMcpAutomationBridgeSubsystem::HandleLightingAction(
|
|
32
|
+
const FString &RequestId, const FString &Action,
|
|
33
|
+
const TSharedPtr<FJsonObject> &Payload,
|
|
34
|
+
TSharedPtr<FMcpBridgeWebSocket> RequestingSocket) {
|
|
35
|
+
const FString Lower = Action.ToLower();
|
|
36
|
+
if (!Lower.StartsWith(TEXT("spawn_light")) &&
|
|
37
|
+
!Lower.StartsWith(TEXT("spawn_sky_light")) &&
|
|
38
|
+
!Lower.StartsWith(TEXT("build_lighting")) &&
|
|
39
|
+
!Lower.StartsWith(TEXT("ensure_single_sky_light")) &&
|
|
40
|
+
!Lower.StartsWith(TEXT("create_lighting_enabled_level")) &&
|
|
41
|
+
!Lower.StartsWith(TEXT("create_lightmass_volume")) &&
|
|
42
|
+
!Lower.StartsWith(TEXT("setup_volumetric_fog")) &&
|
|
43
|
+
!Lower.StartsWith(TEXT("setup_global_illumination")) &&
|
|
44
|
+
!Lower.StartsWith(TEXT("configure_shadows")) &&
|
|
45
|
+
!Lower.StartsWith(TEXT("set_exposure")) &&
|
|
46
|
+
!Lower.StartsWith(TEXT("set_ambient_occlusion"))) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#if WITH_EDITOR
|
|
51
|
+
if (!Payload.IsValid()) {
|
|
52
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
53
|
+
TEXT("Lighting payload missing"),
|
|
54
|
+
TEXT("INVALID_PAYLOAD"));
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
UEditorActorSubsystem *ActorSS =
|
|
59
|
+
GEditor->GetEditorSubsystem<UEditorActorSubsystem>();
|
|
60
|
+
if (!ActorSS) {
|
|
61
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
62
|
+
TEXT("EditorActorSubsystem not available"),
|
|
63
|
+
TEXT("EDITOR_ACTOR_SUBSYSTEM_MISSING"));
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (Lower == TEXT("spawn_light")) {
|
|
68
|
+
FString LightClassStr;
|
|
69
|
+
if (!Payload->TryGetStringField(TEXT("lightClass"), LightClassStr) ||
|
|
70
|
+
LightClassStr.IsEmpty()) {
|
|
71
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
72
|
+
TEXT("lightClass required"),
|
|
73
|
+
TEXT("INVALID_ARGUMENT"));
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
UClass *LightClass = nullptr;
|
|
78
|
+
if (LightClassStr == TEXT("DirectionalLight"))
|
|
79
|
+
LightClass = ADirectionalLight::StaticClass();
|
|
80
|
+
else if (LightClassStr == TEXT("PointLight"))
|
|
81
|
+
LightClass = APointLight::StaticClass();
|
|
82
|
+
else if (LightClassStr == TEXT("SpotLight"))
|
|
83
|
+
LightClass = ASpotLight::StaticClass();
|
|
84
|
+
else if (LightClassStr == TEXT("RectLight"))
|
|
85
|
+
LightClass = ARectLight::StaticClass();
|
|
86
|
+
else {
|
|
87
|
+
SendAutomationError(
|
|
88
|
+
RequestingSocket, RequestId,
|
|
89
|
+
FString::Printf(TEXT("Unknown light class: %s"), *LightClassStr),
|
|
90
|
+
TEXT("INVALID_ARGUMENT"));
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
FVector Location = FVector::ZeroVector;
|
|
95
|
+
const TSharedPtr<FJsonObject> *LocObj;
|
|
96
|
+
if (Payload->TryGetObjectField(TEXT("location"), LocObj)) {
|
|
97
|
+
Location.X = (*LocObj)->GetNumberField(TEXT("x"));
|
|
98
|
+
Location.Y = (*LocObj)->GetNumberField(TEXT("y"));
|
|
99
|
+
Location.Z = (*LocObj)->GetNumberField(TEXT("z"));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
FRotator Rotation = FRotator::ZeroRotator;
|
|
103
|
+
const TSharedPtr<FJsonObject> *RotObj;
|
|
104
|
+
if (Payload->TryGetObjectField(TEXT("rotation"), RotObj)) {
|
|
105
|
+
Rotation.Pitch = (*RotObj)->GetNumberField(TEXT("pitch"));
|
|
106
|
+
Rotation.Yaw = (*RotObj)->GetNumberField(TEXT("yaw"));
|
|
107
|
+
Rotation.Roll = (*RotObj)->GetNumberField(TEXT("roll"));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
AActor *NewLight = nullptr;
|
|
111
|
+
UWorld *TargetWorld = (GEditor->PlayWorld) ? GEditor->PlayWorld : nullptr;
|
|
112
|
+
|
|
113
|
+
if (TargetWorld) {
|
|
114
|
+
// PIE Path
|
|
115
|
+
FActorSpawnParameters SpawnParams;
|
|
116
|
+
SpawnParams.SpawnCollisionHandlingOverride =
|
|
117
|
+
ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
|
|
118
|
+
NewLight = TargetWorld->SpawnActor(LightClass, &Location, &Rotation,
|
|
119
|
+
SpawnParams);
|
|
120
|
+
} else {
|
|
121
|
+
// Editor Path
|
|
122
|
+
NewLight = ActorSS->SpawnActorFromClass(LightClass, Location, Rotation);
|
|
123
|
+
// Explicitly set location/rotation
|
|
124
|
+
if (NewLight) {
|
|
125
|
+
NewLight->SetActorLocationAndRotation(
|
|
126
|
+
Location, Rotation, false, nullptr, ETeleportType::TeleportPhysics);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (!NewLight) {
|
|
131
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
132
|
+
TEXT("Failed to spawn light actor"),
|
|
133
|
+
TEXT("SPAWN_FAILED"));
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
FString Name;
|
|
138
|
+
if (Payload->TryGetStringField(TEXT("name"), Name) && !Name.IsEmpty()) {
|
|
139
|
+
NewLight->SetActorLabel(Name);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Default to Movable for immediate feedback
|
|
143
|
+
if (ULightComponent *BaseLightComp =
|
|
144
|
+
NewLight->FindComponentByClass<ULightComponent>()) {
|
|
145
|
+
BaseLightComp->SetMobility(EComponentMobility::Movable);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Apply properties
|
|
149
|
+
const TSharedPtr<FJsonObject> *Props;
|
|
150
|
+
if (Payload->TryGetObjectField(TEXT("properties"), Props)) {
|
|
151
|
+
ULightComponent *LightComp =
|
|
152
|
+
NewLight->FindComponentByClass<ULightComponent>();
|
|
153
|
+
if (LightComp) {
|
|
154
|
+
double Intensity;
|
|
155
|
+
if ((*Props)->TryGetNumberField(TEXT("intensity"), Intensity)) {
|
|
156
|
+
LightComp->SetIntensity((float)Intensity);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const TSharedPtr<FJsonObject> *ColorObj;
|
|
160
|
+
if ((*Props)->TryGetObjectField(TEXT("color"), ColorObj)) {
|
|
161
|
+
FLinearColor Color;
|
|
162
|
+
Color.R = (*ColorObj)->GetNumberField(TEXT("r"));
|
|
163
|
+
Color.G = (*ColorObj)->GetNumberField(TEXT("g"));
|
|
164
|
+
Color.B = (*ColorObj)->GetNumberField(TEXT("b"));
|
|
165
|
+
Color.A = (*ColorObj)->HasField(TEXT("a"))
|
|
166
|
+
? (*ColorObj)->GetNumberField(TEXT("a"))
|
|
167
|
+
: 1.0f;
|
|
168
|
+
LightComp->SetLightColor(Color);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
bool bCastShadows;
|
|
172
|
+
if ((*Props)->TryGetBoolField(TEXT("castShadows"), bCastShadows)) {
|
|
173
|
+
LightComp->SetCastShadows(bCastShadows);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Type specific properties
|
|
177
|
+
if (UDirectionalLightComponent *DirComp =
|
|
178
|
+
Cast<UDirectionalLightComponent>(LightComp)) {
|
|
179
|
+
// Default to using as Atmosphere Sun Light unless explicitly disabled
|
|
180
|
+
bool bUseSun = true;
|
|
181
|
+
if ((*Props)->TryGetBoolField(TEXT("useAsAtmosphereSunLight"),
|
|
182
|
+
bUseSun)) {
|
|
183
|
+
DirComp->SetAtmosphereSunLight(bUseSun);
|
|
184
|
+
} else {
|
|
185
|
+
DirComp->SetAtmosphereSunLight(true);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (UPointLightComponent *PointComp =
|
|
190
|
+
Cast<UPointLightComponent>(LightComp)) {
|
|
191
|
+
double Radius;
|
|
192
|
+
if ((*Props)->TryGetNumberField(TEXT("attenuationRadius"), Radius)) {
|
|
193
|
+
PointComp->SetAttenuationRadius((float)Radius);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (USpotLightComponent *SpotComp =
|
|
198
|
+
Cast<USpotLightComponent>(LightComp)) {
|
|
199
|
+
double InnerCone;
|
|
200
|
+
if ((*Props)->TryGetNumberField(TEXT("innerConeAngle"), InnerCone)) {
|
|
201
|
+
SpotComp->SetInnerConeAngle((float)InnerCone);
|
|
202
|
+
}
|
|
203
|
+
double OuterCone;
|
|
204
|
+
if ((*Props)->TryGetNumberField(TEXT("outerConeAngle"), OuterCone)) {
|
|
205
|
+
SpotComp->SetOuterConeAngle((float)OuterCone);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (URectLightComponent *RectComp =
|
|
210
|
+
Cast<URectLightComponent>(LightComp)) {
|
|
211
|
+
double Width;
|
|
212
|
+
if ((*Props)->TryGetNumberField(TEXT("sourceWidth"), Width)) {
|
|
213
|
+
RectComp->SetSourceWidth((float)Width);
|
|
214
|
+
}
|
|
215
|
+
double Height;
|
|
216
|
+
if ((*Props)->TryGetNumberField(TEXT("sourceHeight"), Height)) {
|
|
217
|
+
RectComp->SetSourceHeight((float)Height);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
224
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
225
|
+
Resp->SetStringField(TEXT("actorName"), NewLight->GetActorLabel());
|
|
226
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
227
|
+
TEXT("Light spawned"), Resp);
|
|
228
|
+
return true;
|
|
229
|
+
} else if (Lower == TEXT("spawn_sky_light")) {
|
|
230
|
+
AActor *SkyLight = SpawnActorInActiveWorld<AActor>(
|
|
231
|
+
ASkyLight::StaticClass(), FVector::ZeroVector, FRotator::ZeroRotator);
|
|
232
|
+
if (!SkyLight) {
|
|
233
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
234
|
+
TEXT("Failed to spawn SkyLight"),
|
|
235
|
+
TEXT("SPAWN_FAILED"));
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
FString Name;
|
|
240
|
+
if (Payload->TryGetStringField(TEXT("name"), Name) && !Name.IsEmpty()) {
|
|
241
|
+
SkyLight->SetActorLabel(Name);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
USkyLightComponent *SkyComp =
|
|
245
|
+
SkyLight->FindComponentByClass<USkyLightComponent>();
|
|
246
|
+
if (SkyComp) {
|
|
247
|
+
FString SourceType;
|
|
248
|
+
if (Payload->TryGetStringField(TEXT("sourceType"), SourceType)) {
|
|
249
|
+
if (SourceType == TEXT("SpecifiedCubemap")) {
|
|
250
|
+
SkyComp->SourceType = ESkyLightSourceType::SLS_SpecifiedCubemap;
|
|
251
|
+
FString CubemapPath;
|
|
252
|
+
if (Payload->TryGetStringField(TEXT("cubemapPath"), CubemapPath) &&
|
|
253
|
+
!CubemapPath.IsEmpty()) {
|
|
254
|
+
UTextureCube *Cubemap = Cast<UTextureCube>(StaticLoadObject(
|
|
255
|
+
UTextureCube::StaticClass(), nullptr, *CubemapPath));
|
|
256
|
+
if (Cubemap) {
|
|
257
|
+
SkyComp->Cubemap = Cubemap;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
SkyComp->SourceType = ESkyLightSourceType::SLS_CapturedScene;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
double Intensity;
|
|
266
|
+
if (Payload->TryGetNumberField(TEXT("intensity"), Intensity)) {
|
|
267
|
+
SkyComp->SetIntensity((float)Intensity);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
bool bRecapture;
|
|
271
|
+
if (Payload->TryGetBoolField(TEXT("recapture"), bRecapture) &&
|
|
272
|
+
bRecapture) {
|
|
273
|
+
SkyComp->RecaptureSky();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
278
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
279
|
+
Resp->SetStringField(TEXT("actorName"), SkyLight->GetActorLabel());
|
|
280
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
281
|
+
TEXT("SkyLight spawned"), Resp);
|
|
282
|
+
return true;
|
|
283
|
+
} else if (Lower == TEXT("build_lighting")) {
|
|
284
|
+
if (GEditor && GEditor->GetEditorWorldContext().World()) {
|
|
285
|
+
if (GEditor && GEditor->GetEditorWorldContext().World())
|
|
286
|
+
GEditor->Exec(GEditor->GetEditorWorldContext().World(),
|
|
287
|
+
TEXT("BuildLighting Production"));
|
|
288
|
+
}
|
|
289
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
290
|
+
TEXT("Lighting build started"), nullptr);
|
|
291
|
+
return true;
|
|
292
|
+
} else if (Lower == TEXT("ensure_single_sky_light")) {
|
|
293
|
+
TArray<AActor *> AllActors = ActorSS->GetAllLevelActors();
|
|
294
|
+
TArray<AActor *> SkyLights;
|
|
295
|
+
for (AActor *Actor : AllActors) {
|
|
296
|
+
if (Actor && Actor->IsA<ASkyLight>()) {
|
|
297
|
+
SkyLights.Add(Actor);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
FString TargetName;
|
|
302
|
+
Payload->TryGetStringField(TEXT("name"), TargetName);
|
|
303
|
+
if (TargetName.IsEmpty())
|
|
304
|
+
TargetName = TEXT("SkyLight");
|
|
305
|
+
|
|
306
|
+
int32 RemovedCount = 0;
|
|
307
|
+
AActor *KeptActor = nullptr;
|
|
308
|
+
|
|
309
|
+
// Keep the one matching the name, or the first one
|
|
310
|
+
for (AActor *SkyLight : SkyLights) {
|
|
311
|
+
if (!KeptActor &&
|
|
312
|
+
(SkyLight->GetActorLabel() == TargetName || TargetName.IsEmpty())) {
|
|
313
|
+
KeptActor = SkyLight;
|
|
314
|
+
if (!TargetName.IsEmpty())
|
|
315
|
+
SkyLight->SetActorLabel(TargetName);
|
|
316
|
+
} else if (!KeptActor) {
|
|
317
|
+
KeptActor = SkyLight;
|
|
318
|
+
if (!TargetName.IsEmpty())
|
|
319
|
+
SkyLight->SetActorLabel(TargetName);
|
|
320
|
+
} else {
|
|
321
|
+
ActorSS->DestroyActor(SkyLight);
|
|
322
|
+
RemovedCount++;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (!KeptActor) {
|
|
327
|
+
// Spawn one if none existed
|
|
328
|
+
KeptActor = SpawnActorInActiveWorld<AActor>(
|
|
329
|
+
ASkyLight::StaticClass(), FVector::ZeroVector, FRotator::ZeroRotator,
|
|
330
|
+
TargetName);
|
|
331
|
+
// Label already set by SpawnActorInActiveWorld if TargetName was provided
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (KeptActor) {
|
|
335
|
+
bool bRecapture;
|
|
336
|
+
if (Payload->TryGetBoolField(TEXT("recapture"), bRecapture) &&
|
|
337
|
+
bRecapture) {
|
|
338
|
+
if (USkyLightComponent *Comp =
|
|
339
|
+
KeptActor->FindComponentByClass<USkyLightComponent>()) {
|
|
340
|
+
Comp->RecaptureSky();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
346
|
+
Resp->SetNumberField(TEXT("removed"), RemovedCount);
|
|
347
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
348
|
+
TEXT("Ensured single SkyLight"), Resp);
|
|
349
|
+
return true;
|
|
350
|
+
} else if (Lower == TEXT("create_lightmass_volume")) {
|
|
351
|
+
FVector Location = FVector::ZeroVector;
|
|
352
|
+
const TSharedPtr<FJsonObject> *LocObj;
|
|
353
|
+
if (Payload->TryGetObjectField(TEXT("location"), LocObj)) {
|
|
354
|
+
Location.X = (*LocObj)->GetNumberField(TEXT("x"));
|
|
355
|
+
Location.Y = (*LocObj)->GetNumberField(TEXT("y"));
|
|
356
|
+
Location.Z = (*LocObj)->GetNumberField(TEXT("z"));
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
FVector Size = FVector(1000, 1000, 1000);
|
|
360
|
+
const TSharedPtr<FJsonObject> *SizeObj;
|
|
361
|
+
if (Payload->TryGetObjectField(TEXT("size"), SizeObj)) {
|
|
362
|
+
Size.X = (*SizeObj)->GetNumberField(TEXT("x"));
|
|
363
|
+
Size.Y = (*SizeObj)->GetNumberField(TEXT("y"));
|
|
364
|
+
Size.Z = (*SizeObj)->GetNumberField(TEXT("z"));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
AActor *Volume = SpawnActorInActiveWorld<AActor>(
|
|
368
|
+
ALightmassImportanceVolume::StaticClass(), Location,
|
|
369
|
+
FRotator::ZeroRotator);
|
|
370
|
+
if (Volume) {
|
|
371
|
+
Volume->SetActorScale3D(Size /
|
|
372
|
+
200.0f); // Brush size adjustment approximation
|
|
373
|
+
|
|
374
|
+
FString Name;
|
|
375
|
+
if (Payload->TryGetStringField(TEXT("name"), Name) && !Name.IsEmpty()) {
|
|
376
|
+
Volume->SetActorLabel(Name);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
380
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
381
|
+
Resp->SetStringField(TEXT("actorName"), Volume->GetActorLabel());
|
|
382
|
+
|
|
383
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
384
|
+
TEXT("LightmassImportanceVolume created"), Resp);
|
|
385
|
+
} else {
|
|
386
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
387
|
+
TEXT("Failed to spawn LightmassImportanceVolume"),
|
|
388
|
+
TEXT("SPAWN_FAILED"));
|
|
389
|
+
}
|
|
390
|
+
return true;
|
|
391
|
+
} else if (Lower == TEXT("setup_volumetric_fog")) {
|
|
392
|
+
// Find existing or spawn new ExponentialHeightFog
|
|
393
|
+
AExponentialHeightFog *FogActor = nullptr;
|
|
394
|
+
TArray<AActor *> AllActors = ActorSS->GetAllLevelActors();
|
|
395
|
+
for (AActor *Actor : AllActors) {
|
|
396
|
+
if (Actor && Actor->IsA<AExponentialHeightFog>()) {
|
|
397
|
+
FogActor = Cast<AExponentialHeightFog>(Actor);
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (!FogActor) {
|
|
403
|
+
FogActor = Cast<AExponentialHeightFog>(SpawnActorInActiveWorld<AActor>(
|
|
404
|
+
AExponentialHeightFog::StaticClass(), FVector::ZeroVector,
|
|
405
|
+
FRotator::ZeroRotator));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (FogActor && FogActor->GetComponent()) {
|
|
409
|
+
UExponentialHeightFogComponent *FogComp = FogActor->GetComponent();
|
|
410
|
+
FogComp->bEnableVolumetricFog = true;
|
|
411
|
+
|
|
412
|
+
double Distance;
|
|
413
|
+
if (Payload->TryGetNumberField(TEXT("viewDistance"), Distance)) {
|
|
414
|
+
FogComp->VolumetricFogDistance = (float)Distance;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
418
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
419
|
+
Resp->SetStringField(TEXT("actorName"), FogActor->GetActorLabel());
|
|
420
|
+
Resp->SetBoolField(TEXT("enabled"), true);
|
|
421
|
+
|
|
422
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
423
|
+
TEXT("Volumetric fog enabled"), Resp);
|
|
424
|
+
} else {
|
|
425
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
426
|
+
TEXT("Failed to find or spawn ExponentialHeightFog"),
|
|
427
|
+
TEXT("EXECUTION_ERROR"));
|
|
428
|
+
}
|
|
429
|
+
return true;
|
|
430
|
+
} else if (Lower == TEXT("setup_global_illumination")) {
|
|
431
|
+
FString Method;
|
|
432
|
+
if (Payload->TryGetStringField(TEXT("method"), Method)) {
|
|
433
|
+
if (Method == TEXT("LumenGI")) {
|
|
434
|
+
IConsoleVariable *CVar = IConsoleManager::Get().FindConsoleVariable(
|
|
435
|
+
TEXT("r.DynamicGlobalIlluminationMethod"));
|
|
436
|
+
if (CVar)
|
|
437
|
+
CVar->Set(1); // 1 = Lumen
|
|
438
|
+
|
|
439
|
+
IConsoleVariable *CVarRefl = IConsoleManager::Get().FindConsoleVariable(
|
|
440
|
+
TEXT("r.ReflectionMethod"));
|
|
441
|
+
if (CVarRefl)
|
|
442
|
+
CVarRefl->Set(1); // 1 = Lumen
|
|
443
|
+
} else if (Method == TEXT("ScreenSpace")) {
|
|
444
|
+
IConsoleVariable *CVar = IConsoleManager::Get().FindConsoleVariable(
|
|
445
|
+
TEXT("r.DynamicGlobalIlluminationMethod"));
|
|
446
|
+
if (CVar)
|
|
447
|
+
CVar->Set(2); // SSGI
|
|
448
|
+
} else if (Method == TEXT("None")) {
|
|
449
|
+
IConsoleVariable *CVar = IConsoleManager::Get().FindConsoleVariable(
|
|
450
|
+
TEXT("r.DynamicGlobalIlluminationMethod"));
|
|
451
|
+
if (CVar)
|
|
452
|
+
CVar->Set(0);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
456
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
457
|
+
Resp->SetStringField(TEXT("method"), Method);
|
|
458
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
459
|
+
TEXT("GI method configured"), Resp);
|
|
460
|
+
return true;
|
|
461
|
+
} else if (Lower == TEXT("configure_shadows")) {
|
|
462
|
+
bool bVirtual = false;
|
|
463
|
+
if (Payload->TryGetBoolField(TEXT("virtualShadowMaps"), bVirtual) ||
|
|
464
|
+
Payload->TryGetBoolField(TEXT("rayTracedShadows"), bVirtual)) {
|
|
465
|
+
// Loose mapping to VSM
|
|
466
|
+
IConsoleVariable *CVar = IConsoleManager::Get().FindConsoleVariable(
|
|
467
|
+
TEXT("r.Shadow.Virtual.Enable"));
|
|
468
|
+
if (CVar)
|
|
469
|
+
CVar->Set(bVirtual ? 1 : 0);
|
|
470
|
+
}
|
|
471
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
472
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
473
|
+
Resp->SetBoolField(TEXT("virtualShadowMaps"), bVirtual);
|
|
474
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
475
|
+
TEXT("Shadows configured"), Resp);
|
|
476
|
+
return true;
|
|
477
|
+
} else if (Lower == TEXT("set_exposure")) {
|
|
478
|
+
// Requires a PostProcessVolume.
|
|
479
|
+
// Find unbounded one or spawn one.
|
|
480
|
+
APostProcessVolume *PPV = nullptr;
|
|
481
|
+
TArray<AActor *> AllActors = ActorSS->GetAllLevelActors();
|
|
482
|
+
for (AActor *Actor : AllActors) {
|
|
483
|
+
if (Actor && Actor->IsA<APostProcessVolume>()) {
|
|
484
|
+
APostProcessVolume *Candidate = Cast<APostProcessVolume>(Actor);
|
|
485
|
+
if (Candidate->bUnbound) {
|
|
486
|
+
PPV = Candidate;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (!PPV) {
|
|
493
|
+
PPV = Cast<APostProcessVolume>(SpawnActorInActiveWorld<AActor>(
|
|
494
|
+
APostProcessVolume::StaticClass(), FVector::ZeroVector,
|
|
495
|
+
FRotator::ZeroRotator));
|
|
496
|
+
if (PPV)
|
|
497
|
+
PPV->bUnbound = true;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (PPV) {
|
|
501
|
+
double MinB = 0.0, MaxB = 0.0;
|
|
502
|
+
if (Payload->TryGetNumberField(TEXT("minBrightness"), MinB))
|
|
503
|
+
PPV->Settings.AutoExposureMinBrightness = (float)MinB;
|
|
504
|
+
if (Payload->TryGetNumberField(TEXT("maxBrightness"), MaxB))
|
|
505
|
+
PPV->Settings.AutoExposureMaxBrightness = (float)MaxB;
|
|
506
|
+
|
|
507
|
+
// Bias/Compensation
|
|
508
|
+
double Comp = 0.0;
|
|
509
|
+
if (Payload->TryGetNumberField(TEXT("compensationValue"), Comp))
|
|
510
|
+
PPV->Settings.AutoExposureBias = (float)Comp;
|
|
511
|
+
|
|
512
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
513
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
514
|
+
Resp->SetStringField(TEXT("actorName"), PPV->GetActorLabel());
|
|
515
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
516
|
+
TEXT("Exposure settings applied"), Resp);
|
|
517
|
+
} else {
|
|
518
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
519
|
+
TEXT("Failed to find/spawn PostProcessVolume"),
|
|
520
|
+
TEXT("EXECUTION_ERROR"));
|
|
521
|
+
}
|
|
522
|
+
return true;
|
|
523
|
+
} else if (Lower == TEXT("set_ambient_occlusion")) {
|
|
524
|
+
// Find unbounded one or spawn one.
|
|
525
|
+
APostProcessVolume *PPV = nullptr;
|
|
526
|
+
TArray<AActor *> AllActors = ActorSS->GetAllLevelActors();
|
|
527
|
+
for (AActor *Actor : AllActors) {
|
|
528
|
+
if (Actor && Actor->IsA<APostProcessVolume>()) {
|
|
529
|
+
APostProcessVolume *Candidate = Cast<APostProcessVolume>(Actor);
|
|
530
|
+
if (Candidate->bUnbound) {
|
|
531
|
+
PPV = Candidate;
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
if (!PPV) {
|
|
538
|
+
PPV = Cast<APostProcessVolume>(SpawnActorInActiveWorld<AActor>(
|
|
539
|
+
APostProcessVolume::StaticClass(), FVector::ZeroVector,
|
|
540
|
+
FRotator::ZeroRotator));
|
|
541
|
+
if (PPV)
|
|
542
|
+
PPV->bUnbound = true;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (PPV) {
|
|
546
|
+
bool bEnabled = true;
|
|
547
|
+
if (Payload->TryGetBoolField(TEXT("enabled"), bEnabled)) {
|
|
548
|
+
PPV->Settings.bOverride_AmbientOcclusionIntensity = true;
|
|
549
|
+
PPV->Settings.AmbientOcclusionIntensity =
|
|
550
|
+
bEnabled ? 0.5f : 0.0f; // Default on if enabled, 0 if disabled
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
double Intensity;
|
|
554
|
+
if (Payload->TryGetNumberField(TEXT("intensity"), Intensity)) {
|
|
555
|
+
PPV->Settings.bOverride_AmbientOcclusionIntensity = true;
|
|
556
|
+
PPV->Settings.AmbientOcclusionIntensity = (float)Intensity;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
double Radius;
|
|
560
|
+
if (Payload->TryGetNumberField(TEXT("radius"), Radius)) {
|
|
561
|
+
PPV->Settings.bOverride_AmbientOcclusionRadius = true;
|
|
562
|
+
PPV->Settings.AmbientOcclusionRadius = (float)Radius;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
566
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
567
|
+
Resp->SetStringField(TEXT("actorName"), PPV->GetActorLabel());
|
|
568
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
569
|
+
TEXT("Ambient Occlusion settings configured"),
|
|
570
|
+
Resp);
|
|
571
|
+
} else {
|
|
572
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
573
|
+
TEXT("Failed to find/spawn PostProcessVolume"),
|
|
574
|
+
TEXT("EXECUTION_ERROR"));
|
|
575
|
+
}
|
|
576
|
+
return true;
|
|
577
|
+
} else if (Lower == TEXT("create_lighting_enabled_level")) {
|
|
578
|
+
FString Path;
|
|
579
|
+
if (!Payload->TryGetStringField(TEXT("path"), Path) || Path.IsEmpty()) {
|
|
580
|
+
SendAutomationError(RequestingSocket, RequestId, TEXT("path required"),
|
|
581
|
+
TEXT("INVALID_ARGUMENT"));
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
if (GEditor) {
|
|
586
|
+
// Create a new blank map
|
|
587
|
+
GEditor->NewMap();
|
|
588
|
+
bool bNewMap = true; // Assume success
|
|
589
|
+
if (!bNewMap) {
|
|
590
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
591
|
+
TEXT("Failed to create new map"),
|
|
592
|
+
TEXT("CREATION_FAILED"));
|
|
593
|
+
return true;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// Add basic lighting
|
|
597
|
+
SpawnActorInActiveWorld<AActor>(ADirectionalLight::StaticClass(),
|
|
598
|
+
FVector(0, 0, 500), FRotator(-45, 0, 0),
|
|
599
|
+
TEXT("Sun"));
|
|
600
|
+
SpawnActorInActiveWorld<AActor>(ASkyLight::StaticClass(),
|
|
601
|
+
FVector::ZeroVector,
|
|
602
|
+
FRotator::ZeroRotator, TEXT("SkyLight"));
|
|
603
|
+
|
|
604
|
+
// Save the level
|
|
605
|
+
bool bSaved = FEditorFileUtils::SaveLevel(
|
|
606
|
+
GEditor->GetEditorWorldContext().World()->PersistentLevel, *Path);
|
|
607
|
+
if (bSaved) {
|
|
608
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
609
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
610
|
+
Resp->SetStringField(TEXT("path"), Path);
|
|
611
|
+
Resp->SetStringField(TEXT("message"),
|
|
612
|
+
TEXT("Level created with lighting"));
|
|
613
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
614
|
+
TEXT("Level created with lighting"), Resp);
|
|
615
|
+
} else {
|
|
616
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
617
|
+
TEXT("Failed to save level"), TEXT("SAVE_FAILED"));
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
621
|
+
TEXT("Editor not available"),
|
|
622
|
+
TEXT("EDITOR_NOT_AVAILABLE"));
|
|
623
|
+
}
|
|
624
|
+
return true;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return false;
|
|
628
|
+
#else
|
|
629
|
+
SendAutomationResponse(RequestingSocket, RequestId, false,
|
|
630
|
+
TEXT("Lighting actions require editor build"), nullptr,
|
|
631
|
+
TEXT("NOT_IMPLEMENTED"));
|
|
632
|
+
return true;
|
|
633
|
+
#endif
|
|
634
|
+
}
|