unreal-engine-mcp-server 0.4.7 → 0.5.1
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-config.yml +51 -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 +27 -0
- package/.github/workflows/labeler.yml +17 -0
- package/.github/workflows/links.yml +80 -0
- package/.github/workflows/pr-size-labeler.yml +137 -0
- package/.github/workflows/publish-mcp.yml +13 -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 +338 -31
- package/CONTRIBUTING.md +140 -0
- package/GEMINI.md +115 -0
- package/Public/Plugin_setup_guide.mp4 +0 -0
- package/README.md +189 -128
- 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 +26 -0
- package/dist/config.js +59 -0
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +16 -0
- package/dist/graphql/loaders.d.ts +64 -0
- package/dist/graphql/loaders.js +117 -0
- package/dist/graphql/resolvers.d.ts +268 -0
- package/dist/graphql/resolvers.js +746 -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 +117 -0
- package/dist/graphql/types.d.ts +9 -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 +33 -18
- package/dist/index.js +130 -619
- 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 +20 -0
- package/dist/server-setup.js +71 -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 +163 -9
- package/dist/tools/actors.js +356 -311
- package/dist/tools/animation.d.ts +135 -4
- package/dist/tools/animation.js +510 -411
- package/dist/tools/assets.d.ts +75 -29
- package/dist/tools/assets.js +265 -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.d.ts +208 -126
- 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 +198 -1027
- package/dist/tools/debug.d.ts +143 -85
- package/dist/tools/debug.js +234 -180
- package/dist/tools/dynamic-handler-registry.d.ts +13 -0
- package/dist/tools/dynamic-handler-registry.js +23 -0
- package/dist/tools/editor.d.ts +30 -83
- package/dist/tools/editor.js +247 -244
- package/dist/tools/engine.d.ts +10 -4
- package/dist/tools/engine.js +13 -5
- package/dist/tools/environment.d.ts +30 -0
- package/dist/tools/environment.js +267 -0
- package/dist/tools/foliage.d.ts +65 -99
- package/dist/tools/foliage.js +221 -331
- package/dist/tools/handlers/actor-handlers.d.ts +3 -0
- package/dist/tools/handlers/actor-handlers.js +227 -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 +54 -93
- package/dist/tools/landscape.js +284 -409
- package/dist/tools/level.d.ts +66 -27
- package/dist/tools/level.js +647 -675
- package/dist/tools/lighting.d.ts +77 -38
- package/dist/tools/lighting.js +445 -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 +194 -118
- package/dist/tools/niagara.d.ts +149 -39
- package/dist/tools/niagara.js +267 -182
- package/dist/tools/performance.d.ts +27 -13
- package/dist/tools/performance.js +203 -122
- package/dist/tools/physics.d.ts +32 -77
- package/dist/tools/physics.js +175 -582
- package/dist/tools/property-dictionary.d.ts +13 -0
- package/dist/tools/property-dictionary.js +82 -0
- package/dist/tools/sequence.d.ts +85 -60
- package/dist/tools/sequence.js +208 -747
- 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 +64 -34
- package/dist/tools/ui.js +134 -214
- package/dist/types/automation-responses.d.ts +115 -0
- package/dist/types/automation-responses.js +2 -0
- package/dist/types/env.d.ts +0 -3
- package/dist/types/env.js +0 -7
- package/dist/types/responses.d.ts +249 -0
- package/dist/types/responses.js +2 -0
- 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 +68 -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/path-security.d.ts +2 -0
- package/dist/utils/path-security.js +24 -0
- package/dist/utils/response-factory.d.ts +7 -0
- package/dist/utils/response-factory.js +27 -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 +684 -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 +67 -28
- 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 +136 -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 +58 -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 +19 -0
- package/src/graphql/loaders.ts +244 -0
- package/src/graphql/resolvers.ts +1008 -0
- package/src/graphql/schema.ts +452 -0
- package/src/graphql/server.ts +156 -0
- package/src/graphql/types.ts +10 -0
- package/src/handlers/resource-handlers.ts +186 -0
- package/src/index.ts +166 -664
- package/src/resources/actors.ts +58 -76
- package/src/resources/assets.ts +148 -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 +114 -0
- package/src/services/health-monitor.ts +132 -0
- package/src/services/metrics-server.ts +142 -0
- package/src/tools/actors.ts +426 -323
- package/src/tools/animation.ts +672 -461
- package/src/tools/assets.ts +364 -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.ts +792 -970
- package/src/tools/consolidated-tool-definitions.ts +993 -515
- package/src/tools/consolidated-tool-handlers.ts +258 -1146
- package/src/tools/debug.ts +292 -187
- package/src/tools/dynamic-handler-registry.ts +33 -0
- package/src/tools/editor.ts +329 -253
- package/src/tools/engine.ts +14 -3
- package/src/tools/environment.ts +281 -0
- package/src/tools/foliage.ts +330 -392
- package/src/tools/handlers/actor-handlers.ts +265 -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 +418 -507
- package/src/tools/level.ts +786 -708
- package/src/tools/lighting.ts +588 -984
- package/src/tools/logs.ts +9 -57
- package/src/tools/materials.ts +237 -121
- package/src/tools/niagara.ts +335 -168
- package/src/tools/performance.ts +320 -169
- package/src/tools/physics.ts +274 -613
- package/src/tools/property-dictionary.ts +98 -0
- package/src/tools/sequence.ts +276 -820
- package/src/tools/tool-definition-utils.ts +35 -0
- package/src/tools/ui.ts +205 -283
- package/src/types/automation-responses.ts +119 -0
- package/src/types/env.ts +0 -10
- package/src/types/responses.ts +355 -0
- 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 +76 -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.test.ts +162 -0
- package/src/utils/normalize.ts +60 -0
- package/src/utils/path-security.ts +43 -0
- package/src/utils/response-factory.ts +44 -0
- package/src/utils/response-validator.ts +176 -56
- package/src/utils/result-helpers.ts +21 -19
- package/src/utils/safe-json.test.ts +90 -0
- package/src/utils/safe-json.ts +14 -11
- package/src/utils/unreal-command-queue.ts +152 -0
- package/src/utils/validation.test.ts +184 -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 +369 -0
- package/tests/test-asset-advanced.mjs +82 -0
- package/tests/test-asset-errors.mjs +35 -0
- package/tests/test-asset-graph.mjs +311 -0
- package/tests/test-audio.mjs +417 -0
- package/tests/test-automation-timeouts.mjs +98 -0
- package/tests/test-behavior-tree.mjs +444 -0
- package/tests/test-blueprint-graph.mjs +410 -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 +112 -0
- package/tests/test-graphql.mjs +372 -0
- package/tests/test-input.mjs +349 -0
- package/tests/test-inspect.mjs +302 -0
- package/tests/test-landscape.mjs +316 -0
- package/tests/test-lighting.mjs +428 -0
- package/tests/test-manage-asset.mjs +438 -0
- package/tests/test-manage-level.mjs +89 -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-performance.mjs +539 -0
- package/tests/test-plugin-handshake.mjs +82 -0
- package/tests/test-runner.mjs +933 -0
- package/tests/test-sequence.mjs +104 -0
- package/tests/test-system.mjs +96 -0
- package/tests/test-wasm.mjs +283 -0
- package/tests/test-world-partition.mjs +215 -0
- package/tsconfig.json +3 -3
- package/vitest.config.ts +35 -0
- 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/prompts/index.d.ts +0 -21
- package/dist/prompts/index.js +0 -217
- 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/prompts/index.ts +0 -249
- 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,625 @@
|
|
|
1
|
+
#include "McpAutomationBridgeGlobals.h"
|
|
2
|
+
#include "McpAutomationBridgeHelpers.h"
|
|
3
|
+
#include "McpAutomationBridgeSubsystem.h"
|
|
4
|
+
|
|
5
|
+
#if WITH_EDITOR
|
|
6
|
+
#include "AssetRegistry/AssetRegistryModule.h"
|
|
7
|
+
#include "AssetToolsModule.h"
|
|
8
|
+
#include "Async/Async.h"
|
|
9
|
+
#include "EditorAssetLibrary.h"
|
|
10
|
+
#include "Engine/World.h"
|
|
11
|
+
#include "Modules/ModuleManager.h"
|
|
12
|
+
#include "NiagaraActor.h"
|
|
13
|
+
#include "NiagaraComponent.h"
|
|
14
|
+
#include "NiagaraEmitter.h"
|
|
15
|
+
#include "NiagaraEmitterFactoryNew.h"
|
|
16
|
+
#include "NiagaraParameterCollection.h"
|
|
17
|
+
#include "NiagaraScriptFactoryNew.h"
|
|
18
|
+
#include "NiagaraSystem.h"
|
|
19
|
+
#include "NiagaraSystemFactoryNew.h"
|
|
20
|
+
#if __has_include("Subsystems/EditorActorSubsystem.h")
|
|
21
|
+
#include "Subsystems/EditorActorSubsystem.h"
|
|
22
|
+
#elif __has_include("EditorActorSubsystem.h")
|
|
23
|
+
#include "EditorActorSubsystem.h"
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#if WITH_EDITOR
|
|
28
|
+
#include "AssetRegistry/AssetRegistryModule.h"
|
|
29
|
+
#include "AssetToolsModule.h"
|
|
30
|
+
#include "Async/Async.h"
|
|
31
|
+
#include "EditorAssetLibrary.h"
|
|
32
|
+
#include "Engine/World.h"
|
|
33
|
+
#include "Modules/ModuleManager.h"
|
|
34
|
+
#include "NiagaraActor.h"
|
|
35
|
+
#include "NiagaraComponent.h"
|
|
36
|
+
#include "NiagaraEmitter.h"
|
|
37
|
+
#include "NiagaraEmitterFactoryNew.h"
|
|
38
|
+
#include "NiagaraParameterCollection.h"
|
|
39
|
+
#include "NiagaraScriptFactoryNew.h"
|
|
40
|
+
#include "NiagaraSystem.h"
|
|
41
|
+
#include "NiagaraSystemFactoryNew.h"
|
|
42
|
+
#if __has_include("Subsystems/EditorActorSubsystem.h")
|
|
43
|
+
#include "Subsystems/EditorActorSubsystem.h"
|
|
44
|
+
#elif __has_include("EditorActorSubsystem.h")
|
|
45
|
+
#include "EditorActorSubsystem.h"
|
|
46
|
+
#endif
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
bool UMcpAutomationBridgeSubsystem::HandleCreateNiagaraSystem(
|
|
50
|
+
const FString &RequestId, const FString &Action,
|
|
51
|
+
const TSharedPtr<FJsonObject> &Payload,
|
|
52
|
+
TSharedPtr<FMcpBridgeWebSocket> RequestingSocket) {
|
|
53
|
+
const FString Lower = Action.ToLower();
|
|
54
|
+
if (!Lower.Equals(TEXT("create_niagara_system"), ESearchCase::IgnoreCase)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#if WITH_EDITOR
|
|
59
|
+
if (!Payload.IsValid()) {
|
|
60
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
61
|
+
TEXT("create_niagara_system payload missing"),
|
|
62
|
+
TEXT("INVALID_PAYLOAD"));
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
FString SystemName;
|
|
67
|
+
if (!Payload->TryGetStringField(TEXT("name"), SystemName) ||
|
|
68
|
+
SystemName.IsEmpty()) {
|
|
69
|
+
SendAutomationError(RequestingSocket, RequestId, TEXT("name required"),
|
|
70
|
+
TEXT("INVALID_ARGUMENT"));
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
FString SavePath;
|
|
75
|
+
if (!Payload->TryGetStringField(TEXT("savePath"), SavePath) ||
|
|
76
|
+
SavePath.IsEmpty()) {
|
|
77
|
+
SendAutomationError(RequestingSocket, RequestId, TEXT("savePath required"),
|
|
78
|
+
TEXT("INVALID_ARGUMENT"));
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Check for Niagara plugin availability via module system
|
|
83
|
+
// Previous check for asset existence failed even when Niagara was enabled
|
|
84
|
+
// because it was looking for engine content which requires "Show Engine
|
|
85
|
+
// Content" in Content Browser
|
|
86
|
+
if (!FModuleManager::Get().IsModuleLoaded(TEXT("Niagara"))) {
|
|
87
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
88
|
+
TEXT("Niagara plugin module is not loaded. Please "
|
|
89
|
+
"enable and restart the editor."),
|
|
90
|
+
TEXT("DEPENDENCY_MISSING"));
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
UNiagaraSystemFactoryNew *Factory = NewObject<UNiagaraSystemFactoryNew>();
|
|
95
|
+
if (!Factory) {
|
|
96
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
97
|
+
TEXT("Failed to create Niagara system factory"),
|
|
98
|
+
TEXT("FACTORY_FAILED"));
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
FString PackagePath = SavePath;
|
|
103
|
+
FString AssetName = SystemName;
|
|
104
|
+
FAssetToolsModule &AssetToolsModule =
|
|
105
|
+
FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
|
|
106
|
+
UObject *NewAsset = AssetToolsModule.Get().CreateAsset(
|
|
107
|
+
AssetName, PackagePath, UNiagaraSystem::StaticClass(), Factory);
|
|
108
|
+
UNiagaraSystem *NiagaraSystem = Cast<UNiagaraSystem>(NewAsset);
|
|
109
|
+
|
|
110
|
+
if (!NiagaraSystem) {
|
|
111
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
112
|
+
TEXT("Failed to create Niagara system asset"),
|
|
113
|
+
TEXT("ASSET_CREATION_FAILED"));
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
UEditorAssetLibrary::SaveAsset(NiagaraSystem->GetPathName());
|
|
118
|
+
|
|
119
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
120
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
121
|
+
Resp->SetStringField(TEXT("systemPath"), NiagaraSystem->GetPathName());
|
|
122
|
+
Resp->SetStringField(TEXT("systemName"), SystemName);
|
|
123
|
+
|
|
124
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
125
|
+
TEXT("Niagara system created successfully"), Resp,
|
|
126
|
+
FString());
|
|
127
|
+
return true;
|
|
128
|
+
#else
|
|
129
|
+
SendAutomationResponse(RequestingSocket, RequestId, false,
|
|
130
|
+
TEXT("create_niagara_system requires editor build"),
|
|
131
|
+
nullptr, TEXT("NOT_IMPLEMENTED"));
|
|
132
|
+
return true;
|
|
133
|
+
#endif
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
bool UMcpAutomationBridgeSubsystem::HandleCreateNiagaraEmitter(
|
|
137
|
+
const FString &RequestId, const FString &Action,
|
|
138
|
+
const TSharedPtr<FJsonObject> &Payload,
|
|
139
|
+
TSharedPtr<FMcpBridgeWebSocket> RequestingSocket) {
|
|
140
|
+
const FString Lower = Action.ToLower();
|
|
141
|
+
if (!Lower.Equals(TEXT("create_niagara_emitter"), ESearchCase::IgnoreCase)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
#if WITH_EDITOR
|
|
146
|
+
if (!Payload.IsValid()) {
|
|
147
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
148
|
+
TEXT("create_niagara_emitter payload missing"),
|
|
149
|
+
TEXT("INVALID_PAYLOAD"));
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
FString EmitterName;
|
|
154
|
+
if (!Payload->TryGetStringField(TEXT("name"), EmitterName) ||
|
|
155
|
+
EmitterName.IsEmpty()) {
|
|
156
|
+
SendAutomationError(RequestingSocket, RequestId, TEXT("name required"),
|
|
157
|
+
TEXT("INVALID_ARGUMENT"));
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
FString SavePath;
|
|
162
|
+
if (!Payload->TryGetStringField(TEXT("savePath"), SavePath) ||
|
|
163
|
+
SavePath.IsEmpty()) {
|
|
164
|
+
SendAutomationError(RequestingSocket, RequestId, TEXT("savePath required"),
|
|
165
|
+
TEXT("INVALID_ARGUMENT"));
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Check for Niagara plugin availability via module system
|
|
170
|
+
if (!FModuleManager::Get().IsModuleLoaded(TEXT("Niagara"))) {
|
|
171
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
172
|
+
TEXT("Niagara plugin module is not loaded. Please "
|
|
173
|
+
"enable and restart the editor."),
|
|
174
|
+
TEXT("DEPENDENCY_MISSING"));
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
UNiagaraEmitterFactoryNew *Factory = NewObject<UNiagaraEmitterFactoryNew>();
|
|
179
|
+
if (!Factory) {
|
|
180
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
181
|
+
TEXT("Failed to create Niagara emitter factory"),
|
|
182
|
+
TEXT("FACTORY_FAILED"));
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
FString PackagePath = SavePath;
|
|
187
|
+
FString AssetName = EmitterName;
|
|
188
|
+
FAssetToolsModule &AssetToolsModule =
|
|
189
|
+
FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
|
|
190
|
+
UObject *NewAsset = AssetToolsModule.Get().CreateAsset(
|
|
191
|
+
AssetName, PackagePath, UNiagaraEmitter::StaticClass(), Factory);
|
|
192
|
+
UNiagaraEmitter *NiagaraEmitter = Cast<UNiagaraEmitter>(NewAsset);
|
|
193
|
+
|
|
194
|
+
if (!NiagaraEmitter) {
|
|
195
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
196
|
+
TEXT("Failed to create Niagara emitter asset"),
|
|
197
|
+
TEXT("ASSET_CREATION_FAILED"));
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
UEditorAssetLibrary::SaveAsset(NiagaraEmitter->GetPathName());
|
|
202
|
+
|
|
203
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
204
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
205
|
+
Resp->SetStringField(TEXT("emitterPath"), NiagaraEmitter->GetPathName());
|
|
206
|
+
Resp->SetStringField(TEXT("emitterName"), EmitterName);
|
|
207
|
+
|
|
208
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
209
|
+
TEXT("Niagara emitter created successfully"), Resp,
|
|
210
|
+
FString());
|
|
211
|
+
return true;
|
|
212
|
+
#else
|
|
213
|
+
SendAutomationResponse(RequestingSocket, RequestId, false,
|
|
214
|
+
TEXT("create_niagara_emitter requires editor build"),
|
|
215
|
+
nullptr, TEXT("NOT_IMPLEMENTED"));
|
|
216
|
+
return true;
|
|
217
|
+
#endif
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
bool UMcpAutomationBridgeSubsystem::HandleSpawnNiagaraActor(
|
|
221
|
+
const FString &RequestId, const FString &Action,
|
|
222
|
+
const TSharedPtr<FJsonObject> &Payload,
|
|
223
|
+
TSharedPtr<FMcpBridgeWebSocket> RequestingSocket) {
|
|
224
|
+
const FString Lower = Action.ToLower();
|
|
225
|
+
if (!Lower.Equals(TEXT("spawn_niagara_actor"), ESearchCase::IgnoreCase)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
#if WITH_EDITOR
|
|
230
|
+
if (!Payload.IsValid()) {
|
|
231
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
232
|
+
TEXT("spawn_niagara_actor payload missing"),
|
|
233
|
+
TEXT("INVALID_PAYLOAD"));
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
FString SystemPath;
|
|
238
|
+
if (!Payload->TryGetStringField(TEXT("systemPath"), SystemPath) ||
|
|
239
|
+
SystemPath.IsEmpty()) {
|
|
240
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
241
|
+
TEXT("systemPath required"), TEXT("INVALID_ARGUMENT"));
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
double X = 0.0, Y = 0.0, Z = 0.0;
|
|
246
|
+
const TSharedPtr<FJsonObject> *LocationObj = nullptr;
|
|
247
|
+
if (Payload->TryGetObjectField(TEXT("location"), LocationObj) &&
|
|
248
|
+
LocationObj) {
|
|
249
|
+
(*LocationObj)->TryGetNumberField(TEXT("x"), X);
|
|
250
|
+
(*LocationObj)->TryGetNumberField(TEXT("y"), Y);
|
|
251
|
+
(*LocationObj)->TryGetNumberField(TEXT("z"), Z);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
FString ActorName;
|
|
255
|
+
Payload->TryGetStringField(TEXT("name"), ActorName);
|
|
256
|
+
|
|
257
|
+
if (!GEditor || !GEditor->GetEditorWorldContext().World()) {
|
|
258
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
259
|
+
TEXT("Editor world not available"),
|
|
260
|
+
TEXT("EDITOR_NOT_AVAILABLE"));
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
UWorld *World = GEditor->GetEditorWorldContext().World();
|
|
265
|
+
|
|
266
|
+
if (!UEditorAssetLibrary::DoesAssetExist(SystemPath)) {
|
|
267
|
+
SendAutomationResponse(
|
|
268
|
+
RequestingSocket, RequestId, false,
|
|
269
|
+
FString::Printf(TEXT("Niagara system asset not found: %s"),
|
|
270
|
+
*SystemPath),
|
|
271
|
+
nullptr, TEXT("ASSET_NOT_FOUND"));
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
UNiagaraSystem *NiagaraSystem =
|
|
276
|
+
LoadObject<UNiagaraSystem>(nullptr, *SystemPath);
|
|
277
|
+
if (!NiagaraSystem) {
|
|
278
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
279
|
+
TEXT("Failed to load Niagara system"),
|
|
280
|
+
TEXT("LOAD_FAILED"));
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
FVector Location(X, Y, Z);
|
|
285
|
+
ANiagaraActor *NiagaraActor = World->SpawnActor<ANiagaraActor>(
|
|
286
|
+
ANiagaraActor::StaticClass(), Location, FRotator::ZeroRotator);
|
|
287
|
+
|
|
288
|
+
if (!NiagaraActor) {
|
|
289
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
290
|
+
TEXT("Failed to spawn Niagara actor"),
|
|
291
|
+
TEXT("SPAWN_FAILED"));
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (NiagaraActor->GetNiagaraComponent()) {
|
|
296
|
+
NiagaraActor->GetNiagaraComponent()->SetAsset(NiagaraSystem);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (!ActorName.IsEmpty()) {
|
|
300
|
+
NiagaraActor->SetActorLabel(ActorName);
|
|
301
|
+
} else {
|
|
302
|
+
NiagaraActor->SetActorLabel(
|
|
303
|
+
FString::Printf(TEXT("NiagaraActor_%s"),
|
|
304
|
+
*FGuid::NewGuid().ToString(EGuidFormats::Short)));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
308
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
309
|
+
Resp->SetStringField(TEXT("actorPath"), NiagaraActor->GetPathName());
|
|
310
|
+
Resp->SetStringField(TEXT("actorName"), NiagaraActor->GetActorLabel());
|
|
311
|
+
Resp->SetStringField(TEXT("systemPath"), SystemPath);
|
|
312
|
+
|
|
313
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
314
|
+
TEXT("Niagara actor spawned successfully"), Resp,
|
|
315
|
+
FString());
|
|
316
|
+
return true;
|
|
317
|
+
#else
|
|
318
|
+
SendAutomationResponse(RequestingSocket, RequestId, false,
|
|
319
|
+
TEXT("spawn_niagara_actor requires editor build"),
|
|
320
|
+
nullptr, TEXT("NOT_IMPLEMENTED"));
|
|
321
|
+
return true;
|
|
322
|
+
#endif
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
bool UMcpAutomationBridgeSubsystem::HandleModifyNiagaraParameter(
|
|
326
|
+
const FString &RequestId, const FString &Action,
|
|
327
|
+
const TSharedPtr<FJsonObject> &Payload,
|
|
328
|
+
TSharedPtr<FMcpBridgeWebSocket> RequestingSocket) {
|
|
329
|
+
const FString Lower = Action.ToLower();
|
|
330
|
+
if (!Lower.Equals(TEXT("modify_niagara_parameter"),
|
|
331
|
+
ESearchCase::IgnoreCase)) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
#if WITH_EDITOR
|
|
336
|
+
if (!Payload.IsValid()) {
|
|
337
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
338
|
+
TEXT("modify_niagara_parameter payload missing"),
|
|
339
|
+
TEXT("INVALID_PAYLOAD"));
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
FString ActorName;
|
|
344
|
+
if (!Payload->TryGetStringField(TEXT("actorName"), ActorName) ||
|
|
345
|
+
ActorName.IsEmpty()) {
|
|
346
|
+
SendAutomationError(RequestingSocket, RequestId, TEXT("actorName required"),
|
|
347
|
+
TEXT("INVALID_ARGUMENT"));
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
FString ParameterName;
|
|
352
|
+
if (!Payload->TryGetStringField(TEXT("parameterName"), ParameterName) ||
|
|
353
|
+
ParameterName.IsEmpty()) {
|
|
354
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
355
|
+
TEXT("parameterName required"),
|
|
356
|
+
TEXT("INVALID_ARGUMENT"));
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
FString ParameterType;
|
|
361
|
+
if (!Payload->TryGetStringField(TEXT("parameterType"), ParameterType)) {
|
|
362
|
+
Payload->TryGetStringField(TEXT("type"), ParameterType);
|
|
363
|
+
}
|
|
364
|
+
if (ParameterType.IsEmpty())
|
|
365
|
+
ParameterType = TEXT("Float");
|
|
366
|
+
|
|
367
|
+
if (!GEditor || !GEditor->GetEditorWorldContext().World()) {
|
|
368
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
369
|
+
TEXT("Editor world not available"),
|
|
370
|
+
TEXT("EDITOR_NOT_AVAILABLE"));
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
UEditorActorSubsystem *ActorSS =
|
|
375
|
+
GEditor->GetEditorSubsystem<UEditorActorSubsystem>();
|
|
376
|
+
if (!ActorSS) {
|
|
377
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
378
|
+
TEXT("EditorActorSubsystem not available"),
|
|
379
|
+
TEXT("EDITOR_ACTOR_SUBSYSTEM_MISSING"));
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
TArray<AActor *> AllActors = ActorSS->GetAllLevelActors();
|
|
384
|
+
ANiagaraActor *NiagaraActor = nullptr;
|
|
385
|
+
|
|
386
|
+
for (AActor *Actor : AllActors) {
|
|
387
|
+
if (Actor &&
|
|
388
|
+
Actor->GetActorLabel().Equals(ActorName, ESearchCase::IgnoreCase)) {
|
|
389
|
+
NiagaraActor = Cast<ANiagaraActor>(Actor);
|
|
390
|
+
if (NiagaraActor)
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (!NiagaraActor || !NiagaraActor->GetNiagaraComponent()) {
|
|
396
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
397
|
+
TEXT("Niagara actor not found"),
|
|
398
|
+
TEXT("ACTOR_NOT_FOUND"));
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
UNiagaraComponent *NiagaraComp = NiagaraActor->GetNiagaraComponent();
|
|
403
|
+
bool bSuccess = false;
|
|
404
|
+
|
|
405
|
+
if (ParameterType.Equals(TEXT("Float"), ESearchCase::IgnoreCase)) {
|
|
406
|
+
double Value = 0.0;
|
|
407
|
+
if (Payload->TryGetNumberField(TEXT("value"), Value)) {
|
|
408
|
+
NiagaraComp->SetFloatParameter(FName(*ParameterName),
|
|
409
|
+
static_cast<float>(Value));
|
|
410
|
+
bSuccess = true;
|
|
411
|
+
}
|
|
412
|
+
} else if (ParameterType.Equals(TEXT("Vector"), ESearchCase::IgnoreCase)) {
|
|
413
|
+
const TSharedPtr<FJsonObject> *VectorObj = nullptr;
|
|
414
|
+
const TArray<TSharedPtr<FJsonValue>> *VectorArr = nullptr;
|
|
415
|
+
|
|
416
|
+
if (Payload->TryGetObjectField(TEXT("value"), VectorObj) && VectorObj) {
|
|
417
|
+
double VX = 0.0, VY = 0.0, VZ = 0.0;
|
|
418
|
+
(*VectorObj)->TryGetNumberField(TEXT("x"), VX);
|
|
419
|
+
(*VectorObj)->TryGetNumberField(TEXT("y"), VY);
|
|
420
|
+
(*VectorObj)->TryGetNumberField(TEXT("z"), VZ);
|
|
421
|
+
NiagaraComp->SetVectorParameter(FName(*ParameterName),
|
|
422
|
+
FVector(VX, VY, VZ));
|
|
423
|
+
bSuccess = true;
|
|
424
|
+
} else if (Payload->TryGetArrayField(TEXT("value"), VectorArr) &&
|
|
425
|
+
VectorArr && VectorArr->Num() >= 3) {
|
|
426
|
+
double VX = (*VectorArr)[0]->AsNumber();
|
|
427
|
+
double VY = (*VectorArr)[1]->AsNumber();
|
|
428
|
+
double VZ = (*VectorArr)[2]->AsNumber();
|
|
429
|
+
NiagaraComp->SetVectorParameter(FName(*ParameterName),
|
|
430
|
+
FVector(VX, VY, VZ));
|
|
431
|
+
bSuccess = true;
|
|
432
|
+
}
|
|
433
|
+
} else if (ParameterType.Equals(TEXT("Color"), ESearchCase::IgnoreCase)) {
|
|
434
|
+
const TSharedPtr<FJsonObject> *ColorObj = nullptr;
|
|
435
|
+
const TArray<TSharedPtr<FJsonValue>> *ColorArr = nullptr;
|
|
436
|
+
|
|
437
|
+
if (Payload->TryGetObjectField(TEXT("value"), ColorObj) && ColorObj) {
|
|
438
|
+
double R = 0.0, G = 0.0, B = 0.0, A = 1.0;
|
|
439
|
+
(*ColorObj)->TryGetNumberField(TEXT("r"), R);
|
|
440
|
+
(*ColorObj)->TryGetNumberField(TEXT("g"), G);
|
|
441
|
+
(*ColorObj)->TryGetNumberField(TEXT("b"), B);
|
|
442
|
+
(*ColorObj)->TryGetNumberField(TEXT("a"), A);
|
|
443
|
+
NiagaraComp->SetColorParameter(FName(*ParameterName),
|
|
444
|
+
FLinearColor(R, G, B, A));
|
|
445
|
+
bSuccess = true;
|
|
446
|
+
} else if (Payload->TryGetArrayField(TEXT("value"), ColorArr) && ColorArr &&
|
|
447
|
+
ColorArr->Num() >= 3) {
|
|
448
|
+
double R = (*ColorArr)[0]->AsNumber();
|
|
449
|
+
double G = (*ColorArr)[1]->AsNumber();
|
|
450
|
+
double B = (*ColorArr)[2]->AsNumber();
|
|
451
|
+
double A = (ColorArr->Num() > 3) ? (*ColorArr)[3]->AsNumber() : 1.0;
|
|
452
|
+
NiagaraComp->SetColorParameter(FName(*ParameterName),
|
|
453
|
+
FLinearColor(R, G, B, A));
|
|
454
|
+
bSuccess = true;
|
|
455
|
+
}
|
|
456
|
+
} else if (ParameterType.Equals(TEXT("Bool"), ESearchCase::IgnoreCase)) {
|
|
457
|
+
bool Value = false;
|
|
458
|
+
if (Payload->TryGetBoolField(TEXT("value"), Value)) {
|
|
459
|
+
NiagaraComp->SetBoolParameter(FName(*ParameterName), Value);
|
|
460
|
+
bSuccess = true;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
465
|
+
Resp->SetBoolField(TEXT("success"), bSuccess);
|
|
466
|
+
Resp->SetStringField(TEXT("actorName"), ActorName);
|
|
467
|
+
Resp->SetStringField(TEXT("parameterName"), ParameterName);
|
|
468
|
+
Resp->SetStringField(TEXT("parameterType"), ParameterType);
|
|
469
|
+
|
|
470
|
+
SendAutomationResponse(
|
|
471
|
+
RequestingSocket, RequestId, bSuccess,
|
|
472
|
+
bSuccess ? TEXT("Niagara parameter modified successfully")
|
|
473
|
+
: TEXT("Failed to modify parameter"),
|
|
474
|
+
Resp, bSuccess ? FString() : TEXT("PARAMETER_SET_FAILED"));
|
|
475
|
+
return true;
|
|
476
|
+
#else
|
|
477
|
+
SendAutomationResponse(RequestingSocket, RequestId, false,
|
|
478
|
+
TEXT("modify_niagara_parameter requires editor build"),
|
|
479
|
+
nullptr, TEXT("NOT_IMPLEMENTED"));
|
|
480
|
+
return true;
|
|
481
|
+
#endif
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
bool UMcpAutomationBridgeSubsystem::HandleCreateNiagaraRibbon(
|
|
485
|
+
const FString &RequestId, const FString &Action,
|
|
486
|
+
const TSharedPtr<FJsonObject> &Payload,
|
|
487
|
+
TSharedPtr<FMcpBridgeWebSocket> RequestingSocket) {
|
|
488
|
+
const FString Lower = Action.ToLower();
|
|
489
|
+
if (!Lower.Equals(TEXT("create_niagara_ribbon"), ESearchCase::IgnoreCase)) {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
#if WITH_EDITOR
|
|
494
|
+
if (!Payload.IsValid()) {
|
|
495
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
496
|
+
TEXT("create_niagara_ribbon payload missing"),
|
|
497
|
+
TEXT("INVALID_PAYLOAD"));
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
FString SystemPath;
|
|
502
|
+
if (!Payload->TryGetStringField(TEXT("systemPath"), SystemPath) ||
|
|
503
|
+
SystemPath.IsEmpty()) {
|
|
504
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
505
|
+
TEXT("systemPath required"), TEXT("INVALID_ARGUMENT"));
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
FString Name;
|
|
510
|
+
Payload->TryGetStringField(TEXT("name"), Name);
|
|
511
|
+
|
|
512
|
+
if (!GEditor || !GEditor->GetEditorWorldContext().World()) {
|
|
513
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
514
|
+
TEXT("Editor world not available"),
|
|
515
|
+
TEXT("EDITOR_NOT_AVAILABLE"));
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
UWorld *World = GEditor->GetEditorWorldContext().World();
|
|
520
|
+
|
|
521
|
+
if (!UEditorAssetLibrary::DoesAssetExist(SystemPath)) {
|
|
522
|
+
SendAutomationResponse(
|
|
523
|
+
RequestingSocket, RequestId, false,
|
|
524
|
+
FString::Printf(TEXT("Niagara system asset not found: %s"),
|
|
525
|
+
*SystemPath),
|
|
526
|
+
nullptr, TEXT("ASSET_NOT_FOUND"));
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
UNiagaraSystem *NiagaraSystem =
|
|
531
|
+
LoadObject<UNiagaraSystem>(nullptr, *SystemPath);
|
|
532
|
+
if (!NiagaraSystem) {
|
|
533
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
534
|
+
TEXT("Failed to load Niagara system"),
|
|
535
|
+
TEXT("LOAD_FAILED"));
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
FVector Start(0, 0, 0);
|
|
540
|
+
const TSharedPtr<FJsonObject> *StartObj = nullptr;
|
|
541
|
+
if (Payload->TryGetObjectField(TEXT("start"), StartObj) && StartObj) {
|
|
542
|
+
double X = 0, Y = 0, Z = 0;
|
|
543
|
+
(*StartObj)->TryGetNumberField(TEXT("x"), X);
|
|
544
|
+
(*StartObj)->TryGetNumberField(TEXT("y"), Y);
|
|
545
|
+
(*StartObj)->TryGetNumberField(TEXT("z"), Z);
|
|
546
|
+
Start = FVector(X, Y, Z);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
ANiagaraActor *NiagaraActor = World->SpawnActor<ANiagaraActor>(
|
|
550
|
+
ANiagaraActor::StaticClass(), Start, FRotator::ZeroRotator);
|
|
551
|
+
|
|
552
|
+
if (!NiagaraActor) {
|
|
553
|
+
SendAutomationError(RequestingSocket, RequestId,
|
|
554
|
+
TEXT("Failed to spawn Niagara actor"),
|
|
555
|
+
TEXT("SPAWN_FAILED"));
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
NiagaraActor->SetActorLabel(Name.IsEmpty() ? TEXT("NiagaraRibbon") : Name);
|
|
560
|
+
|
|
561
|
+
UNiagaraComponent *NiagaraComp = NiagaraActor->GetNiagaraComponent();
|
|
562
|
+
if (NiagaraComp) {
|
|
563
|
+
NiagaraComp->SetAsset(NiagaraSystem);
|
|
564
|
+
|
|
565
|
+
// Set Parameters
|
|
566
|
+
NiagaraComp->SetVectorParameter(FName("User.RibbonStart"), Start);
|
|
567
|
+
|
|
568
|
+
const TSharedPtr<FJsonObject> *EndObj = nullptr;
|
|
569
|
+
if (Payload->TryGetObjectField(TEXT("end"), EndObj) && EndObj) {
|
|
570
|
+
double X = 0, Y = 0, Z = 0;
|
|
571
|
+
(*EndObj)->TryGetNumberField(TEXT("x"), X);
|
|
572
|
+
(*EndObj)->TryGetNumberField(TEXT("y"), Y);
|
|
573
|
+
(*EndObj)->TryGetNumberField(TEXT("z"), Z);
|
|
574
|
+
// Often needed to ensure the beam has an endpoint
|
|
575
|
+
NiagaraComp->SetVectorParameter(FName("User.RibbonEnd"),
|
|
576
|
+
FVector(X, Y, Z));
|
|
577
|
+
NiagaraComp->SetVectorParameter(FName("User.BeamEnd"), FVector(X, Y, Z));
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
double Width = 10.0;
|
|
581
|
+
if (Payload->TryGetNumberField(TEXT("width"), Width)) {
|
|
582
|
+
NiagaraComp->SetFloatParameter(FName("User.RibbonWidth"), (float)Width);
|
|
583
|
+
NiagaraComp->SetFloatParameter(FName("User.BeamWidth"), (float)Width);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const TSharedPtr<FJsonObject> *ColorObj = nullptr;
|
|
587
|
+
FLinearColor ColorVal(1, 1, 1, 1);
|
|
588
|
+
if (Payload->TryGetObjectField(TEXT("color"), ColorObj) && ColorObj) {
|
|
589
|
+
double R = 1, G = 1, B = 1, A = 1;
|
|
590
|
+
(*ColorObj)->TryGetNumberField(TEXT("r"), R);
|
|
591
|
+
(*ColorObj)->TryGetNumberField(TEXT("g"), G);
|
|
592
|
+
(*ColorObj)->TryGetNumberField(TEXT("b"), B);
|
|
593
|
+
(*ColorObj)->TryGetNumberField(TEXT("a"), A);
|
|
594
|
+
ColorVal = FLinearColor(R, G, B, A);
|
|
595
|
+
} else {
|
|
596
|
+
const TArray<TSharedPtr<FJsonValue>> *ColorArr = nullptr;
|
|
597
|
+
if (Payload->TryGetArrayField(TEXT("color"), ColorArr) && ColorArr &&
|
|
598
|
+
ColorArr->Num() >= 3) {
|
|
599
|
+
double R = (*ColorArr)[0]->AsNumber();
|
|
600
|
+
double G = (*ColorArr)[1]->AsNumber();
|
|
601
|
+
double B = (*ColorArr)[2]->AsNumber();
|
|
602
|
+
double A = (ColorArr->Num() > 3) ? (*ColorArr)[3]->AsNumber() : 1.0;
|
|
603
|
+
ColorVal = FLinearColor(R, G, B, A);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
NiagaraComp->SetColorParameter(FName("User.RibbonColor"), ColorVal);
|
|
607
|
+
NiagaraComp->SetColorParameter(FName("User.Color"), ColorVal);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
TSharedPtr<FJsonObject> Resp = MakeShared<FJsonObject>();
|
|
611
|
+
Resp->SetBoolField(TEXT("success"), true);
|
|
612
|
+
Resp->SetStringField(TEXT("actorPath"), NiagaraActor->GetPathName());
|
|
613
|
+
Resp->SetStringField(TEXT("actorName"), NiagaraActor->GetActorLabel());
|
|
614
|
+
|
|
615
|
+
SendAutomationResponse(RequestingSocket, RequestId, true,
|
|
616
|
+
TEXT("Niagara ribbon created successfully"), Resp,
|
|
617
|
+
FString());
|
|
618
|
+
return true;
|
|
619
|
+
#else
|
|
620
|
+
SendAutomationResponse(RequestingSocket, RequestId, false,
|
|
621
|
+
TEXT("create_niagara_ribbon requires editor build"),
|
|
622
|
+
nullptr, TEXT("NOT_IMPLEMENTED"));
|
|
623
|
+
return true;
|
|
624
|
+
#endif
|
|
625
|
+
}
|