ue-mcp 1.4.12 → 1.4.13
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/README.md +4 -5
- package/dist/bridge/bridge-timeouts.js +16 -0
- package/dist/bridge/bridge-timeouts.js.map +1 -1
- package/dist/bridge/bridge.d.ts +58 -3
- package/dist/bridge/bridge.js +149 -8
- package/dist/bridge/bridge.js.map +1 -1
- package/dist/cli/cli-commands.js +7 -1
- package/dist/cli/cli-commands.js.map +1 -1
- package/dist/cli/doctor.d.ts +9 -0
- package/dist/cli/doctor.js +63 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/editor-flag.js +5 -1
- package/dist/cli/editor-flag.js.map +1 -1
- package/dist/cli/extension-cli.d.ts +3 -0
- package/dist/cli/extension-cli.js +83 -16
- package/dist/cli/extension-cli.js.map +1 -1
- package/dist/cli/flow-cli.js +3 -1
- package/dist/cli/flow-cli.js.map +1 -1
- package/dist/cli/init-core.d.ts +74 -1
- package/dist/cli/init-core.js +231 -38
- package/dist/cli/init-core.js.map +1 -1
- package/dist/cli/init.js +86 -22
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/login-cli.d.ts +27 -1
- package/dist/cli/login-cli.js +130 -17
- package/dist/cli/login-cli.js.map +1 -1
- package/dist/cli/plugin-cli.js +1 -1
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/tools-cli.d.ts +14 -0
- package/dist/cli/tools-cli.js +270 -0
- package/dist/cli/tools-cli.js.map +1 -0
- package/dist/cli/ui/ansi.d.ts +2 -0
- package/dist/cli/ui/ansi.js +8 -0
- package/dist/cli/ui/ansi.js.map +1 -1
- package/dist/codeintel/config-hierarchy.d.ts +73 -0
- package/dist/codeintel/config-hierarchy.js +165 -0
- package/dist/codeintel/config-hierarchy.js.map +1 -0
- package/dist/config/project.d.ts +12 -4
- package/dist/config/project.js.map +1 -1
- package/dist/core/archive.d.ts +8 -0
- package/dist/core/archive.js +40 -0
- package/dist/core/archive.js.map +1 -0
- package/dist/core/env.d.ts +4 -0
- package/dist/core/env.js +4 -0
- package/dist/core/env.js.map +1 -1
- package/dist/core/errors.d.ts +9 -1
- package/dist/core/errors.js +8 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/png.d.ts +31 -0
- package/dist/core/png.js +308 -0
- package/dist/core/png.js.map +1 -0
- package/dist/core/types.d.ts +31 -0
- package/dist/daemon/daemon.js +16 -2
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/extension-install.d.ts +14 -0
- package/dist/daemon/extension-install.js +25 -29
- package/dist/daemon/extension-install.js.map +1 -1
- package/dist/daemon/install-names.d.ts +10 -0
- package/dist/daemon/install-names.js +39 -0
- package/dist/daemon/install-names.js.map +1 -0
- package/dist/daemon/tools-routes.d.ts +23 -0
- package/dist/daemon/tools-routes.js +46 -0
- package/dist/daemon/tools-routes.js.map +1 -0
- package/dist/diagram/action.d.ts +25 -0
- package/dist/diagram/action.js +141 -0
- package/dist/diagram/action.js.map +1 -0
- package/dist/diagram/adapters.d.ts +48 -0
- package/dist/diagram/adapters.js +569 -0
- package/dist/diagram/adapters.js.map +1 -0
- package/dist/diagram/mermaid.d.ts +22 -0
- package/dist/diagram/mermaid.js +164 -0
- package/dist/diagram/mermaid.js.map +1 -0
- package/dist/diagram/model.d.ts +59 -0
- package/dist/diagram/model.js +17 -0
- package/dist/diagram/model.js.map +1 -0
- package/dist/diagram/png.d.ts +17 -0
- package/dist/diagram/png.js +48 -0
- package/dist/diagram/png.js.map +1 -0
- package/dist/diagram/select.d.ts +26 -0
- package/dist/diagram/select.js +146 -0
- package/dist/diagram/select.js.map +1 -0
- package/dist/diagram/svg.d.ts +10 -0
- package/dist/diagram/svg.js +254 -0
- package/dist/diagram/svg.js.map +1 -0
- package/dist/diagram/theme.d.ts +33 -0
- package/dist/diagram/theme.js +37 -0
- package/dist/diagram/theme.js.map +1 -0
- package/dist/dispatch/call-pipeline.d.ts +8 -0
- package/dist/dispatch/call-pipeline.js +19 -2
- package/dist/dispatch/call-pipeline.js.map +1 -1
- package/dist/dispatch/inline-image.d.ts +70 -0
- package/dist/dispatch/inline-image.js +198 -0
- package/dist/dispatch/inline-image.js.map +1 -0
- package/dist/dispatch/lease-paths.d.ts +16 -0
- package/dist/dispatch/lease-paths.js +42 -0
- package/dist/dispatch/lease-paths.js.map +1 -0
- package/dist/dispatch/leases.d.ts +71 -0
- package/dist/dispatch/leases.js +191 -0
- package/dist/dispatch/leases.js.map +1 -0
- package/dist/dispatch/offline.js +17 -0
- package/dist/dispatch/offline.js.map +1 -1
- package/dist/dispatch/server-dispatch.d.ts +32 -1
- package/dist/dispatch/server-dispatch.js +70 -2
- package/dist/dispatch/server-dispatch.js.map +1 -1
- package/dist/editor/bridge-binaries.d.ts +2 -0
- package/dist/editor/bridge-binaries.js +12 -22
- package/dist/editor/bridge-binaries.js.map +1 -1
- package/dist/editor/dialog-guard.d.ts +10 -0
- package/dist/editor/dialog-guard.js +26 -4
- package/dist/editor/dialog-guard.js.map +1 -1
- package/dist/editor/editor-plugin.d.ts +16 -0
- package/dist/editor/editor-plugin.js +98 -0
- package/dist/editor/editor-plugin.js.map +1 -0
- package/dist/editor/engine-root.d.ts +2 -0
- package/dist/editor/engine-root.js +2 -2
- package/dist/editor/engine-root.js.map +1 -1
- package/dist/editor/install-marker.d.ts +2 -0
- package/dist/editor/install-marker.js +13 -6
- package/dist/editor/install-marker.js.map +1 -1
- package/dist/extensions/registry-auth.d.ts +60 -1
- package/dist/extensions/registry-auth.js +202 -5
- package/dist/extensions/registry-auth.js.map +1 -1
- package/dist/extensions/skill-catalog.d.ts +20 -0
- package/dist/extensions/skill-catalog.js +56 -0
- package/dist/extensions/skill-catalog.js.map +1 -0
- package/dist/flow/flow-tool.js +10 -2
- package/dist/flow/flow-tool.js.map +1 -1
- package/dist/flow/guarded-bridge.d.ts +6 -4
- package/dist/flow/guarded-bridge.js +11 -5
- package/dist/flow/guarded-bridge.js.map +1 -1
- package/dist/flow/loader.js +19 -0
- package/dist/flow/loader.js.map +1 -1
- package/dist/flow/run-action.js +37 -5
- package/dist/flow/run-action.js.map +1 -1
- package/dist/flow/write-methods.js +4 -0
- package/dist/flow/write-methods.js.map +1 -1
- package/dist/integrations/agent-guides.d.ts +29 -0
- package/dist/integrations/agent-guides.js +125 -0
- package/dist/integrations/agent-guides.js.map +1 -0
- package/dist/integrations/claude-code/mcp-client-config.d.ts +16 -4
- package/dist/integrations/claude-code/mcp-client-config.js +57 -10
- package/dist/integrations/claude-code/mcp-client-config.js.map +1 -1
- package/dist/integrations/claude-code/unreal-mcp-entries.d.ts +33 -0
- package/dist/integrations/claude-code/unreal-mcp-entries.js +159 -0
- package/dist/integrations/claude-code/unreal-mcp-entries.js.map +1 -0
- package/dist/integrations/epic/project-status.d.ts +25 -0
- package/dist/integrations/epic/project-status.js +35 -0
- package/dist/integrations/epic/project-status.js.map +1 -0
- package/dist/integrations/epic/toolset-settings.d.ts +28 -0
- package/dist/integrations/epic/toolset-settings.js +136 -0
- package/dist/integrations/epic/toolset-settings.js.map +1 -0
- package/dist/integrations/epic/unreal-assistant.d.ts +64 -0
- package/dist/integrations/epic/unreal-assistant.js +209 -0
- package/dist/integrations/epic/unreal-assistant.js.map +1 -0
- package/dist/integrations/epic/unreal-canvas.d.ts +48 -0
- package/dist/integrations/epic/unreal-canvas.js +126 -0
- package/dist/integrations/epic/unreal-canvas.js.map +1 -0
- package/dist/integrations/epic/unreal-mcp-server.d.ts +74 -0
- package/dist/integrations/epic/unreal-mcp-server.js +231 -0
- package/dist/integrations/epic/unreal-mcp-server.js.map +1 -0
- package/dist/server/context-projection.js +5 -3
- package/dist/server/context-projection.js.map +1 -1
- package/dist/server/editor-resources.d.ts +39 -0
- package/dist/server/editor-resources.js +94 -0
- package/dist/server/editor-resources.js.map +1 -0
- package/dist/server/mcp-server.d.ts +7 -0
- package/dist/server/mcp-server.js +49 -13
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/runtime.js +21 -1
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/skill-prompts.d.ts +16 -0
- package/dist/server/skill-prompts.js +22 -0
- package/dist/server/skill-prompts.js.map +1 -0
- package/dist/sessions/session-load.d.ts +16 -0
- package/dist/sessions/session-load.js +64 -20
- package/dist/sessions/session-load.js.map +1 -1
- package/dist/sessions/session.d.ts +9 -0
- package/dist/sessions/session.js +8 -0
- package/dist/sessions/session.js.map +1 -1
- package/dist/surface/action-signature.js +9 -0
- package/dist/surface/action-signature.js.map +1 -1
- package/dist/surface/category-state.d.ts +119 -0
- package/dist/surface/category-state.js +232 -0
- package/dist/surface/category-state.js.map +1 -0
- package/dist/surface/context/call-envelope.d.ts +7 -0
- package/dist/surface/context/call-envelope.js +11 -0
- package/dist/surface/context/call-envelope.js.map +1 -1
- package/dist/surface/context/instructions.d.ts +2 -0
- package/dist/surface/context/instructions.js +20 -10
- package/dist/surface/context/instructions.js.map +1 -1
- package/dist/surface/context/micro-context.d.ts +7 -0
- package/dist/surface/context/micro-context.js +70 -14
- package/dist/surface/context/micro-context.js.map +1 -1
- package/dist/surface/context/tool-search.js +6 -2
- package/dist/surface/context/tool-search.js.map +1 -1
- package/dist/surface/epic-engines.d.ts +24 -0
- package/dist/surface/epic-engines.js +32 -0
- package/dist/surface/epic-engines.js.map +1 -0
- package/dist/surface/epic-input.d.ts +27 -2
- package/dist/surface/epic-input.js +39 -2
- package/dist/surface/epic-input.js.map +1 -1
- package/dist/surface/epic-surface.d.ts +15 -17
- package/dist/surface/epic-surface.js +13 -57
- package/dist/surface/epic-surface.js.map +1 -1
- package/dist/surface/registered-surface.d.ts +21 -4
- package/dist/surface/registered-surface.js +67 -23
- package/dist/surface/registered-surface.js.map +1 -1
- package/dist/surface/schemas.d.ts +8 -0
- package/dist/surface/schemas.js +14 -3
- package/dist/surface/schemas.js.map +1 -1
- package/dist/tool-counts.json +38 -31
- package/dist/tools/ai-assistant-wait.d.ts +17 -0
- package/dist/tools/ai-assistant-wait.js +45 -0
- package/dist/tools/ai-assistant-wait.js.map +1 -0
- package/dist/tools/animation.js +14 -8
- package/dist/tools/animation.js.map +1 -1
- package/dist/tools/asset.js +18 -5
- package/dist/tools/asset.js.map +1 -1
- package/dist/tools/audio.js +3 -0
- package/dist/tools/audio.js.map +1 -1
- package/dist/tools/blueprint.js +7 -0
- package/dist/tools/blueprint.js.map +1 -1
- package/dist/tools/canvas-results.d.ts +32 -0
- package/dist/tools/canvas-results.js +137 -0
- package/dist/tools/canvas-results.js.map +1 -0
- package/dist/tools/canvas.d.ts +19 -0
- package/dist/tools/canvas.js +254 -0
- package/dist/tools/canvas.js.map +1 -0
- package/dist/tools/chooser.js +42 -6
- package/dist/tools/chooser.js.map +1 -1
- package/dist/tools/demo.js +2 -2
- package/dist/tools/demo.js.map +1 -1
- package/dist/tools/editor/batch.js +1 -1
- package/dist/tools/editor/batch.js.map +1 -1
- package/dist/tools/editor-csv-profile.d.ts +62 -0
- package/dist/tools/editor-csv-profile.js +266 -0
- package/dist/tools/editor-csv-profile.js.map +1 -0
- package/dist/tools/editor.js +41 -12
- package/dist/tools/editor.js.map +1 -1
- package/dist/tools/epic/animation.generated.d.ts +1 -1
- package/dist/tools/epic/animation.generated.js +5051 -695
- package/dist/tools/epic/animation.generated.js.map +1 -1
- package/dist/tools/epic/asset.generated.d.ts +1 -1
- package/dist/tools/epic/asset.generated.js +848 -156
- package/dist/tools/epic/asset.generated.js.map +1 -1
- package/dist/tools/epic/audio.generated.d.ts +6 -0
- package/dist/tools/epic/audio.generated.js +323 -0
- package/dist/tools/epic/audio.generated.js.map +1 -0
- package/dist/tools/epic/blueprint.generated.d.ts +1 -1
- package/dist/tools/epic/blueprint.generated.js +467 -118
- package/dist/tools/epic/blueprint.generated.js.map +1 -1
- package/dist/tools/epic/catalog-engines.d.ts +2 -0
- package/dist/tools/epic/catalog-engines.js +4 -0
- package/dist/tools/epic/catalog-engines.js.map +1 -0
- package/dist/tools/epic/conversation.generated.js +11 -11
- package/dist/tools/epic/conversation.generated.js.map +1 -1
- package/dist/tools/epic/dataflow.generated.d.ts +1 -1
- package/dist/tools/epic/dataflow.generated.js +349 -29
- package/dist/tools/epic/dataflow.generated.js.map +1 -1
- package/dist/tools/epic/editor.generated.d.ts +1 -1
- package/dist/tools/epic/editor.generated.js +575 -41
- package/dist/tools/epic/editor.generated.js.map +1 -1
- package/dist/tools/epic/effects.d.ts +9 -3
- package/dist/tools/epic/effects.js +3384 -33
- package/dist/tools/epic/effects.js.map +1 -1
- package/dist/tools/epic/epic.generated.d.ts +1 -1
- package/dist/tools/epic/epic.generated.js +68 -10
- package/dist/tools/epic/epic.generated.js.map +1 -1
- package/dist/tools/epic/gameplay.generated.d.ts +1 -1
- package/dist/tools/epic/gameplay.generated.js +502 -45
- package/dist/tools/epic/gameplay.generated.js.map +1 -1
- package/dist/tools/epic/gas.generated.d.ts +1 -1
- package/dist/tools/epic/gas.generated.js +29 -21
- package/dist/tools/epic/gas.generated.js.map +1 -1
- package/dist/tools/epic/index.d.ts +4 -0
- package/dist/tools/epic/index.js +4 -0
- package/dist/tools/epic/index.js.map +1 -1
- package/dist/tools/epic/level.generated.d.ts +1 -1
- package/dist/tools/epic/level.generated.js +524 -95
- package/dist/tools/epic/level.generated.js.map +1 -1
- package/dist/tools/epic/material.generated.d.ts +1 -1
- package/dist/tools/epic/material.generated.js +152 -76
- package/dist/tools/epic/material.generated.js.map +1 -1
- package/dist/tools/epic/niagara.generated.d.ts +1 -1
- package/dist/tools/epic/niagara.generated.js +124 -115
- package/dist/tools/epic/niagara.generated.js.map +1 -1
- package/dist/tools/epic/pcg.generated.d.ts +1 -1
- package/dist/tools/epic/pcg.generated.js +322 -47
- package/dist/tools/epic/pcg.generated.js.map +1 -1
- package/dist/tools/epic/plugins.generated.d.ts +1 -1
- package/dist/tools/epic/plugins.generated.js +143 -36
- package/dist/tools/epic/plugins.generated.js.map +1 -1
- package/dist/tools/epic/project.generated.d.ts +1 -1
- package/dist/tools/epic/project.generated.js +144 -31
- package/dist/tools/epic/project.generated.js.map +1 -1
- package/dist/tools/epic/reflection.generated.d.ts +1 -1
- package/dist/tools/epic/reflection.generated.js +33 -16
- package/dist/tools/epic/reflection.generated.js.map +1 -1
- package/dist/tools/epic/source_control.generated.d.ts +6 -0
- package/dist/tools/epic/source_control.generated.js +260 -0
- package/dist/tools/epic/source_control.generated.js.map +1 -0
- package/dist/tools/epic/statetree.generated.d.ts +1 -1
- package/dist/tools/epic/statetree.generated.js +292 -20
- package/dist/tools/epic/statetree.generated.js.map +1 -1
- package/dist/tools/epic/toolset-routes.d.ts +6 -0
- package/dist/tools/epic/toolset-routes.js +74 -0
- package/dist/tools/epic/toolset-routes.js.map +1 -0
- package/dist/tools/epic/widget.generated.d.ts +1 -1
- package/dist/tools/epic/widget.generated.js +797 -85
- package/dist/tools/epic/widget.generated.js.map +1 -1
- package/dist/tools/epic.js +22 -4
- package/dist/tools/epic.js.map +1 -1
- package/dist/tools/gameplay.js +10 -0
- package/dist/tools/gameplay.js.map +1 -1
- package/dist/tools/graph-diagrams.d.ts +15 -0
- package/dist/tools/graph-diagrams.js +153 -0
- package/dist/tools/graph-diagrams.js.map +1 -0
- package/dist/tools/landscape.js +12 -1
- package/dist/tools/landscape.js.map +1 -1
- package/dist/tools/level.js +35 -1
- package/dist/tools/level.js.map +1 -1
- package/dist/tools/material.js +7 -1
- package/dist/tools/material.js.map +1 -1
- package/dist/tools/networking.js +1 -0
- package/dist/tools/networking.js.map +1 -1
- package/dist/tools/pcg.js +8 -1
- package/dist/tools/pcg.js.map +1 -1
- package/dist/tools/project/categories.d.ts +74 -0
- package/dist/tools/project/categories.js +405 -0
- package/dist/tools/project/categories.js.map +1 -0
- package/dist/tools/project/config.js +93 -0
- package/dist/tools/project/config.js.map +1 -1
- package/dist/tools/project/leases.d.ts +8 -0
- package/dist/tools/project/leases.js +107 -0
- package/dist/tools/project/leases.js.map +1 -0
- package/dist/tools/project/localization.d.ts +7 -0
- package/dist/tools/project/localization.js +21 -0
- package/dist/tools/project/localization.js.map +1 -0
- package/dist/tools/project/sessions.js +29 -1
- package/dist/tools/project/sessions.js.map +1 -1
- package/dist/tools/project.js +25 -4
- package/dist/tools/project.js.map +1 -1
- package/dist/tools/source_control.js +3 -0
- package/dist/tools/source_control.js.map +1 -1
- package/dist/tools/specs/animation.generated.js +3 -3
- package/dist/tools/specs/animation.generated.js.map +1 -1
- package/dist/tools/specs/asset.generated.js +223 -12
- package/dist/tools/specs/asset.generated.js.map +1 -1
- package/dist/tools/specs/chooser.generated.js +1039 -63
- package/dist/tools/specs/chooser.generated.js.map +1 -1
- package/dist/tools/specs/demo.generated.js +11 -3
- package/dist/tools/specs/demo.generated.js.map +1 -1
- package/dist/tools/specs/editor.generated.js +444 -15
- package/dist/tools/specs/editor.generated.js.map +1 -1
- package/dist/tools/specs/epic.generated.js +215 -3
- package/dist/tools/specs/epic.generated.js.map +1 -1
- package/dist/tools/specs/gameplay.generated.js +175 -4
- package/dist/tools/specs/gameplay.generated.js.map +1 -1
- package/dist/tools/specs/landscape.generated.js +483 -7
- package/dist/tools/specs/landscape.generated.js.map +1 -1
- package/dist/tools/specs/level.generated.js +1218 -68
- package/dist/tools/specs/level.generated.js.map +1 -1
- package/dist/tools/specs/networking.generated.js +83 -0
- package/dist/tools/specs/networking.generated.js.map +1 -1
- package/dist/tools/specs/pcg.generated.js +125 -5
- package/dist/tools/specs/pcg.generated.js.map +1 -1
- package/dist/tools/specs/project.generated.js +134 -0
- package/dist/tools/specs/project.generated.js.map +1 -1
- package/dist/tools/specs/statetree.generated.js +245 -9
- package/dist/tools/specs/statetree.generated.js.map +1 -1
- package/dist/tools/specs/widget.generated.js +362 -3
- package/dist/tools/specs/widget.generated.js.map +1 -1
- package/dist/tools/statetree.js +12 -1
- package/dist/tools/statetree.js.map +1 -1
- package/dist/tools/widget.js +12 -0
- package/dist/tools/widget.js.map +1 -1
- package/dist/tools.js +2 -0
- package/dist/tools.js.map +1 -1
- package/dist/ue-mcp.default.yml +14785 -983
- package/package.json +4 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgePortConfig.cpp +56 -4
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeRequestContext.h +54 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeServer.cpp +203 -18
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeServer.h +42 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/HandlerCatalog.cpp +6 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/HandlerDeferred.cpp +225 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/HandlerLevelSwitch.h +123 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/HandlerScriptErrors.h +44 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Animation/AnimationHandlers.cpp +7 -7
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.cpp +15 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.h +9 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_Import.cpp +147 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_Redirectors.cpp +11 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_SemanticSearch.cpp +435 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Chooser/ChooserHandlers.cpp +363 -331
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Chooser/ChooserHandlers.h +30 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Chooser/ChooserHandlers_Authoring.cpp +2178 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Chooser/HandlerChooserShared.h +1005 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Demo/DemoHandlers.cpp +104 -11
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Demo/DemoHandlers.h +19 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Dialog/DialogHandlers.cpp +54 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Dialog/DialogHandlers.h +9 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers.cpp +31 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers.h +15 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers_CsvProfile.cpp +272 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers_MapCheck.cpp +197 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers_Profiling.cpp +11 -16
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers_PythonPaths.cpp +237 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Editor/EditorHandlers_TraceAnalysis.cpp +790 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers.cpp +201 -56
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers.h +30 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_AIAssistant.cpp +510 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_MCP.cpp +394 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_Toolsets.cpp +542 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/MCPAIAssistantListener.h +19 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Gas/GasHandlers_Runtime.cpp +10 -7
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Landscape/LandscapeHandlers.cpp +9 -23
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Landscape/LandscapeHandlers.h +4 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Landscape/LandscapeHandlers_Sculpt.cpp +7 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Landscape/LandscapeHandlers_Splines.cpp +1253 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Landscape/LandscapeHandlers_Splines.h +39 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelGeneratorRecords.h +84 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.cpp +57 -12
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.h +33 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Blockout.cpp +987 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Blockout.h +23 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_PerfAudit.cpp +925 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_ReplaceActors.cpp +387 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_SplineGen.cpp +813 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_SplineGen.h +22 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_WorldPartitionSubsystem.cpp +1238 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Localization/LocalizationHandlers.cpp +982 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Localization/LocalizationHandlers.h +32 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/MachineLearning/MachineLearningHandlers.cpp +44 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/MachineLearning/MachineLearningHandlers.h +29 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/MachineLearning/MachineLearningHandlers_LearningAgents.cpp +491 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/MachineLearning/MachineLearningHandlers_NNE.cpp +532 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Networking/NetworkingHandlers.cpp +14 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Networking/NetworkingHandlers.h +2 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Networking/NetworkingHandlers_Audit.cpp +496 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGEdgeValidation.h +150 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers.cpp +26 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers.h +5 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers_CustomHLSL.cpp +290 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers_LevelToAsset.cpp +34 -3
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Sequencer/MovieRenderQueueHandlers.cpp +1215 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Sequencer/MovieRenderQueueHandlers.h +27 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/StateTree/StateTreeHandlers.cpp +72 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/StateTree/StateTreeHandlers.h +11 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/StateTree/StateTreeHandlers_NodesAndBindings.cpp +1172 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers.cpp +4 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers_MVVM.cpp +396 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers_MVVM.h +32 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/DialogBlockingWindowTests.cpp +74 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/HandlerSpecContractTests.cpp +4 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Public/HandlerDeferred.h +76 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Public/HandlerEngineVersion.h +4 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Public/HandlerMVVMBackend.h +92 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Public/HandlerStaticInvoke.h +96 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/UE_MCP_Bridge.Build.cs +75 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeMVVM/Private/UE_MCP_BridgeMVVMModule.cpp +1277 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeMVVM/UE_MCP_BridgeMVVM.Build.cs +58 -0
- package/plugin/ue_mcp_bridge/UE_MCP_Bridge.uplugin +7 -2
- package/skills/ue-mcp-animation/SKILL.md +4 -4
- package/skills/ue-mcp-epic-routing/SKILL.md +4 -0
|
@@ -0,0 +1,1277 @@
|
|
|
1
|
+
// Viewmodel authoring over the UMG Viewmodel (ModelViewViewModel) editor API.
|
|
2
|
+
// See UE_MCP_BridgeMVVM.Build.cs for why this is a module of its own, and
|
|
3
|
+
// Public/HandlerMVVMBackend.h in UE_MCP_Bridge for the contract with the
|
|
4
|
+
// widget handlers.
|
|
5
|
+
//
|
|
6
|
+
// Paths are written the way the viewmodel editor shows them: the first segment
|
|
7
|
+
// names where the path starts (a viewmodel by name, a widget in the tree, or
|
|
8
|
+
// Self for the widget blueprint itself), and the rest walk properties, with a
|
|
9
|
+
// function allowed as the last segment. "PlayerVM.Health", "HealthBar.Percent",
|
|
10
|
+
// "Self.Title".
|
|
11
|
+
|
|
12
|
+
#include "CoreMinimal.h"
|
|
13
|
+
#include "Modules/ModuleManager.h"
|
|
14
|
+
#include "HandlerMVVMBackend.h"
|
|
15
|
+
#include "HandlerParams.h"
|
|
16
|
+
#include "HandlerEngineVersion.h"
|
|
17
|
+
|
|
18
|
+
#if WITH_UEMCP_MVVM
|
|
19
|
+
#include "Dom/JsonValue.h"
|
|
20
|
+
#include "Editor.h"
|
|
21
|
+
#include "WidgetBlueprint.h"
|
|
22
|
+
#include "Blueprint/WidgetTree.h"
|
|
23
|
+
#include "Components/Widget.h"
|
|
24
|
+
#include "EdGraph/EdGraphPin.h"
|
|
25
|
+
#include "EdGraphSchema_K2.h"
|
|
26
|
+
#include "INotifyFieldValueChanged.h"
|
|
27
|
+
#include "Kismet2/BlueprintEditorUtils.h"
|
|
28
|
+
#include "Kismet2/Kismet2NameValidators.h"
|
|
29
|
+
#include "MVVMEditorSubsystem.h"
|
|
30
|
+
#include "MVVMBlueprintView.h"
|
|
31
|
+
#include "MVVMBlueprintViewBinding.h"
|
|
32
|
+
#include "MVVMBlueprintViewModelContext.h"
|
|
33
|
+
#include "MVVMBlueprintViewConversionFunction.h"
|
|
34
|
+
#include "MVVMBlueprintFunctionReference.h"
|
|
35
|
+
#include "MVVMBlueprintPin.h"
|
|
36
|
+
#include "MVVMPropertyPath.h"
|
|
37
|
+
#include "Types/MVVMBindingMode.h"
|
|
38
|
+
#include "Types/MVVMExecutionMode.h"
|
|
39
|
+
#include "Types/MVVMFieldVariant.h"
|
|
40
|
+
#include "UObject/UnrealType.h"
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if WITH_UEMCP_MVVM
|
|
44
|
+
namespace UEMCPMVVM
|
|
45
|
+
{
|
|
46
|
+
using UE::MVVM::FMVVMConstFieldVariant;
|
|
47
|
+
|
|
48
|
+
// ── Enum spellings ───────────────────────────────────────────────────────
|
|
49
|
+
|
|
50
|
+
template <typename TEnum>
|
|
51
|
+
FString EnumName(TEnum Value)
|
|
52
|
+
{
|
|
53
|
+
return StaticEnum<TEnum>()->GetNameStringByValue(static_cast<int64>(Value));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Parse a short enumerator name, case-insensitively. False when nothing matches. */
|
|
57
|
+
template <typename TEnum>
|
|
58
|
+
bool ParseEnum(const FString& Text, TEnum& Out)
|
|
59
|
+
{
|
|
60
|
+
const UEnum* Enum = StaticEnum<TEnum>();
|
|
61
|
+
for (int32 Index = 0; Index < Enum->NumEnums() - 1; ++Index)
|
|
62
|
+
{
|
|
63
|
+
if (Enum->GetNameStringByIndex(Index).Equals(Text, ESearchCase::IgnoreCase))
|
|
64
|
+
{
|
|
65
|
+
Out = static_cast<TEnum>(Enum->GetValueByIndex(Index));
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
template <typename TEnum>
|
|
73
|
+
FString EnumChoices()
|
|
74
|
+
{
|
|
75
|
+
const UEnum* Enum = StaticEnum<TEnum>();
|
|
76
|
+
TArray<FString> Names;
|
|
77
|
+
for (int32 Index = 0; Index < Enum->NumEnums() - 1; ++Index)
|
|
78
|
+
{
|
|
79
|
+
#if WITH_EDITORONLY_DATA
|
|
80
|
+
if (Enum->HasMetaData(TEXT("Hidden"), Index)) continue;
|
|
81
|
+
#endif
|
|
82
|
+
Names.Add(Enum->GetNameStringByIndex(Index));
|
|
83
|
+
}
|
|
84
|
+
return FString::Join(Names, TEXT(", "));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** EMVVMExecutionMode, with the editor's display name "Auto" for DelayedWhenSharedElseImmediate. */
|
|
88
|
+
bool ParseExecutionMode(const FString& Text, EMVVMExecutionMode& Out)
|
|
89
|
+
{
|
|
90
|
+
if (Text.Equals(TEXT("Auto"), ESearchCase::IgnoreCase))
|
|
91
|
+
{
|
|
92
|
+
Out = EMVVMExecutionMode::DelayedWhenSharedElseImmediate;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return ParseEnum(Text, Out);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
FString ExecutionModeName(EMVVMExecutionMode Mode)
|
|
99
|
+
{
|
|
100
|
+
return Mode == EMVVMExecutionMode::DelayedWhenSharedElseImmediate ? FString(TEXT("Auto")) : EnumName(Mode);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ── Context ──────────────────────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
UMVVMEditorSubsystem* Subsystem()
|
|
106
|
+
{
|
|
107
|
+
return GEditor ? GEditor->GetEditorSubsystem<UMVVMEditorSubsystem>() : nullptr;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The class a Self path resolves against: the skeleton, which carries members added since the last compile. */
|
|
111
|
+
const UClass* SelfClass(const UWidgetBlueprint* WidgetBlueprint)
|
|
112
|
+
{
|
|
113
|
+
if (WidgetBlueprint->SkeletonGeneratedClass) return WidgetBlueprint->SkeletonGeneratedClass;
|
|
114
|
+
return WidgetBlueprint->GeneratedClass;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The SKEL_ class of a Blueprint generated class, when there is one. */
|
|
118
|
+
const UClass* SkeletonOf(const UClass* Class)
|
|
119
|
+
{
|
|
120
|
+
if (const UBlueprint* Blueprint = Class ? Cast<UBlueprint>(Class->ClassGeneratedBy) : nullptr)
|
|
121
|
+
{
|
|
122
|
+
return Blueprint->SkeletonGeneratedClass;
|
|
123
|
+
}
|
|
124
|
+
return nullptr;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Walk Segments from Struct: properties first, then a function, which has to be the last segment. */
|
|
128
|
+
bool FindFieldChain(const UStruct* Struct, const TArray<FString>& Segments, int32 First, TArray<FMVVMConstFieldVariant>& OutChain, FString& OutError)
|
|
129
|
+
{
|
|
130
|
+
OutChain.Reset();
|
|
131
|
+
const UStruct* Current = Struct;
|
|
132
|
+
for (int32 Index = First; Index < Segments.Num(); ++Index)
|
|
133
|
+
{
|
|
134
|
+
const FString& Segment = Segments[Index];
|
|
135
|
+
if (!Current)
|
|
136
|
+
{
|
|
137
|
+
OutError = FString::Printf(TEXT("'%s' is reached through a value that is neither an object nor a struct, so it has no fields."), *Segment);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
if (const FProperty* Property = Current->FindPropertyByName(FName(*Segment)))
|
|
141
|
+
{
|
|
142
|
+
OutChain.Emplace(Property);
|
|
143
|
+
if (const FStructProperty* AsStruct = CastField<FStructProperty>(Property))
|
|
144
|
+
{
|
|
145
|
+
Current = AsStruct->Struct;
|
|
146
|
+
}
|
|
147
|
+
else if (const FObjectPropertyBase* AsObject = CastField<FObjectPropertyBase>(Property))
|
|
148
|
+
{
|
|
149
|
+
Current = AsObject->PropertyClass;
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
{
|
|
153
|
+
Current = nullptr;
|
|
154
|
+
}
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (const UClass* AsClass = Cast<UClass>(Current))
|
|
158
|
+
{
|
|
159
|
+
if (const UFunction* Function = AsClass->FindFunctionByName(FName(*Segment)))
|
|
160
|
+
{
|
|
161
|
+
if (Index != Segments.Num() - 1)
|
|
162
|
+
{
|
|
163
|
+
OutError = FString::Printf(TEXT("'%s' is a function, so it has to be the last segment of the path."), *Segment);
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
OutChain.Emplace(Function);
|
|
167
|
+
Current = nullptr;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
OutError = FString::Printf(TEXT("'%s' has no property or function named '%s'."), *Current->GetName(), *Segment);
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** First segment, the rest of the path, and which of the two kinds of answer it gave. */
|
|
178
|
+
bool ResolvePath(UWidgetBlueprint* WidgetBlueprint, const UMVVMBlueprintView* View, const FString& Text, FMVVMBlueprintPropertyPath& OutPath, FString& OutError)
|
|
179
|
+
{
|
|
180
|
+
TArray<FString> Segments;
|
|
181
|
+
Text.TrimStartAndEnd().ParseIntoArray(Segments, TEXT("."), true);
|
|
182
|
+
if (Segments.Num() < 2)
|
|
183
|
+
{
|
|
184
|
+
OutError = FString::Printf(TEXT("Path '%s' needs a source and at least one field, e.g. PlayerVM.Health, HealthBar.Percent or Self.Title."), *Text);
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
const FString& Head = Segments[0];
|
|
188
|
+
|
|
189
|
+
FMVVMBlueprintPropertyPath Path;
|
|
190
|
+
TArray<const UStruct*> Candidates;
|
|
191
|
+
if (Head.Equals(TEXT("Self"), ESearchCase::IgnoreCase))
|
|
192
|
+
{
|
|
193
|
+
Path.SetSelfContext();
|
|
194
|
+
Candidates.Add(SelfClass(WidgetBlueprint));
|
|
195
|
+
}
|
|
196
|
+
else if (const FMVVMBlueprintViewModelContext* ViewModel = View ? View->FindViewModel(FName(*Head)) : nullptr)
|
|
197
|
+
{
|
|
198
|
+
Path.SetViewModelId(ViewModel->GetViewModelId());
|
|
199
|
+
const UClass* ViewModelClass = ViewModel->GetViewModelClass();
|
|
200
|
+
Candidates.Add(ViewModelClass);
|
|
201
|
+
if (const UClass* Skeleton = SkeletonOf(ViewModelClass))
|
|
202
|
+
{
|
|
203
|
+
Candidates.Add(Skeleton);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (UWidget* Widget = WidgetBlueprint->WidgetTree ? WidgetBlueprint->WidgetTree->FindWidget(FName(*Head)) : nullptr)
|
|
207
|
+
{
|
|
208
|
+
Path.SetWidgetName(Widget->GetFName());
|
|
209
|
+
Candidates.Add(Widget->GetClass());
|
|
210
|
+
}
|
|
211
|
+
else
|
|
212
|
+
{
|
|
213
|
+
TArray<FString> ViewModelNames;
|
|
214
|
+
if (View)
|
|
215
|
+
{
|
|
216
|
+
for (const FMVVMBlueprintViewModelContext& Context : View->GetViewModels())
|
|
217
|
+
{
|
|
218
|
+
ViewModelNames.Add(Context.GetViewModelName().ToString());
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
OutError = FString::Printf(
|
|
222
|
+
TEXT("Path '%s' starts with '%s', which is not a viewmodel on this widget blueprint (%s), a widget in its tree, or Self."),
|
|
223
|
+
*Text, *Head, ViewModelNames.Num() ? *FString::Join(ViewModelNames, TEXT(", ")) : TEXT("it has none"));
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
FString FirstError;
|
|
228
|
+
for (const UStruct* Candidate : Candidates)
|
|
229
|
+
{
|
|
230
|
+
if (!Candidate) continue;
|
|
231
|
+
TArray<FMVVMConstFieldVariant> Chain;
|
|
232
|
+
FString Error;
|
|
233
|
+
if (FindFieldChain(Candidate, Segments, 1, Chain, Error))
|
|
234
|
+
{
|
|
235
|
+
for (const FMVVMConstFieldVariant& Field : Chain)
|
|
236
|
+
{
|
|
237
|
+
Path.AppendPropertyPath(WidgetBlueprint, Field);
|
|
238
|
+
}
|
|
239
|
+
OutPath = Path;
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
if (FirstError.IsEmpty()) FirstError = Error;
|
|
243
|
+
}
|
|
244
|
+
OutError = FString::Printf(TEXT("Path '%s': %s"), *Text, FirstError.IsEmpty() ? TEXT("its source has no class to resolve against.") : *FirstError);
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
FString PathToString(const UWidgetBlueprint* WidgetBlueprint, const UMVVMBlueprintView* View, const FMVVMBlueprintPropertyPath& Path)
|
|
249
|
+
{
|
|
250
|
+
if (!Path.IsValid()) return FString();
|
|
251
|
+
FString Head;
|
|
252
|
+
switch (Path.GetSource(WidgetBlueprint))
|
|
253
|
+
{
|
|
254
|
+
case EMVVMBlueprintFieldPathSource::Widget:
|
|
255
|
+
Head = Path.GetWidgetName().ToString();
|
|
256
|
+
break;
|
|
257
|
+
case EMVVMBlueprintFieldPathSource::ViewModel:
|
|
258
|
+
{
|
|
259
|
+
const FMVVMBlueprintViewModelContext* Context = View ? View->FindViewModel(Path.GetViewModelId()) : nullptr;
|
|
260
|
+
Head = Context ? Context->GetViewModelName().ToString() : Path.GetViewModelId().ToString();
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case EMVVMBlueprintFieldPathSource::SelfContext:
|
|
264
|
+
Head = TEXT("Self");
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
TArray<FString> Parts;
|
|
270
|
+
if (!Head.IsEmpty()) Parts.Add(Head);
|
|
271
|
+
for (const FName& Name : Path.GetFieldNames(WidgetBlueprint->GeneratedClass ? WidgetBlueprint->GeneratedClass.Get() : WidgetBlueprint->SkeletonGeneratedClass.Get()))
|
|
272
|
+
{
|
|
273
|
+
Parts.Add(Name.ToString());
|
|
274
|
+
}
|
|
275
|
+
return FString::Join(Parts, TEXT("."));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** "<ClassPath>:<Function>" for a function on another class, the bare name for one on this widget blueprint. */
|
|
279
|
+
FString FunctionReferenceToString(const UWidgetBlueprint* WidgetBlueprint, const FMVVMBlueprintFunctionReference& Reference)
|
|
280
|
+
{
|
|
281
|
+
switch (Reference.GetType())
|
|
282
|
+
{
|
|
283
|
+
case EMVVMBlueprintFunctionReferenceType::Function:
|
|
284
|
+
if (const UFunction* Function = Reference.GetFunction(WidgetBlueprint))
|
|
285
|
+
{
|
|
286
|
+
const UClass* Owner = Function->GetOwnerClass();
|
|
287
|
+
const bool bSelf = Owner && (Owner == WidgetBlueprint->GeneratedClass || Owner == WidgetBlueprint->SkeletonGeneratedClass);
|
|
288
|
+
return bSelf ? Function->GetName() : FString::Printf(TEXT("%s:%s"), *Owner->GetPathName(), *Function->GetName());
|
|
289
|
+
}
|
|
290
|
+
return Reference.GetName().ToString();
|
|
291
|
+
case EMVVMBlueprintFunctionReferenceType::Node:
|
|
292
|
+
if (const UClass* NodeClass = Reference.GetNode().Get())
|
|
293
|
+
{
|
|
294
|
+
return FString::Printf(TEXT("node:%s"), *NodeClass->GetPathName());
|
|
295
|
+
}
|
|
296
|
+
return FString();
|
|
297
|
+
default:
|
|
298
|
+
return FString();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** A conversion function named as "<ClassPath>:<Function>" or by a bare name on the widget blueprint. */
|
|
303
|
+
const UFunction* ResolveFunction(const UWidgetBlueprint* WidgetBlueprint, const FString& Spec, FString& OutError)
|
|
304
|
+
{
|
|
305
|
+
FString ClassPath;
|
|
306
|
+
FString FunctionName;
|
|
307
|
+
if (Spec.Split(TEXT(":"), &ClassPath, &FunctionName, ESearchCase::CaseSensitive, ESearchDir::FromEnd))
|
|
308
|
+
{
|
|
309
|
+
const UClass* Owner = FindObject<UClass>(nullptr, *ClassPath);
|
|
310
|
+
if (!Owner) Owner = LoadObject<UClass>(nullptr, *ClassPath);
|
|
311
|
+
if (!Owner)
|
|
312
|
+
{
|
|
313
|
+
OutError = FString::Printf(TEXT("Conversion function '%s': no class at '%s'."), *Spec, *ClassPath);
|
|
314
|
+
return nullptr;
|
|
315
|
+
}
|
|
316
|
+
if (const UFunction* Function = Owner->FindFunctionByName(FName(*FunctionName)))
|
|
317
|
+
{
|
|
318
|
+
return Function;
|
|
319
|
+
}
|
|
320
|
+
OutError = FString::Printf(TEXT("Conversion function '%s': %s has no function named '%s'."), *Spec, *Owner->GetName(), *FunctionName);
|
|
321
|
+
return nullptr;
|
|
322
|
+
}
|
|
323
|
+
for (const UClass* Class : { SelfClass(WidgetBlueprint), static_cast<const UClass*>(WidgetBlueprint->GeneratedClass.Get()) })
|
|
324
|
+
{
|
|
325
|
+
if (const UFunction* Function = Class ? Class->FindFunctionByName(FName(*Spec)) : nullptr)
|
|
326
|
+
{
|
|
327
|
+
return Function;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
OutError = FString::Printf(TEXT("Conversion function '%s' is not a function on this widget blueprint. Name a library function as Class.Function or /Script/Module.Class:Function."), *Spec);
|
|
331
|
+
return nullptr;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// ── Description ──────────────────────────────────────────────────────────
|
|
335
|
+
|
|
336
|
+
TSharedPtr<FJsonObject> DescribeViewModel(const UMVVMBlueprintView* View, const FMVVMBlueprintViewModelContext& Context)
|
|
337
|
+
{
|
|
338
|
+
TSharedPtr<FJsonObject> Out = MakeShared<FJsonObject>();
|
|
339
|
+
Out->SetStringField(TEXT("viewModelName"), Context.GetViewModelName().ToString());
|
|
340
|
+
Out->SetStringField(TEXT("viewModelId"), Context.GetViewModelId().ToString(EGuidFormats::DigitsWithHyphens));
|
|
341
|
+
Out->SetStringField(TEXT("viewModelClass"), Context.GetViewModelClass() ? Context.GetViewModelClass()->GetPathName() : FString());
|
|
342
|
+
Out->SetStringField(TEXT("creationType"), EnumName(Context.CreationType));
|
|
343
|
+
Out->SetStringField(TEXT("globalViewModelIdentifier"), Context.GlobalViewModelIdentifier.IsNone() ? FString() : Context.GlobalViewModelIdentifier.ToString());
|
|
344
|
+
Out->SetStringField(TEXT("viewModelPropertyPath"), Context.ViewModelPropertyPath);
|
|
345
|
+
Out->SetBoolField(TEXT("optional"), Context.bOptional);
|
|
346
|
+
Out->SetBoolField(TEXT("createSetter"), Context.bCreateSetterFunction);
|
|
347
|
+
Out->SetBoolField(TEXT("createGetter"), Context.bCreateGetterFunction);
|
|
348
|
+
Out->SetBoolField(TEXT("canRemove"), Context.bCanRemove);
|
|
349
|
+
int32 BindingCount = 0;
|
|
350
|
+
if (View)
|
|
351
|
+
{
|
|
352
|
+
for (const FMVVMBlueprintViewBinding& Binding : View->GetBindings())
|
|
353
|
+
{
|
|
354
|
+
if (Binding.SourcePath.GetViewModelId() == Context.GetViewModelId() || Binding.DestinationPath.GetViewModelId() == Context.GetViewModelId())
|
|
355
|
+
{
|
|
356
|
+
++BindingCount;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
Out->SetNumberField(TEXT("bindingCount"), BindingCount);
|
|
361
|
+
return Out;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
struct FConversionSide
|
|
365
|
+
{
|
|
366
|
+
UMVVMBlueprintViewConversionFunction* Function = nullptr;
|
|
367
|
+
bool bSourceToDestination = true;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
/** The conversion a binding has, source-to-destination first. */
|
|
371
|
+
FConversionSide ConversionOf(const FMVVMBlueprintViewBinding& Binding)
|
|
372
|
+
{
|
|
373
|
+
FConversionSide Side;
|
|
374
|
+
if (UMVVMBlueprintViewConversionFunction* Forward = Binding.Conversion.GetConversionFunction(true))
|
|
375
|
+
{
|
|
376
|
+
Side.Function = Forward;
|
|
377
|
+
Side.bSourceToDestination = true;
|
|
378
|
+
}
|
|
379
|
+
else if (UMVVMBlueprintViewConversionFunction* Backward = Binding.Conversion.GetConversionFunction(false))
|
|
380
|
+
{
|
|
381
|
+
Side.Function = Backward;
|
|
382
|
+
Side.bSourceToDestination = false;
|
|
383
|
+
}
|
|
384
|
+
return Side;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
FString PinName(const FMVVMBlueprintPinId& Id)
|
|
388
|
+
{
|
|
389
|
+
TArray<FString> Names;
|
|
390
|
+
for (const FName& Name : Id.GetNames())
|
|
391
|
+
{
|
|
392
|
+
Names.Add(Name.ToString());
|
|
393
|
+
}
|
|
394
|
+
return FString::Join(Names, TEXT("."));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** {pin: {path} | {literal}} for every saved pin of a conversion function. */
|
|
398
|
+
TSharedPtr<FJsonObject> DescribeArguments(const UWidgetBlueprint* WidgetBlueprint, const UMVVMBlueprintView* View, const UMVVMBlueprintViewConversionFunction* Function)
|
|
399
|
+
{
|
|
400
|
+
TSharedPtr<FJsonObject> Arguments = MakeShared<FJsonObject>();
|
|
401
|
+
if (!Function) return Arguments;
|
|
402
|
+
for (const FMVVMBlueprintPin& Pin : Function->GetPins())
|
|
403
|
+
{
|
|
404
|
+
if (!Pin.IsValid() || Pin.IsSplit()) continue;
|
|
405
|
+
TSharedPtr<FJsonObject> Value = MakeShared<FJsonObject>();
|
|
406
|
+
if (Pin.UsedPathAsValue())
|
|
407
|
+
{
|
|
408
|
+
Value->SetStringField(TEXT("path"), PathToString(WidgetBlueprint, View, Pin.GetPath()));
|
|
409
|
+
}
|
|
410
|
+
else
|
|
411
|
+
{
|
|
412
|
+
Value->SetStringField(TEXT("literal"), Pin.GetValueAsString(SelfClass(WidgetBlueprint)));
|
|
413
|
+
}
|
|
414
|
+
if (Pin.GetStatus() == EMVVMBlueprintPinStatus::Orphaned)
|
|
415
|
+
{
|
|
416
|
+
Value->SetBoolField(TEXT("orphaned"), true);
|
|
417
|
+
}
|
|
418
|
+
Arguments->SetObjectField(PinName(Pin.GetId()), Value);
|
|
419
|
+
}
|
|
420
|
+
return Arguments;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
TArray<TSharedPtr<FJsonValue>> Messages(const UMVVMBlueprintView* View, const FGuid& Id, UE::MVVM::EBindingMessageType Type)
|
|
424
|
+
{
|
|
425
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
426
|
+
if (!View) return Out;
|
|
427
|
+
for (const FText& Message : View->GetBindingMessages(Id, Type))
|
|
428
|
+
{
|
|
429
|
+
Out.Add(MakeShared<FJsonValueString>(Message.ToString()));
|
|
430
|
+
}
|
|
431
|
+
return Out;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** The parameters add_widget_viewmodel_binding takes to recreate Binding. */
|
|
435
|
+
TSharedPtr<FJsonObject> BindingToAddParams(const UWidgetBlueprint* WidgetBlueprint, const UMVVMBlueprintView* View, const FMVVMBlueprintViewBinding& Binding)
|
|
436
|
+
{
|
|
437
|
+
TSharedPtr<FJsonObject> Out = MakeShared<FJsonObject>();
|
|
438
|
+
const FString Source = PathToString(WidgetBlueprint, View, Binding.SourcePath);
|
|
439
|
+
const FString Destination = PathToString(WidgetBlueprint, View, Binding.DestinationPath);
|
|
440
|
+
if (!Source.IsEmpty()) Out->SetStringField(TEXT("sourcePath"), Source);
|
|
441
|
+
if (!Destination.IsEmpty()) Out->SetStringField(TEXT("destinationPath"), Destination);
|
|
442
|
+
Out->SetStringField(TEXT("bindingMode"), EnumName(Binding.BindingType));
|
|
443
|
+
Out->SetStringField(TEXT("executionMode"), Binding.bOverrideExecutionMode ? ExecutionModeName(Binding.OverrideExecutionMode) : FString(TEXT("Default")));
|
|
444
|
+
Out->SetBoolField(TEXT("enabled"), Binding.bEnabled);
|
|
445
|
+
Out->SetBoolField(TEXT("includeInCompile"), Binding.bCompile);
|
|
446
|
+
const FConversionSide Side = ConversionOf(Binding);
|
|
447
|
+
if (Side.Function)
|
|
448
|
+
{
|
|
449
|
+
Out->SetStringField(TEXT("conversionFunction"), FunctionReferenceToString(WidgetBlueprint, Side.Function->GetConversionFunction()));
|
|
450
|
+
Out->SetStringField(TEXT("conversionDirection"), Side.bSourceToDestination ? TEXT("sourceToDestination") : TEXT("destinationToSource"));
|
|
451
|
+
Out->SetObjectField(TEXT("conversionArguments"), DescribeArguments(WidgetBlueprint, View, Side.Function));
|
|
452
|
+
}
|
|
453
|
+
return Out;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
TSharedPtr<FJsonObject> DescribeBinding(const UWidgetBlueprint* WidgetBlueprint, const UMVVMBlueprintView* View, const FMVVMBlueprintViewBinding& Binding)
|
|
457
|
+
{
|
|
458
|
+
TSharedPtr<FJsonObject> Out = BindingToAddParams(WidgetBlueprint, View, Binding);
|
|
459
|
+
Out->SetStringField(TEXT("bindingId"), Binding.BindingId.ToString(EGuidFormats::DigitsWithHyphens));
|
|
460
|
+
Out->SetStringField(TEXT("displayName"), Binding.GetDisplayNameString(WidgetBlueprint));
|
|
461
|
+
if (!Out->HasField(TEXT("sourcePath"))) Out->SetStringField(TEXT("sourcePath"), FString());
|
|
462
|
+
if (!Out->HasField(TEXT("destinationPath"))) Out->SetStringField(TEXT("destinationPath"), FString());
|
|
463
|
+
Out->SetArrayField(TEXT("errors"), Messages(View, Binding.BindingId, UE::MVVM::EBindingMessageType::Error));
|
|
464
|
+
Out->SetArrayField(TEXT("warnings"), Messages(View, Binding.BindingId, UE::MVVM::EBindingMessageType::Warning));
|
|
465
|
+
return Out;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
bool SameJson(const TSharedPtr<FJsonObject>& A, const TSharedPtr<FJsonObject>& B)
|
|
469
|
+
{
|
|
470
|
+
if (!A.IsValid() || !B.IsValid()) return A.IsValid() == B.IsValid();
|
|
471
|
+
const TSharedRef<FJsonValueObject> AV = MakeShared<FJsonValueObject>(A);
|
|
472
|
+
const TSharedRef<FJsonValueObject> BV = MakeShared<FJsonValueObject>(B);
|
|
473
|
+
return FJsonValue::CompareEqual(*AV, *BV);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// ── Binding edits ────────────────────────────────────────────────────────
|
|
477
|
+
|
|
478
|
+
struct FBindingRequest
|
|
479
|
+
{
|
|
480
|
+
bool bHasSource = false;
|
|
481
|
+
FMVVMBlueprintPropertyPath Source;
|
|
482
|
+
FString SourceText;
|
|
483
|
+
bool bHasDestination = false;
|
|
484
|
+
FMVVMBlueprintPropertyPath Destination;
|
|
485
|
+
FString DestinationText;
|
|
486
|
+
bool bHasMode = false;
|
|
487
|
+
EMVVMBindingMode Mode = EMVVMBindingMode::OneWayToDestination;
|
|
488
|
+
bool bHasExecutionMode = false;
|
|
489
|
+
bool bResetExecutionMode = false;
|
|
490
|
+
EMVVMExecutionMode ExecutionMode = EMVVMExecutionMode::Immediate;
|
|
491
|
+
bool bHasConversion = false;
|
|
492
|
+
/** Null with bHasConversion clears the conversion. */
|
|
493
|
+
const UFunction* Conversion = nullptr;
|
|
494
|
+
FString ConversionText;
|
|
495
|
+
bool bSourceToDestination = true;
|
|
496
|
+
bool bHasDirection = false;
|
|
497
|
+
TSharedPtr<FJsonObject> Arguments;
|
|
498
|
+
bool bHasEnabled = false;
|
|
499
|
+
bool bEnabled = true;
|
|
500
|
+
bool bHasCompile = false;
|
|
501
|
+
bool bCompile = true;
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
/** Read and resolve every binding parameter, so nothing is written when one of them is wrong. */
|
|
505
|
+
bool ReadBindingRequest(UWidgetBlueprint* WidgetBlueprint, const UMVVMBlueprintView* View, const TSharedPtr<FJsonObject>& Params, FBindingRequest& Out, FString& OutError)
|
|
506
|
+
{
|
|
507
|
+
if (TryGetStringParam(Params, TEXT("sourcePath"), Out.SourceText) && !Out.SourceText.IsEmpty())
|
|
508
|
+
{
|
|
509
|
+
Out.bHasSource = true;
|
|
510
|
+
if (!ResolvePath(WidgetBlueprint, View, Out.SourceText, Out.Source, OutError)) return false;
|
|
511
|
+
}
|
|
512
|
+
if (TryGetStringParam(Params, TEXT("destinationPath"), Out.DestinationText) && !Out.DestinationText.IsEmpty())
|
|
513
|
+
{
|
|
514
|
+
Out.bHasDestination = true;
|
|
515
|
+
if (!ResolvePath(WidgetBlueprint, View, Out.DestinationText, Out.Destination, OutError)) return false;
|
|
516
|
+
}
|
|
517
|
+
FString ModeText;
|
|
518
|
+
if (TryGetStringParam(Params, TEXT("bindingMode"), ModeText) && !ModeText.IsEmpty())
|
|
519
|
+
{
|
|
520
|
+
Out.bHasMode = true;
|
|
521
|
+
if (!ParseEnum(ModeText, Out.Mode))
|
|
522
|
+
{
|
|
523
|
+
OutError = FString::Printf(TEXT("bindingMode '%s' is not one of %s."), *ModeText, *EnumChoices<EMVVMBindingMode>());
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
FString ExecutionText;
|
|
528
|
+
if (TryGetStringParam(Params, TEXT("executionMode"), ExecutionText) && !ExecutionText.IsEmpty())
|
|
529
|
+
{
|
|
530
|
+
Out.bHasExecutionMode = true;
|
|
531
|
+
if (ExecutionText.Equals(TEXT("Default"), ESearchCase::IgnoreCase))
|
|
532
|
+
{
|
|
533
|
+
Out.bResetExecutionMode = true;
|
|
534
|
+
}
|
|
535
|
+
else if (!ParseExecutionMode(ExecutionText, Out.ExecutionMode))
|
|
536
|
+
{
|
|
537
|
+
OutError = FString::Printf(TEXT("executionMode '%s' is not one of Default, Immediate, Delayed, Tick, Auto."), *ExecutionText);
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (TryGetStringParam(Params, TEXT("conversionFunction"), Out.ConversionText))
|
|
542
|
+
{
|
|
543
|
+
Out.bHasConversion = true;
|
|
544
|
+
if (!Out.ConversionText.IsEmpty())
|
|
545
|
+
{
|
|
546
|
+
Out.Conversion = ResolveFunction(WidgetBlueprint, Out.ConversionText, OutError);
|
|
547
|
+
if (!Out.Conversion) return false;
|
|
548
|
+
if (!UMVVMBlueprintViewConversionFunction::IsValidConversionFunction(WidgetBlueprint, Out.Conversion))
|
|
549
|
+
{
|
|
550
|
+
OutError = FString::Printf(TEXT("'%s' cannot be a viewmodel conversion function: it has to be a pure function that returns a value, and the project's viewmodel settings have to allow it."), *Out.ConversionText);
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
FString Direction;
|
|
556
|
+
if (TryGetStringParam(Params, TEXT("conversionDirection"), Direction) && !Direction.IsEmpty())
|
|
557
|
+
{
|
|
558
|
+
Out.bHasDirection = true;
|
|
559
|
+
if (Direction.Equals(TEXT("sourceToDestination"), ESearchCase::IgnoreCase)) Out.bSourceToDestination = true;
|
|
560
|
+
else if (Direction.Equals(TEXT("destinationToSource"), ESearchCase::IgnoreCase)) Out.bSourceToDestination = false;
|
|
561
|
+
else
|
|
562
|
+
{
|
|
563
|
+
OutError = FString::Printf(TEXT("conversionDirection '%s' is not sourceToDestination or destinationToSource."), *Direction);
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const TSharedPtr<FJsonObject>* Arguments = nullptr;
|
|
568
|
+
if (TryGetObjectParam(Params, TEXT("conversionArguments"), Arguments) && Arguments && Arguments->IsValid())
|
|
569
|
+
{
|
|
570
|
+
Out.Arguments = *Arguments;
|
|
571
|
+
}
|
|
572
|
+
Out.bHasEnabled = TryGetBoolParam(Params, TEXT("enabled"), Out.bEnabled);
|
|
573
|
+
Out.bHasCompile = TryGetBoolParam(Params, TEXT("includeInCompile"), Out.bCompile);
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** Apply the conversion arguments. A pin value is {path} or a literal (a string, number or boolean, or {literal}). */
|
|
578
|
+
bool ApplyArguments(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, UMVVMBlueprintView* View, FMVVMBlueprintViewBinding& Binding,
|
|
579
|
+
bool bSourceToDestination, const TSharedPtr<FJsonObject>& Arguments, FString& OutError)
|
|
580
|
+
{
|
|
581
|
+
UMVVMBlueprintViewConversionFunction* Function = Binding.Conversion.GetConversionFunction(bSourceToDestination);
|
|
582
|
+
if (!Function)
|
|
583
|
+
{
|
|
584
|
+
OutError = TEXT("conversionArguments were given, but the binding has no conversion function in that direction.");
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
const UEdGraphSchema_K2* Schema = GetDefault<UEdGraphSchema_K2>();
|
|
588
|
+
for (const auto& Entry : Arguments->Values)
|
|
589
|
+
{
|
|
590
|
+
const TPair<FString, TSharedPtr<FJsonValue>> Pair(Entry.Key, Entry.Value);
|
|
591
|
+
TArray<FString> NameParts;
|
|
592
|
+
Pair.Key.ParseIntoArray(NameParts, TEXT("."), true);
|
|
593
|
+
TArray<FName> Names;
|
|
594
|
+
for (const FString& Part : NameParts) Names.Add(FName(*Part));
|
|
595
|
+
const FMVVMBlueprintPinId PinId(MoveTemp(Names));
|
|
596
|
+
|
|
597
|
+
FString PathText;
|
|
598
|
+
FString Literal;
|
|
599
|
+
bool bIsPath = false;
|
|
600
|
+
const TSharedPtr<FJsonValue>& Value = Pair.Value;
|
|
601
|
+
if (Value.IsValid() && Value->Type == EJson::Object)
|
|
602
|
+
{
|
|
603
|
+
const TSharedPtr<FJsonObject> Object = Value->AsObject();
|
|
604
|
+
if (Object->TryGetStringField(TEXT("path"), PathText)) bIsPath = true;
|
|
605
|
+
else if (!Object->TryGetStringField(TEXT("literal"), Literal))
|
|
606
|
+
{
|
|
607
|
+
OutError = FString::Printf(TEXT("conversionArguments.%s is an object without 'path' or 'literal'."), *Pair.Key);
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
else if (Value.IsValid() && Value->Type == EJson::Boolean)
|
|
612
|
+
{
|
|
613
|
+
Literal = Value->AsBool() ? TEXT("true") : TEXT("false");
|
|
614
|
+
}
|
|
615
|
+
else if (!Value.IsValid() || !Value->TryGetString(Literal))
|
|
616
|
+
{
|
|
617
|
+
OutError = FString::Printf(TEXT("conversionArguments.%s has to be a string, number, boolean, {path} or {literal}."), *Pair.Key);
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
UEdGraphPin* GraphPin = Editor->GetConversionFunctionArgumentPin(WidgetBlueprint, Binding, PinId, bSourceToDestination);
|
|
622
|
+
if (!GraphPin || GraphPin->bOrphanedPin || !FMVVMBlueprintPin::IsInputPin(GraphPin))
|
|
623
|
+
{
|
|
624
|
+
TArray<FString> Known;
|
|
625
|
+
for (const FMVVMBlueprintPin& Pin : Function->GetPins()) Known.Add(PinName(Pin.GetId()));
|
|
626
|
+
OutError = FString::Printf(TEXT("The conversion function has no input '%s'. Its inputs are: %s."), *Pair.Key, *FString::Join(Known, TEXT(", ")));
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (bIsPath)
|
|
631
|
+
{
|
|
632
|
+
FMVVMBlueprintPropertyPath Path;
|
|
633
|
+
if (!ResolvePath(WidgetBlueprint, View, PathText, Path, OutError)) return false;
|
|
634
|
+
Editor->SetPathForConversionFunctionArgument(WidgetBlueprint, Binding, PinId, Path, bSourceToDestination);
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
const FName Category = GraphPin->PinType.PinCategory;
|
|
639
|
+
if (GraphPin->PinType.IsContainer() || Category == UEdGraphSchema_K2::PC_Object || Category == UEdGraphSchema_K2::PC_Struct
|
|
640
|
+
|| Category == UEdGraphSchema_K2::PC_Class || Category == UEdGraphSchema_K2::PC_Interface)
|
|
641
|
+
{
|
|
642
|
+
OutError = FString::Printf(TEXT("Input '%s' is a %s; only bool, number, name, string, text and enum inputs take a literal. Bind it to a path instead."),
|
|
643
|
+
*Pair.Key, *UEdGraphSchema_K2::TypeToText(GraphPin->PinType).ToString());
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
GraphPin->Modify();
|
|
647
|
+
if (Category == UEdGraphSchema_K2::PC_Text)
|
|
648
|
+
{
|
|
649
|
+
Schema->TrySetDefaultText(*GraphPin, FText::FromString(Literal), false);
|
|
650
|
+
}
|
|
651
|
+
else
|
|
652
|
+
{
|
|
653
|
+
const FString Problem = Schema->IsPinDefaultValid(GraphPin, Literal, nullptr, FText::GetEmpty());
|
|
654
|
+
if (!Problem.IsEmpty())
|
|
655
|
+
{
|
|
656
|
+
OutError = FString::Printf(TEXT("'%s' is not a valid value for input '%s': %s"), *Literal, *Pair.Key, *Problem);
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
Schema->TrySetDefaultValue(*GraphPin, Literal, false);
|
|
660
|
+
}
|
|
661
|
+
Function->SavePinValues(WidgetBlueprint);
|
|
662
|
+
}
|
|
663
|
+
FBlueprintEditorUtils::MarkBlueprintAsModified(WidgetBlueprint);
|
|
664
|
+
return true;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/** The first input of the conversion that no argument binds, to receive the binding's other end. */
|
|
668
|
+
FString FirstFreeInput(const UMVVMBlueprintViewConversionFunction* Function, const TSharedPtr<FJsonObject>& Arguments)
|
|
669
|
+
{
|
|
670
|
+
if (!Function) return FString();
|
|
671
|
+
for (const FMVVMBlueprintPin& Pin : Function->GetPins())
|
|
672
|
+
{
|
|
673
|
+
if (!Pin.IsValid() || Pin.GetId().GetNames().Num() != 1) continue;
|
|
674
|
+
const FString Name = PinName(Pin.GetId());
|
|
675
|
+
if (Arguments.IsValid() && Arguments->HasField(Name)) continue;
|
|
676
|
+
return Name;
|
|
677
|
+
}
|
|
678
|
+
return FString();
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
bool ArgumentsBindAPath(const TSharedPtr<FJsonObject>& Arguments)
|
|
682
|
+
{
|
|
683
|
+
if (!Arguments.IsValid()) return false;
|
|
684
|
+
for (const auto& Entry : Arguments->Values)
|
|
685
|
+
{
|
|
686
|
+
const TPair<FString, TSharedPtr<FJsonValue>> Pair(Entry.Key, Entry.Value);
|
|
687
|
+
if (Pair.Value.IsValid() && Pair.Value->Type == EJson::Object && Pair.Value->AsObject()->HasField(TEXT("path"))) return true;
|
|
688
|
+
}
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Apply a request to a binding in the editor's own order: the mode, then the
|
|
694
|
+
* conversion, then the paths, then the conversion's arguments. A conversion
|
|
695
|
+
* replaces one end of the binding (the source when it runs source to
|
|
696
|
+
* destination), so with one in place that end of the request is bound to the
|
|
697
|
+
* conversion's first free input instead.
|
|
698
|
+
*/
|
|
699
|
+
bool ApplyBindingRequest(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, UMVVMBlueprintView* View, const FGuid& BindingId,
|
|
700
|
+
const FBindingRequest& Request, FString& OutError)
|
|
701
|
+
{
|
|
702
|
+
auto Binding = [View, &BindingId]() { return View->GetBinding(BindingId); };
|
|
703
|
+
if (!Binding())
|
|
704
|
+
{
|
|
705
|
+
OutError = TEXT("The binding disappeared while it was being edited.");
|
|
706
|
+
return false;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
if (Request.bHasMode)
|
|
710
|
+
{
|
|
711
|
+
Editor->SetBindingTypeForBinding(WidgetBlueprint, *Binding(), Request.Mode);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
bool bForward = Request.bSourceToDestination;
|
|
715
|
+
if (!Request.bHasDirection)
|
|
716
|
+
{
|
|
717
|
+
const FConversionSide Existing = ConversionOf(*Binding());
|
|
718
|
+
if (Existing.Function) bForward = Existing.bSourceToDestination;
|
|
719
|
+
else bForward = Binding()->BindingType != EMVVMBindingMode::OneWayToSource && Binding()->BindingType != EMVVMBindingMode::OneTimeToSource;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
if (Request.bHasConversion)
|
|
723
|
+
{
|
|
724
|
+
// The end the conversion does not replace is set first, because the
|
|
725
|
+
// subsystem checks the conversion's types against it.
|
|
726
|
+
if (bForward && Request.bHasDestination)
|
|
727
|
+
{
|
|
728
|
+
Editor->SetDestinationPathForBinding(WidgetBlueprint, *Binding(), Request.Destination, false);
|
|
729
|
+
}
|
|
730
|
+
if (!bForward && Request.bHasSource)
|
|
731
|
+
{
|
|
732
|
+
Editor->SetSourcePathForBinding(WidgetBlueprint, *Binding(), Request.Source);
|
|
733
|
+
}
|
|
734
|
+
const FMVVMBlueprintFunctionReference Reference = Request.Conversion ? FMVVMBlueprintFunctionReference(WidgetBlueprint, Request.Conversion) : FMVVMBlueprintFunctionReference();
|
|
735
|
+
// Clearing one direction clears both: a binding has at most one conversion here.
|
|
736
|
+
if (!Request.Conversion || bForward)
|
|
737
|
+
{
|
|
738
|
+
Editor->SetDestinationToSourceConversionFunction(WidgetBlueprint, *Binding(), FMVVMBlueprintFunctionReference());
|
|
739
|
+
}
|
|
740
|
+
if (!Request.Conversion || !bForward)
|
|
741
|
+
{
|
|
742
|
+
Editor->SetSourceToDestinationConversionFunction(WidgetBlueprint, *Binding(), FMVVMBlueprintFunctionReference());
|
|
743
|
+
}
|
|
744
|
+
if (Request.Conversion)
|
|
745
|
+
{
|
|
746
|
+
if (bForward) Editor->SetSourceToDestinationConversionFunction(WidgetBlueprint, *Binding(), Reference);
|
|
747
|
+
else Editor->SetDestinationToSourceConversionFunction(WidgetBlueprint, *Binding(), Reference);
|
|
748
|
+
if (!Binding()->Conversion.GetConversionFunction(bForward))
|
|
749
|
+
{
|
|
750
|
+
OutError = FString::Printf(TEXT("'%s' does not convert to the type of the binding's %s, so the viewmodel editor refused it."),
|
|
751
|
+
*Request.ConversionText, bForward ? TEXT("destination") : TEXT("source"));
|
|
752
|
+
return false;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
UMVVMBlueprintViewConversionFunction* Conversion = Binding()->Conversion.GetConversionFunction(bForward);
|
|
758
|
+
TSharedRef<FJsonObject> Arguments = Request.Arguments.IsValid() ? MakeShared<FJsonObject>(*Request.Arguments) : MakeShared<FJsonObject>();
|
|
759
|
+
|
|
760
|
+
if (Request.bHasDestination && !(Request.bHasConversion && bForward))
|
|
761
|
+
{
|
|
762
|
+
if (Conversion && !bForward)
|
|
763
|
+
{
|
|
764
|
+
if (!ArgumentsBindAPath(Request.Arguments))
|
|
765
|
+
{
|
|
766
|
+
const FString Input = FirstFreeInput(Conversion, Request.Arguments);
|
|
767
|
+
if (Input.IsEmpty())
|
|
768
|
+
{
|
|
769
|
+
OutError = TEXT("The conversion function has no free input to take destinationPath.");
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
TSharedPtr<FJsonObject> PathValue = MakeShared<FJsonObject>();
|
|
773
|
+
PathValue->SetStringField(TEXT("path"), Request.DestinationText);
|
|
774
|
+
Arguments->SetObjectField(Input, PathValue);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
else
|
|
778
|
+
{
|
|
779
|
+
Editor->SetDestinationPathForBinding(WidgetBlueprint, *Binding(), Request.Destination, false);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
if (Request.bHasSource && !(Request.bHasConversion && !bForward))
|
|
783
|
+
{
|
|
784
|
+
if (Conversion && bForward)
|
|
785
|
+
{
|
|
786
|
+
if (!ArgumentsBindAPath(Request.Arguments))
|
|
787
|
+
{
|
|
788
|
+
const FString Input = FirstFreeInput(Conversion, Request.Arguments);
|
|
789
|
+
if (Input.IsEmpty())
|
|
790
|
+
{
|
|
791
|
+
OutError = TEXT("The conversion function has no free input to take sourcePath.");
|
|
792
|
+
return false;
|
|
793
|
+
}
|
|
794
|
+
TSharedPtr<FJsonObject> PathValue = MakeShared<FJsonObject>();
|
|
795
|
+
PathValue->SetStringField(TEXT("path"), Request.SourceText);
|
|
796
|
+
Arguments->SetObjectField(Input, PathValue);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
else
|
|
800
|
+
{
|
|
801
|
+
Editor->SetSourcePathForBinding(WidgetBlueprint, *Binding(), Request.Source);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
if (Arguments->Values.Num() > 0)
|
|
806
|
+
{
|
|
807
|
+
if (!ApplyArguments(Editor, WidgetBlueprint, View, *Binding(), bForward, Arguments, OutError)) return false;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
if (Request.bHasExecutionMode)
|
|
811
|
+
{
|
|
812
|
+
if (Request.bResetExecutionMode) Editor->ResetExecutionModeForBinding(WidgetBlueprint, *Binding());
|
|
813
|
+
else Editor->OverrideExecutionModeForBinding(WidgetBlueprint, *Binding(), Request.ExecutionMode);
|
|
814
|
+
}
|
|
815
|
+
if (Request.bHasEnabled) Editor->SetEnabledForBinding(WidgetBlueprint, *Binding(), Request.bEnabled);
|
|
816
|
+
if (Request.bHasCompile) Editor->SetCompileForBinding(WidgetBlueprint, *Binding(), Request.bCompile);
|
|
817
|
+
return true;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
bool ParseBindingId(const TSharedPtr<FJsonObject>& Params, FGuid& OutId, FString& OutError)
|
|
821
|
+
{
|
|
822
|
+
const FString Text = OptionalString(Params, TEXT("bindingId"));
|
|
823
|
+
if (!FGuid::Parse(Text, OutId))
|
|
824
|
+
{
|
|
825
|
+
OutError = FString::Printf(TEXT("bindingId '%s' is not a binding id. widget(list_viewmodel_bindings) reports them."), *Text);
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
828
|
+
return true;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// ── Operations ───────────────────────────────────────────────────────────
|
|
832
|
+
|
|
833
|
+
class FBackend final : public IMCPMVVMBackend
|
|
834
|
+
{
|
|
835
|
+
public:
|
|
836
|
+
virtual FMCPMVVMOutcome Run(const FString& Operation, UWidgetBlueprint* WidgetBlueprint, const TSharedPtr<FJsonObject>& Params) override
|
|
837
|
+
{
|
|
838
|
+
UMVVMEditorSubsystem* Editor = Subsystem();
|
|
839
|
+
if (!Editor || !WidgetBlueprint)
|
|
840
|
+
{
|
|
841
|
+
return FMCPMVVMOutcome::Failure(TEXT("The viewmodel editor subsystem is not available in this editor session."));
|
|
842
|
+
}
|
|
843
|
+
if (Operation == TEXT("list_widget_viewmodels")) return ListViewModels(Editor, WidgetBlueprint);
|
|
844
|
+
if (Operation == TEXT("add_widget_viewmodel")) return AddViewModel(Editor, WidgetBlueprint, Params);
|
|
845
|
+
if (Operation == TEXT("remove_widget_viewmodel")) return RemoveViewModel(Editor, WidgetBlueprint, Params);
|
|
846
|
+
if (Operation == TEXT("list_widget_viewmodel_bindings")) return ListBindings(Editor, WidgetBlueprint);
|
|
847
|
+
if (Operation == TEXT("add_widget_viewmodel_binding")) return AddBinding(Editor, WidgetBlueprint, Params);
|
|
848
|
+
if (Operation == TEXT("update_widget_viewmodel_binding")) return UpdateBinding(Editor, WidgetBlueprint, Params);
|
|
849
|
+
if (Operation == TEXT("remove_widget_viewmodel_binding")) return RemoveBinding(Editor, WidgetBlueprint, Params);
|
|
850
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("The viewmodel backend has no operation '%s'."), *Operation));
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
private:
|
|
854
|
+
static FMCPMVVMOutcome ListViewModels(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint)
|
|
855
|
+
{
|
|
856
|
+
const UMVVMBlueprintView* View = Editor->GetView(WidgetBlueprint);
|
|
857
|
+
TArray<TSharedPtr<FJsonValue>> Rows;
|
|
858
|
+
if (View)
|
|
859
|
+
{
|
|
860
|
+
for (const FMVVMBlueprintViewModelContext& Context : View->GetViewModels())
|
|
861
|
+
{
|
|
862
|
+
Rows.Add(MakeShared<FJsonValueObject>(DescribeViewModel(View, Context)));
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
FMCPMVVMOutcome Out;
|
|
866
|
+
Out.Data = MakeShared<FJsonObject>();
|
|
867
|
+
Out.Data->SetBoolField(TEXT("hasView"), View != nullptr);
|
|
868
|
+
Out.Data->SetArrayField(TEXT("viewModels"), Rows);
|
|
869
|
+
Out.Data->SetNumberField(TEXT("count"), Rows.Num());
|
|
870
|
+
return Out;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
static FMCPMVVMOutcome AddViewModel(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, const TSharedPtr<FJsonObject>& Params)
|
|
874
|
+
{
|
|
875
|
+
const FString ClassPath = OptionalString(Params, TEXT("viewModelClass"));
|
|
876
|
+
UClass* Class = FindObject<UClass>(nullptr, *ClassPath);
|
|
877
|
+
if (!Class) Class = LoadObject<UClass>(nullptr, *ClassPath);
|
|
878
|
+
if (!Class)
|
|
879
|
+
{
|
|
880
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("No class at '%s'."), *ClassPath));
|
|
881
|
+
}
|
|
882
|
+
if (!Class->ImplementsInterface(UNotifyFieldValueChanged::StaticClass()))
|
|
883
|
+
{
|
|
884
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(
|
|
885
|
+
TEXT("%s cannot be a viewmodel: it does not implement INotifyFieldValueChanged. Derive the class from MVVMViewModelBase."), *Class->GetName()));
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
FString Name = OptionalString(Params, TEXT("viewModelName"));
|
|
889
|
+
if (Name.IsEmpty()) Name = UMVVMEditorSubsystem::GetDefaultViewModelName(Class);
|
|
890
|
+
|
|
891
|
+
UMVVMBlueprintView* View = Editor->RequestView(WidgetBlueprint);
|
|
892
|
+
if (!View)
|
|
893
|
+
{
|
|
894
|
+
return FMCPMVVMOutcome::Failure(TEXT("The widget blueprint has no viewmodel view and one could not be created."));
|
|
895
|
+
}
|
|
896
|
+
if (const FMVVMBlueprintViewModelContext* Existing = View->FindViewModel(FName(*Name)))
|
|
897
|
+
{
|
|
898
|
+
if (Existing->GetViewModelClass() != Class)
|
|
899
|
+
{
|
|
900
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(
|
|
901
|
+
TEXT("A viewmodel named '%s' already exists with class %s. Remove it first or pick another viewModelName."),
|
|
902
|
+
*Name, Existing->GetViewModelClass() ? *Existing->GetViewModelClass()->GetPathName() : TEXT("(none)")));
|
|
903
|
+
}
|
|
904
|
+
FMCPMVVMOutcome Out;
|
|
905
|
+
Out.Change = FMCPMVVMOutcome::EChange::Existed;
|
|
906
|
+
Out.Data = DescribeViewModel(View, *Existing);
|
|
907
|
+
return Out;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
FKismetNameValidator Validator(WidgetBlueprint);
|
|
911
|
+
const EValidatorResult Valid = Validator.IsValid(FName(*Name));
|
|
912
|
+
if (Valid != EValidatorResult::Ok)
|
|
913
|
+
{
|
|
914
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("viewModelName: %s"), *INameValidatorInterface::GetErrorText(Name, Valid).ToString()));
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
FMVVMBlueprintViewModelContext Context(Class, FName(*Name));
|
|
918
|
+
if (!Context.IsValid())
|
|
919
|
+
{
|
|
920
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("%s allows no viewmodel creation type, so it cannot be added."), *Class->GetName()));
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
const FString CreationText = OptionalString(Params, TEXT("creationType"));
|
|
924
|
+
if (!CreationText.IsEmpty())
|
|
925
|
+
{
|
|
926
|
+
EMVVMBlueprintViewModelContextCreationType CreationType;
|
|
927
|
+
if (!ParseEnum(CreationText, CreationType))
|
|
928
|
+
{
|
|
929
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("creationType '%s' is not one of %s on this engine."),
|
|
930
|
+
*CreationText, *EnumChoices<EMVVMBlueprintViewModelContextCreationType>()));
|
|
931
|
+
}
|
|
932
|
+
const TArray<EMVVMBlueprintViewModelContextCreationType> Allowed = UE::MVVM::GetAllowedContextCreationType(Class);
|
|
933
|
+
if (!Allowed.Contains(CreationType))
|
|
934
|
+
{
|
|
935
|
+
TArray<FString> AllowedNames;
|
|
936
|
+
for (const EMVVMBlueprintViewModelContextCreationType Type : Allowed) AllowedNames.Add(EnumName(Type));
|
|
937
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("%s does not allow creationType %s; it allows %s."),
|
|
938
|
+
*Class->GetName(), *EnumName(CreationType), *FString::Join(AllowedNames, TEXT(", "))));
|
|
939
|
+
}
|
|
940
|
+
Context.CreationType = CreationType;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
const FString GlobalIdentifier = OptionalString(Params, TEXT("globalViewModelIdentifier"));
|
|
944
|
+
const FString PropertyPath = OptionalString(Params, TEXT("viewModelPropertyPath"));
|
|
945
|
+
if (Context.CreationType == EMVVMBlueprintViewModelContextCreationType::GlobalViewModelCollection && GlobalIdentifier.IsEmpty())
|
|
946
|
+
{
|
|
947
|
+
return FMCPMVVMOutcome::Failure(TEXT("creationType GlobalViewModelCollection needs globalViewModelIdentifier."));
|
|
948
|
+
}
|
|
949
|
+
if (Context.CreationType == EMVVMBlueprintViewModelContextCreationType::PropertyPath && PropertyPath.IsEmpty())
|
|
950
|
+
{
|
|
951
|
+
return FMCPMVVMOutcome::Failure(TEXT("creationType PropertyPath needs viewModelPropertyPath."));
|
|
952
|
+
}
|
|
953
|
+
if (!GlobalIdentifier.IsEmpty()) Context.GlobalViewModelIdentifier = FName(*GlobalIdentifier);
|
|
954
|
+
Context.ViewModelPropertyPath = PropertyPath;
|
|
955
|
+
|
|
956
|
+
bool bFlag = false;
|
|
957
|
+
if (TryGetBoolParam(Params, TEXT("optional"), bFlag)) Context.bOptional = bFlag;
|
|
958
|
+
if (TryGetBoolParam(Params, TEXT("createSetter"), bFlag)) Context.bCreateSetterFunction = bFlag;
|
|
959
|
+
if (TryGetBoolParam(Params, TEXT("createGetter"), bFlag)) Context.bCreateGetterFunction = bFlag;
|
|
960
|
+
|
|
961
|
+
// The id is private to the context and has no setter. The rollback of
|
|
962
|
+
// remove_widget_viewmodel passes the id the removed viewmodel had, so
|
|
963
|
+
// the bindings that still name it resolve again.
|
|
964
|
+
const FString IdText = OptionalString(Params, TEXT("viewModelId"));
|
|
965
|
+
if (!IdText.IsEmpty())
|
|
966
|
+
{
|
|
967
|
+
FGuid Id;
|
|
968
|
+
if (!FGuid::Parse(IdText, Id))
|
|
969
|
+
{
|
|
970
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("viewModelId '%s' is not a GUID."), *IdText));
|
|
971
|
+
}
|
|
972
|
+
if (View->FindViewModel(Id))
|
|
973
|
+
{
|
|
974
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("viewModelId %s is already used by another viewmodel on this widget blueprint."), *IdText));
|
|
975
|
+
}
|
|
976
|
+
if (FStructProperty* IdProperty = FindFProperty<FStructProperty>(FMVVMBlueprintViewModelContext::StaticStruct(), TEXT("ViewModelContextId")))
|
|
977
|
+
{
|
|
978
|
+
*IdProperty->ContainerPtrToValuePtr<FGuid>(&Context) = Id;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
if (Context.CreationType == EMVVMBlueprintViewModelContextCreationType::Resolver)
|
|
983
|
+
{
|
|
984
|
+
#if UE_MCP_HAS_5_8_API
|
|
985
|
+
Context.Resolver = Context.CreateDefaultResolver(WidgetBlueprint);
|
|
986
|
+
#else
|
|
987
|
+
Context.Resolver = Context.CreateDefaultResolver(WidgetBlueprint->GetPackage());
|
|
988
|
+
#endif
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
View->Modify();
|
|
992
|
+
View->AddViewModel(Context);
|
|
993
|
+
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(WidgetBlueprint);
|
|
994
|
+
|
|
995
|
+
FMCPMVVMOutcome Out;
|
|
996
|
+
Out.Change = FMCPMVVMOutcome::EChange::Created;
|
|
997
|
+
Out.bModified = true;
|
|
998
|
+
const FMVVMBlueprintViewModelContext* Added = View->FindViewModel(Context.GetViewModelId());
|
|
999
|
+
Out.Data = DescribeViewModel(View, Added ? *Added : Context);
|
|
1000
|
+
Out.RollbackMethod = TEXT("remove_widget_viewmodel");
|
|
1001
|
+
Out.RollbackPayload = MakeShared<FJsonObject>();
|
|
1002
|
+
Out.RollbackPayload->SetStringField(TEXT("viewModelName"), Name);
|
|
1003
|
+
return Out;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
static FMCPMVVMOutcome RemoveViewModel(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, const TSharedPtr<FJsonObject>& Params)
|
|
1007
|
+
{
|
|
1008
|
+
const FString Name = OptionalString(Params, TEXT("viewModelName"));
|
|
1009
|
+
UMVVMBlueprintView* View = Editor->GetView(WidgetBlueprint);
|
|
1010
|
+
const FMVVMBlueprintViewModelContext* Context = View ? View->FindViewModel(FName(*Name)) : nullptr;
|
|
1011
|
+
if (!Context)
|
|
1012
|
+
{
|
|
1013
|
+
FMCPMVVMOutcome Out;
|
|
1014
|
+
Out.Change = FMCPMVVMOutcome::EChange::AlreadyDeleted;
|
|
1015
|
+
Out.Data = MakeShared<FJsonObject>();
|
|
1016
|
+
Out.Data->SetStringField(TEXT("viewModelName"), Name);
|
|
1017
|
+
return Out;
|
|
1018
|
+
}
|
|
1019
|
+
if (!Context->bCanRemove)
|
|
1020
|
+
{
|
|
1021
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("Viewmodel '%s' is marked as not removable."), *Name));
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
const FMVVMBlueprintViewModelContext Removed = *Context;
|
|
1025
|
+
TArray<TSharedPtr<FJsonValue>> Dependent;
|
|
1026
|
+
for (const FMVVMBlueprintViewBinding& Binding : View->GetBindings())
|
|
1027
|
+
{
|
|
1028
|
+
if (Binding.SourcePath.GetViewModelId() == Removed.GetViewModelId() || Binding.DestinationPath.GetViewModelId() == Removed.GetViewModelId())
|
|
1029
|
+
{
|
|
1030
|
+
Dependent.Add(MakeShared<FJsonValueString>(Binding.BindingId.ToString(EGuidFormats::DigitsWithHyphens)));
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
TSharedPtr<FJsonObject> Restore = MakeShared<FJsonObject>();
|
|
1035
|
+
Restore->SetStringField(TEXT("viewModelClass"), Removed.GetViewModelClass() ? Removed.GetViewModelClass()->GetPathName() : FString());
|
|
1036
|
+
Restore->SetStringField(TEXT("viewModelName"), Removed.GetViewModelName().ToString());
|
|
1037
|
+
Restore->SetStringField(TEXT("creationType"), EnumName(Removed.CreationType));
|
|
1038
|
+
if (!Removed.GlobalViewModelIdentifier.IsNone()) Restore->SetStringField(TEXT("globalViewModelIdentifier"), Removed.GlobalViewModelIdentifier.ToString());
|
|
1039
|
+
if (!Removed.ViewModelPropertyPath.IsEmpty()) Restore->SetStringField(TEXT("viewModelPropertyPath"), Removed.ViewModelPropertyPath);
|
|
1040
|
+
Restore->SetBoolField(TEXT("optional"), Removed.bOptional);
|
|
1041
|
+
Restore->SetBoolField(TEXT("createSetter"), Removed.bCreateSetterFunction);
|
|
1042
|
+
Restore->SetBoolField(TEXT("createGetter"), Removed.bCreateGetterFunction);
|
|
1043
|
+
Restore->SetStringField(TEXT("viewModelId"), Removed.GetViewModelId().ToString(EGuidFormats::DigitsWithHyphens));
|
|
1044
|
+
|
|
1045
|
+
View->Modify();
|
|
1046
|
+
View->RemoveViewModel(Removed.GetViewModelId());
|
|
1047
|
+
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(WidgetBlueprint);
|
|
1048
|
+
|
|
1049
|
+
FMCPMVVMOutcome Out;
|
|
1050
|
+
Out.Change = FMCPMVVMOutcome::EChange::Deleted;
|
|
1051
|
+
Out.bModified = true;
|
|
1052
|
+
Out.Data = MakeShared<FJsonObject>();
|
|
1053
|
+
Out.Data->SetStringField(TEXT("viewModelName"), Name);
|
|
1054
|
+
Out.Data->SetArrayField(TEXT("bindingsLeftDangling"), Dependent);
|
|
1055
|
+
Out.RollbackMethod = TEXT("add_widget_viewmodel");
|
|
1056
|
+
Out.RollbackPayload = Restore;
|
|
1057
|
+
return Out;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
static FMCPMVVMOutcome ListBindings(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint)
|
|
1061
|
+
{
|
|
1062
|
+
const UMVVMBlueprintView* View = Editor->GetView(WidgetBlueprint);
|
|
1063
|
+
TArray<TSharedPtr<FJsonValue>> Rows;
|
|
1064
|
+
if (View)
|
|
1065
|
+
{
|
|
1066
|
+
for (const FMVVMBlueprintViewBinding& Binding : View->GetBindings())
|
|
1067
|
+
{
|
|
1068
|
+
Rows.Add(MakeShared<FJsonValueObject>(DescribeBinding(WidgetBlueprint, View, Binding)));
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
FMCPMVVMOutcome Out;
|
|
1072
|
+
Out.Data = MakeShared<FJsonObject>();
|
|
1073
|
+
Out.Data->SetBoolField(TEXT("hasView"), View != nullptr);
|
|
1074
|
+
Out.Data->SetArrayField(TEXT("bindings"), Rows);
|
|
1075
|
+
Out.Data->SetNumberField(TEXT("count"), Rows.Num());
|
|
1076
|
+
return Out;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
static FMCPMVVMOutcome AddBinding(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, const TSharedPtr<FJsonObject>& Params)
|
|
1080
|
+
{
|
|
1081
|
+
UMVVMBlueprintView* View = Editor->GetView(WidgetBlueprint);
|
|
1082
|
+
FBindingRequest Request;
|
|
1083
|
+
FString Error;
|
|
1084
|
+
if (!ReadBindingRequest(WidgetBlueprint, View, Params, Request, Error))
|
|
1085
|
+
{
|
|
1086
|
+
return FMCPMVVMOutcome::Failure(Error);
|
|
1087
|
+
}
|
|
1088
|
+
if (!Request.bHasDestination && !(Request.bHasConversion && Request.Conversion && Request.bHasDirection && !Request.bSourceToDestination))
|
|
1089
|
+
{
|
|
1090
|
+
return FMCPMVVMOutcome::Failure(TEXT("destinationPath is required, e.g. HealthBar.Percent."));
|
|
1091
|
+
}
|
|
1092
|
+
if (!Request.bHasSource && !(Request.Conversion && ArgumentsBindAPath(Request.Arguments)))
|
|
1093
|
+
{
|
|
1094
|
+
return FMCPMVVMOutcome::Failure(TEXT("sourcePath is required, unless conversionFunction is given and conversionArguments bind an input to a {path}."));
|
|
1095
|
+
}
|
|
1096
|
+
if (!Request.bHasMode)
|
|
1097
|
+
{
|
|
1098
|
+
Request.bHasMode = true;
|
|
1099
|
+
Request.Mode = EMVVMBindingMode::OneWayToDestination;
|
|
1100
|
+
}
|
|
1101
|
+
if (!Request.bHasDirection)
|
|
1102
|
+
{
|
|
1103
|
+
Request.bSourceToDestination = Request.Mode != EMVVMBindingMode::OneWayToSource && Request.Mode != EMVVMBindingMode::OneTimeToSource;
|
|
1104
|
+
Request.bHasDirection = Request.Conversion != nullptr;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// The same binding asked for twice is reported, not added twice: same
|
|
1108
|
+
// destination, mode, source (or conversion function) and direction.
|
|
1109
|
+
if (View)
|
|
1110
|
+
{
|
|
1111
|
+
for (const FMVVMBlueprintViewBinding& Existing : View->GetBindings())
|
|
1112
|
+
{
|
|
1113
|
+
if (Existing.BindingType != Request.Mode) continue;
|
|
1114
|
+
const FConversionSide Side = ConversionOf(Existing);
|
|
1115
|
+
bool bSame = false;
|
|
1116
|
+
if (Request.Conversion)
|
|
1117
|
+
{
|
|
1118
|
+
bSame = Side.Function && Side.bSourceToDestination == Request.bSourceToDestination
|
|
1119
|
+
&& Side.Function->GetConversionFunction().GetFunction(WidgetBlueprint) == Request.Conversion
|
|
1120
|
+
&& (Request.bSourceToDestination ? Existing.DestinationPath == Request.Destination : Existing.SourcePath == Request.Source);
|
|
1121
|
+
}
|
|
1122
|
+
else
|
|
1123
|
+
{
|
|
1124
|
+
bSame = !Side.Function && Existing.SourcePath == Request.Source && Existing.DestinationPath == Request.Destination;
|
|
1125
|
+
}
|
|
1126
|
+
if (bSame)
|
|
1127
|
+
{
|
|
1128
|
+
FMCPMVVMOutcome Out;
|
|
1129
|
+
Out.Change = FMCPMVVMOutcome::EChange::Existed;
|
|
1130
|
+
Out.Data = DescribeBinding(WidgetBlueprint, View, Existing);
|
|
1131
|
+
return Out;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
const FGuid BindingId = Editor->AddBinding(WidgetBlueprint).BindingId;
|
|
1137
|
+
View = Editor->GetView(WidgetBlueprint);
|
|
1138
|
+
if (!View || !View->GetBinding(BindingId))
|
|
1139
|
+
{
|
|
1140
|
+
return FMCPMVVMOutcome::Failure(TEXT("The viewmodel editor did not add a binding."));
|
|
1141
|
+
}
|
|
1142
|
+
if (!ApplyBindingRequest(Editor, WidgetBlueprint, View, BindingId, Request, Error))
|
|
1143
|
+
{
|
|
1144
|
+
// Nothing half-made is left behind.
|
|
1145
|
+
if (FMVVMBlueprintViewBinding* Partial = View->GetBinding(BindingId))
|
|
1146
|
+
{
|
|
1147
|
+
Editor->RemoveBinding(WidgetBlueprint, *Partial);
|
|
1148
|
+
}
|
|
1149
|
+
return FMCPMVVMOutcome::Failure(Error);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
FMCPMVVMOutcome Out;
|
|
1153
|
+
Out.Change = FMCPMVVMOutcome::EChange::Created;
|
|
1154
|
+
Out.bModified = true;
|
|
1155
|
+
Out.Data = DescribeBinding(WidgetBlueprint, View, *View->GetBinding(BindingId));
|
|
1156
|
+
Out.RollbackMethod = TEXT("remove_widget_viewmodel_binding");
|
|
1157
|
+
Out.RollbackPayload = MakeShared<FJsonObject>();
|
|
1158
|
+
Out.RollbackPayload->SetStringField(TEXT("bindingId"), BindingId.ToString(EGuidFormats::DigitsWithHyphens));
|
|
1159
|
+
return Out;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
static FMCPMVVMOutcome UpdateBinding(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, const TSharedPtr<FJsonObject>& Params)
|
|
1163
|
+
{
|
|
1164
|
+
FGuid BindingId;
|
|
1165
|
+
FString Error;
|
|
1166
|
+
if (!ParseBindingId(Params, BindingId, Error)) return FMCPMVVMOutcome::Failure(Error);
|
|
1167
|
+
UMVVMBlueprintView* View = Editor->GetView(WidgetBlueprint);
|
|
1168
|
+
const FMVVMBlueprintViewBinding* Binding = View ? View->GetBinding(BindingId) : nullptr;
|
|
1169
|
+
if (!Binding)
|
|
1170
|
+
{
|
|
1171
|
+
return FMCPMVVMOutcome::Failure(FString::Printf(TEXT("No binding %s on this widget blueprint."), *BindingId.ToString(EGuidFormats::DigitsWithHyphens)));
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
FBindingRequest Request;
|
|
1175
|
+
if (!ReadBindingRequest(WidgetBlueprint, View, Params, Request, Error))
|
|
1176
|
+
{
|
|
1177
|
+
return FMCPMVVMOutcome::Failure(Error);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
const TSharedPtr<FJsonObject> Before = BindingToAddParams(WidgetBlueprint, View, *Binding);
|
|
1181
|
+
if (!ApplyBindingRequest(Editor, WidgetBlueprint, View, BindingId, Request, Error))
|
|
1182
|
+
{
|
|
1183
|
+
// What landed before the failure is described, and the rollback puts the binding back.
|
|
1184
|
+
FMCPMVVMOutcome Out = FMCPMVVMOutcome::Failure(Error);
|
|
1185
|
+
Out.RollbackMethod = TEXT("update_widget_viewmodel_binding");
|
|
1186
|
+
Out.RollbackPayload = RestorePayload(BindingId, Before);
|
|
1187
|
+
Out.bModified = true;
|
|
1188
|
+
return Out;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
const FMVVMBlueprintViewBinding* After = View->GetBinding(BindingId);
|
|
1192
|
+
FMCPMVVMOutcome Out;
|
|
1193
|
+
Out.Data = MakeShared<FJsonObject>();
|
|
1194
|
+
if (After) Out.Data = DescribeBinding(WidgetBlueprint, View, *After);
|
|
1195
|
+
if (After && SameJson(BindingToAddParams(WidgetBlueprint, View, *After), Before))
|
|
1196
|
+
{
|
|
1197
|
+
Out.Change = FMCPMVVMOutcome::EChange::Existed;
|
|
1198
|
+
return Out;
|
|
1199
|
+
}
|
|
1200
|
+
Out.Change = FMCPMVVMOutcome::EChange::Updated;
|
|
1201
|
+
Out.bModified = true;
|
|
1202
|
+
Out.Data->SetObjectField(TEXT("previous"), Before);
|
|
1203
|
+
Out.RollbackMethod = TEXT("update_widget_viewmodel_binding");
|
|
1204
|
+
Out.RollbackPayload = RestorePayload(BindingId, Before);
|
|
1205
|
+
return Out;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/** update_widget_viewmodel_binding parameters that put a binding back as Before described it. */
|
|
1209
|
+
static TSharedPtr<FJsonObject> RestorePayload(const FGuid& BindingId, const TSharedPtr<FJsonObject>& Before)
|
|
1210
|
+
{
|
|
1211
|
+
TSharedPtr<FJsonObject> Payload = MakeShared<FJsonObject>(*Before);
|
|
1212
|
+
Payload->SetStringField(TEXT("bindingId"), BindingId.ToString(EGuidFormats::DigitsWithHyphens));
|
|
1213
|
+
if (!Payload->HasField(TEXT("conversionFunction")))
|
|
1214
|
+
{
|
|
1215
|
+
// No conversion before: clear any the update set.
|
|
1216
|
+
Payload->SetStringField(TEXT("conversionFunction"), FString());
|
|
1217
|
+
}
|
|
1218
|
+
return Payload;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
static FMCPMVVMOutcome RemoveBinding(UMVVMEditorSubsystem* Editor, UWidgetBlueprint* WidgetBlueprint, const TSharedPtr<FJsonObject>& Params)
|
|
1222
|
+
{
|
|
1223
|
+
FGuid BindingId;
|
|
1224
|
+
FString Error;
|
|
1225
|
+
if (!ParseBindingId(Params, BindingId, Error)) return FMCPMVVMOutcome::Failure(Error);
|
|
1226
|
+
UMVVMBlueprintView* View = Editor->GetView(WidgetBlueprint);
|
|
1227
|
+
FMVVMBlueprintViewBinding* Binding = View ? View->GetBinding(BindingId) : nullptr;
|
|
1228
|
+
if (!Binding)
|
|
1229
|
+
{
|
|
1230
|
+
FMCPMVVMOutcome Out;
|
|
1231
|
+
Out.Change = FMCPMVVMOutcome::EChange::AlreadyDeleted;
|
|
1232
|
+
Out.Data = MakeShared<FJsonObject>();
|
|
1233
|
+
Out.Data->SetStringField(TEXT("bindingId"), BindingId.ToString(EGuidFormats::DigitsWithHyphens));
|
|
1234
|
+
return Out;
|
|
1235
|
+
}
|
|
1236
|
+
const TSharedPtr<FJsonObject> Restore = BindingToAddParams(WidgetBlueprint, View, *Binding);
|
|
1237
|
+
const TSharedPtr<FJsonObject> Described = DescribeBinding(WidgetBlueprint, View, *Binding);
|
|
1238
|
+
Editor->RemoveBinding(WidgetBlueprint, *Binding);
|
|
1239
|
+
FBlueprintEditorUtils::MarkBlueprintAsModified(WidgetBlueprint);
|
|
1240
|
+
|
|
1241
|
+
FMCPMVVMOutcome Out;
|
|
1242
|
+
Out.Change = FMCPMVVMOutcome::EChange::Deleted;
|
|
1243
|
+
Out.bModified = true;
|
|
1244
|
+
Out.Data = Described;
|
|
1245
|
+
Out.RollbackMethod = TEXT("add_widget_viewmodel_binding");
|
|
1246
|
+
Out.RollbackPayload = Restore;
|
|
1247
|
+
return Out;
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
#endif // WITH_UEMCP_MVVM
|
|
1252
|
+
|
|
1253
|
+
class FUE_MCP_BridgeMVVMModule : public IModuleInterface
|
|
1254
|
+
{
|
|
1255
|
+
public:
|
|
1256
|
+
virtual void StartupModule() override
|
|
1257
|
+
{
|
|
1258
|
+
#if WITH_UEMCP_MVVM
|
|
1259
|
+
Backend = MakeUnique<UEMCPMVVM::FBackend>();
|
|
1260
|
+
UEMCP::SetMVVMBackend(Backend.Get());
|
|
1261
|
+
#endif
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
virtual void ShutdownModule() override
|
|
1265
|
+
{
|
|
1266
|
+
if (Backend.IsValid() && UEMCP::GetMVVMBackend() == Backend.Get())
|
|
1267
|
+
{
|
|
1268
|
+
UEMCP::SetMVVMBackend(nullptr);
|
|
1269
|
+
}
|
|
1270
|
+
Backend.Reset();
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
private:
|
|
1274
|
+
TUniquePtr<IMCPMVVMBackend> Backend;
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
IMPLEMENT_MODULE(FUE_MCP_BridgeMVVMModule, UE_MCP_BridgeMVVM)
|