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
package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_PerfAudit.cpp
ADDED
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
// level(audit_performance): one read-only pass over the loaded level, or a box
|
|
2
|
+
// of it, that names the usual scene-side causes of a slow frame.
|
|
3
|
+
//
|
|
4
|
+
// level(summarize_static_mesh_usage) answers "which meshes are placed and how
|
|
5
|
+
// often" and level(query_components) answers per-component questions with
|
|
6
|
+
// predicates. Neither ranks anything by cost, and the questions a performance
|
|
7
|
+
// pass starts with are rankings: where the triangles are, which meshes should
|
|
8
|
+
// be instanced, which shadow casters cost most, where shadowed lights pile up,
|
|
9
|
+
// which surfaces have texel or lightmap density far off the rest of the level,
|
|
10
|
+
// which heavy meshes are not Nanite, and which translucent surfaces are large
|
|
11
|
+
// or stacked. This computes all of them in one game-thread scan and returns
|
|
12
|
+
// bounded, ranked lists with their totals.
|
|
13
|
+
//
|
|
14
|
+
// It never writes: no Modify, no MarkPackageDirty, no property assignment.
|
|
15
|
+
//
|
|
16
|
+
// The figures are static estimates from asset and component data, not
|
|
17
|
+
// measurements: triangle counts are LOD0 (for a Nanite mesh, its fallback
|
|
18
|
+
// mesh), texel density is the mesh's own UV density at the component's scale
|
|
19
|
+
// against the largest texture its material samples, and overlap is computed
|
|
20
|
+
// from attenuation spheres and bounds. The result says so, and a trace read
|
|
21
|
+
// with editor(analyze_trace) is what confirms a suspicion.
|
|
22
|
+
//
|
|
23
|
+
// Helpers are prefixed MCPPerfAudit for the unity build.
|
|
24
|
+
|
|
25
|
+
#include "LevelHandlers.h"
|
|
26
|
+
|
|
27
|
+
#include "HandlerUtils.h"
|
|
28
|
+
|
|
29
|
+
#include "Components/InstancedStaticMeshComponent.h"
|
|
30
|
+
#include "Components/LightComponent.h"
|
|
31
|
+
#include "Components/LocalLightComponent.h"
|
|
32
|
+
#include "Components/PrimitiveComponent.h"
|
|
33
|
+
#include "Components/SkeletalMeshComponent.h"
|
|
34
|
+
#include "Components/StaticMeshComponent.h"
|
|
35
|
+
#include "Engine/SkeletalMesh.h"
|
|
36
|
+
#include "Engine/StaticMesh.h"
|
|
37
|
+
#include "Engine/Texture.h"
|
|
38
|
+
#include "Engine/World.h"
|
|
39
|
+
#include "EngineUtils.h"
|
|
40
|
+
#include "GameFramework/Actor.h"
|
|
41
|
+
#include "GameFramework/WorldSettings.h"
|
|
42
|
+
#include "HAL/IConsoleManager.h"
|
|
43
|
+
#include "Materials/MaterialInterface.h"
|
|
44
|
+
#include "MeshUVChannelInfo.h"
|
|
45
|
+
#include "Rendering/SkeletalMeshLODRenderData.h"
|
|
46
|
+
#include "Rendering/SkeletalMeshRenderData.h"
|
|
47
|
+
|
|
48
|
+
#include "Dom/JsonObject.h"
|
|
49
|
+
#include "Dom/JsonValue.h"
|
|
50
|
+
|
|
51
|
+
namespace
|
|
52
|
+
{
|
|
53
|
+
constexpr int32 MCPPerfAuditDefaultResults = 20;
|
|
54
|
+
constexpr int32 MCPPerfAuditMaxResults = 200;
|
|
55
|
+
constexpr int32 MCPPerfAuditDumpCap = 5000;
|
|
56
|
+
constexpr int32 MCPPerfAuditMaxCells = 100000;
|
|
57
|
+
constexpr int32 MCPPerfAuditMaxTranslucentPairs = 4000;
|
|
58
|
+
/** The engine assigns stationary lights to four shadow channels, so at most
|
|
59
|
+
* four shadowed stationary lights can overlap any point. */
|
|
60
|
+
constexpr int32 MCPPerfAuditStationaryChannelLimit = 4;
|
|
61
|
+
|
|
62
|
+
const TCHAR* MCPPerfAuditMobility(EComponentMobility::Type Mobility)
|
|
63
|
+
{
|
|
64
|
+
switch (Mobility)
|
|
65
|
+
{
|
|
66
|
+
case EComponentMobility::Static: return TEXT("Static");
|
|
67
|
+
case EComponentMobility::Stationary: return TEXT("Stationary");
|
|
68
|
+
case EComponentMobility::Movable: return TEXT("Movable");
|
|
69
|
+
default: return TEXT("Unknown");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
bool MCPPerfAuditIsTranslucent(const UMaterialInterface* Material)
|
|
74
|
+
{
|
|
75
|
+
if (!Material) return false;
|
|
76
|
+
const EBlendMode Blend = Material->GetBlendMode();
|
|
77
|
+
// The engine's own definition: anything that is neither opaque nor masked.
|
|
78
|
+
return Blend != BLEND_Opaque && Blend != BLEND_Masked;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Largest texture dimension the material samples, or 0 when it samples none. */
|
|
82
|
+
float MCPPerfAuditLargestTexture(UMaterialInterface* Material, ERHIFeatureLevel::Type FeatureLevel, TMap<UMaterialInterface*, float>& Cache)
|
|
83
|
+
{
|
|
84
|
+
if (!Material) return 0.0f;
|
|
85
|
+
if (const float* Found = Cache.Find(Material)) return *Found;
|
|
86
|
+
TArray<UTexture*> Used;
|
|
87
|
+
#if UE_MCP_HAS_5_7_API
|
|
88
|
+
Material->GetUsedTextures(Used);
|
|
89
|
+
#else
|
|
90
|
+
Material->GetUsedTextures(Used, EMaterialQualityLevel::High, true, FeatureLevel, true);
|
|
91
|
+
#endif
|
|
92
|
+
float Largest = 0.0f;
|
|
93
|
+
for (UTexture* Texture : Used)
|
|
94
|
+
{
|
|
95
|
+
if (!Texture) continue;
|
|
96
|
+
Largest = FMath::Max(Largest, FMath::Max(Texture->GetSurfaceWidth(), Texture->GetSurfaceHeight()));
|
|
97
|
+
}
|
|
98
|
+
Cache.Add(Material, Largest);
|
|
99
|
+
return Largest;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
int64 MCPPerfAuditSkeletalTriangles(USkeletalMeshComponent* Component)
|
|
103
|
+
{
|
|
104
|
+
USkeletalMesh* Mesh = Component ? Component->GetSkeletalMeshAsset() : nullptr;
|
|
105
|
+
FSkeletalMeshRenderData* RenderData = Mesh ? Mesh->GetResourceForRendering() : nullptr;
|
|
106
|
+
if (!RenderData || RenderData->LODRenderData.Num() == 0) return 0;
|
|
107
|
+
return RenderData->LODRenderData[0].GetTotalFaces();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
struct FMCPPerfAuditCell
|
|
111
|
+
{
|
|
112
|
+
int32 X = 0;
|
|
113
|
+
int32 Y = 0;
|
|
114
|
+
int64 Triangles = 0;
|
|
115
|
+
int32 Primitives = 0;
|
|
116
|
+
int32 ShadowCasters = 0;
|
|
117
|
+
int32 ShadowedLights = 0;
|
|
118
|
+
int32 TranslucentPrimitives = 0;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
struct FMCPPerfAuditMesh
|
|
122
|
+
{
|
|
123
|
+
FString Path;
|
|
124
|
+
FString Kind;
|
|
125
|
+
int64 Lod0Triangles = 0;
|
|
126
|
+
int64 Placements = 0;
|
|
127
|
+
int32 Components = 0;
|
|
128
|
+
int32 Actors = 0;
|
|
129
|
+
bool bNanite = false;
|
|
130
|
+
FString LastActor;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
struct FMCPPerfAuditInstancing
|
|
134
|
+
{
|
|
135
|
+
FString Path;
|
|
136
|
+
int32 Components = 0;
|
|
137
|
+
int32 Actors = 0;
|
|
138
|
+
int32 Sections = 0;
|
|
139
|
+
int32 Movable = 0;
|
|
140
|
+
int64 Lod0Triangles = 0;
|
|
141
|
+
FString LastActor;
|
|
142
|
+
TArray<FString> SampleActors;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
struct FMCPPerfAuditPrimRow
|
|
146
|
+
{
|
|
147
|
+
FString ActorLabel;
|
|
148
|
+
FString ActorPath;
|
|
149
|
+
FString Component;
|
|
150
|
+
FString Mesh;
|
|
151
|
+
FString Mobility;
|
|
152
|
+
int64 Triangles = 0;
|
|
153
|
+
double Value = 0.0;
|
|
154
|
+
double Ratio = 0.0;
|
|
155
|
+
double SizeM = 0.0;
|
|
156
|
+
double AreaM2 = 0.0;
|
|
157
|
+
int32 Overlaps = 0;
|
|
158
|
+
int32 Extra = 0;
|
|
159
|
+
FBox Box = FBox(ForceInit);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
struct FMCPPerfAuditLight
|
|
163
|
+
{
|
|
164
|
+
FString ActorLabel;
|
|
165
|
+
FString ActorPath;
|
|
166
|
+
FString Component;
|
|
167
|
+
FString Type;
|
|
168
|
+
FString Mobility;
|
|
169
|
+
FVector Location = FVector::ZeroVector;
|
|
170
|
+
double Radius = 0.0;
|
|
171
|
+
int32 Overlaps = 0;
|
|
172
|
+
bool bStationary = false;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
TSharedPtr<FJsonObject> MCPPerfAuditPrimJson(const FMCPPerfAuditPrimRow& Row)
|
|
176
|
+
{
|
|
177
|
+
TSharedPtr<FJsonObject> Obj = MakeShared<FJsonObject>();
|
|
178
|
+
Obj->SetStringField(TEXT("actorLabel"), Row.ActorLabel);
|
|
179
|
+
Obj->SetStringField(TEXT("actorPath"), Row.ActorPath);
|
|
180
|
+
Obj->SetStringField(TEXT("component"), Row.Component);
|
|
181
|
+
if (!Row.Mesh.IsEmpty()) Obj->SetStringField(TEXT("mesh"), Row.Mesh);
|
|
182
|
+
Obj->SetStringField(TEXT("mobility"), Row.Mobility);
|
|
183
|
+
return Obj;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
double MCPPerfAuditMedian(TArray<double> Values)
|
|
187
|
+
{
|
|
188
|
+
if (Values.Num() == 0) return 0.0;
|
|
189
|
+
Values.Sort();
|
|
190
|
+
const int32 Mid = Values.Num() / 2;
|
|
191
|
+
return (Values.Num() % 2 == 1) ? Values[Mid] : 0.5 * (Values[Mid - 1] + Values[Mid]);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Rows whose Value is at least Factor times the median, or at most
|
|
195
|
+
* 1/Factor of it. Ratio is filled in and the rows come back sorted by how
|
|
196
|
+
* far off they are, either way. */
|
|
197
|
+
TArray<FMCPPerfAuditPrimRow> MCPPerfAuditOutliers(const TArray<FMCPPerfAuditPrimRow>& Rows, double Factor, double& OutMedian)
|
|
198
|
+
{
|
|
199
|
+
TArray<double> Values;
|
|
200
|
+
for (const FMCPPerfAuditPrimRow& Row : Rows) Values.Add(Row.Value);
|
|
201
|
+
OutMedian = MCPPerfAuditMedian(Values);
|
|
202
|
+
TArray<FMCPPerfAuditPrimRow> Out;
|
|
203
|
+
if (OutMedian <= 0.0) return Out;
|
|
204
|
+
for (const FMCPPerfAuditPrimRow& Row : Rows)
|
|
205
|
+
{
|
|
206
|
+
const double Ratio = Row.Value / OutMedian;
|
|
207
|
+
if (Ratio >= Factor || (Ratio > 0.0 && Ratio <= 1.0 / Factor))
|
|
208
|
+
{
|
|
209
|
+
FMCPPerfAuditPrimRow Copy = Row;
|
|
210
|
+
Copy.Ratio = Ratio;
|
|
211
|
+
Out.Add(Copy);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
Out.Sort([](const FMCPPerfAuditPrimRow& A, const FMCPPerfAuditPrimRow& B)
|
|
215
|
+
{
|
|
216
|
+
const double DA = FMath::Abs(FMath::Loge(FMath::Max(A.Ratio, 1e-9)));
|
|
217
|
+
const double DB = FMath::Abs(FMath::Loge(FMath::Max(B.Ratio, 1e-9)));
|
|
218
|
+
return DA > DB;
|
|
219
|
+
});
|
|
220
|
+
return Out;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
bool MCPPerfAuditCellIntersectsSphere(int32 CX, int32 CY, double Grid, const FVector& Center, double Radius)
|
|
224
|
+
{
|
|
225
|
+
const double MinX = CX * Grid;
|
|
226
|
+
const double MinY = CY * Grid;
|
|
227
|
+
const double DX = FMath::Max(0.0, FMath::Max(MinX - Center.X, Center.X - (MinX + Grid)));
|
|
228
|
+
const double DY = FMath::Max(0.0, FMath::Max(MinY - Center.Y, Center.Y - (MinY + Grid)));
|
|
229
|
+
return DX * DX + DY * DY <= Radius * Radius;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
// audit_level_performance -- ranked scene-cost estimates for the loaded level.
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
TSharedPtr<FJsonValue> FLevelHandlers::AuditLevelPerformance(const TSharedPtr<FJsonObject>& Params)
|
|
237
|
+
{
|
|
238
|
+
check(IsInGameThread());
|
|
239
|
+
MCPReadParamsAhead(Params, { TEXT("regionMin"), TEXT("regionMax"), TEXT("world"), TEXT("pieInstance"), TEXT("maxResults") });
|
|
240
|
+
|
|
241
|
+
const FString RequestedWorld = OptionalString(Params, TEXT("world"), TEXT("editor"));
|
|
242
|
+
if (!RequestedWorld.Equals(TEXT("editor"), ESearchCase::IgnoreCase) && !RequestedWorld.Equals(TEXT("pie"), ESearchCase::IgnoreCase))
|
|
243
|
+
{
|
|
244
|
+
return MCPError(TEXT("Invalid 'world': expected 'editor' or 'pie'"));
|
|
245
|
+
}
|
|
246
|
+
const FString WorldScope = RequestedWorld.ToLower();
|
|
247
|
+
UWorld* World = ResolveWorldFromParams(Params, *WorldScope);
|
|
248
|
+
if (!World)
|
|
249
|
+
{
|
|
250
|
+
return MCPError(FString::Printf(TEXT("World not available for scope '%s'"), *WorldScope));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const bool bHasMin = HasParam(Params, TEXT("regionMin"));
|
|
254
|
+
const bool bHasMax = HasParam(Params, TEXT("regionMax"));
|
|
255
|
+
if (bHasMin != bHasMax)
|
|
256
|
+
{
|
|
257
|
+
return MCPError(TEXT("Pass both regionMin and regionMax to audit a box, or neither to audit the whole loaded level."));
|
|
258
|
+
}
|
|
259
|
+
FBox Region(ForceInit);
|
|
260
|
+
if (bHasMin)
|
|
261
|
+
{
|
|
262
|
+
FVector Min, Max;
|
|
263
|
+
if (auto Err = RequireVec3(Params, TEXT("regionMin"), Min)) return Err;
|
|
264
|
+
if (auto Err = RequireVec3(Params, TEXT("regionMax"), Max)) return Err;
|
|
265
|
+
if (Min.X > Max.X || Min.Y > Max.Y || Min.Z > Max.Z)
|
|
266
|
+
{
|
|
267
|
+
return MCPError(TEXT("regionMax must be at least regionMin on every axis."));
|
|
268
|
+
}
|
|
269
|
+
Region = FBox(Min, Max);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const double Grid = FMath::Max(100.0, OptionalNumber(Params, TEXT("gridSize"), 5000.0));
|
|
273
|
+
const bool bDump = OptionalBool(Params, TEXT("dumpToFile"), false);
|
|
274
|
+
const FString OutputPath = OptionalString(Params, TEXT("outputPath"));
|
|
275
|
+
const int32 MaxResults = bDump
|
|
276
|
+
? MCPPerfAuditDumpCap
|
|
277
|
+
: FMath::Clamp(OptionalInt(Params, TEXT("maxResults"), MCPPerfAuditDefaultResults), 1, MCPPerfAuditMaxResults);
|
|
278
|
+
const int32 InstancingMin = FMath::Max(2, OptionalInt(Params, TEXT("instancingMinCount"), 10));
|
|
279
|
+
const int64 HeavyTriangles = FMath::Max<int64>(1, static_cast<int64>(OptionalNumber(Params, TEXT("heavyTriangleThreshold"), 50000.0)));
|
|
280
|
+
const double OutlierFactor = FMath::Max(1.5, OptionalNumber(Params, TEXT("outlierFactor"), 4.0));
|
|
281
|
+
const double TranslucentAreaM2 = FMath::Max(0.01, OptionalNumber(Params, TEXT("translucentAreaM2"), 100.0));
|
|
282
|
+
const int32 StackedTranslucent = FMath::Max(2, OptionalInt(Params, TEXT("stackedTranslucentCount"), 3));
|
|
283
|
+
if (!OutputPath.IsEmpty() && !bDump)
|
|
284
|
+
{
|
|
285
|
+
return MCPError(TEXT("outputPath needs dumpToFile=true."));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
auto CellKey = [Grid](const FVector& P) -> FIntPoint
|
|
289
|
+
{
|
|
290
|
+
return FIntPoint(FMath::FloorToInt(P.X / Grid), FMath::FloorToInt(P.Y / Grid));
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
TMap<FIntPoint, FMCPPerfAuditCell> Cells;
|
|
294
|
+
TMap<FString, FMCPPerfAuditMesh> Meshes;
|
|
295
|
+
TMap<FString, FMCPPerfAuditInstancing> Instancing;
|
|
296
|
+
TMap<UMaterialInterface*, float> TextureCache;
|
|
297
|
+
TArray<FMCPPerfAuditPrimRow> ShadowCasters;
|
|
298
|
+
TArray<FMCPPerfAuditPrimRow> TexelRows;
|
|
299
|
+
TArray<FMCPPerfAuditPrimRow> LightmapRows;
|
|
300
|
+
TArray<FMCPPerfAuditPrimRow> TranslucentRows;
|
|
301
|
+
TArray<FMCPPerfAuditLight> Lights;
|
|
302
|
+
TMap<FString, TArray<FString>> NaniteBlockers;
|
|
303
|
+
int32 ActorsScanned = 0;
|
|
304
|
+
int32 PrimitivesScanned = 0;
|
|
305
|
+
int32 SkippedHidden = 0;
|
|
306
|
+
int32 MovableShadowCasters = 0;
|
|
307
|
+
int32 ShadowedDirectional = 0;
|
|
308
|
+
int64 TotalTriangles = 0;
|
|
309
|
+
|
|
310
|
+
for (TActorIterator<AActor> It(World); It; ++It)
|
|
311
|
+
{
|
|
312
|
+
AActor* Actor = *It;
|
|
313
|
+
if (!IsValid(Actor)) continue;
|
|
314
|
+
++ActorsScanned;
|
|
315
|
+
const FString ActorPath = Actor->GetPathName();
|
|
316
|
+
const FString ActorLabel = Actor->GetActorLabel();
|
|
317
|
+
|
|
318
|
+
TArray<UActorComponent*> Components;
|
|
319
|
+
Actor->GetComponents(Components);
|
|
320
|
+
for (UActorComponent* Component : Components)
|
|
321
|
+
{
|
|
322
|
+
if (!IsValid(Component) || !Component->IsRegistered() || Component->IsEditorOnly()) continue;
|
|
323
|
+
|
|
324
|
+
// ── Lights ──────────────────────────────────────────────────────
|
|
325
|
+
if (ULightComponent* Light = Cast<ULightComponent>(Component))
|
|
326
|
+
{
|
|
327
|
+
if (!Light->IsVisible() || !Light->bAffectsWorld || !Light->CastShadows) continue;
|
|
328
|
+
if (Light->GetLightType() == LightType_Directional)
|
|
329
|
+
{
|
|
330
|
+
++ShadowedDirectional;
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
ULocalLightComponent* Local = Cast<ULocalLightComponent>(Light);
|
|
334
|
+
if (!Local) continue;
|
|
335
|
+
const FVector Location = Local->GetComponentLocation();
|
|
336
|
+
const double Radius = Local->AttenuationRadius;
|
|
337
|
+
if (Region.IsValid && !FMath::SphereAABBIntersection(FSphere(Location, Radius), Region)) continue;
|
|
338
|
+
FMCPPerfAuditLight Row;
|
|
339
|
+
Row.ActorLabel = ActorLabel;
|
|
340
|
+
Row.ActorPath = ActorPath;
|
|
341
|
+
Row.Component = Light->GetName();
|
|
342
|
+
Row.Type = Light->GetLightType() == LightType_Spot ? TEXT("spot")
|
|
343
|
+
: Light->GetLightType() == LightType_Rect ? TEXT("rect") : TEXT("point");
|
|
344
|
+
Row.Mobility = MCPPerfAuditMobility(Light->Mobility);
|
|
345
|
+
Row.bStationary = Light->Mobility == EComponentMobility::Stationary;
|
|
346
|
+
Row.Location = Location;
|
|
347
|
+
Row.Radius = Radius;
|
|
348
|
+
Lights.Add(Row);
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
UPrimitiveComponent* Prim = Cast<UPrimitiveComponent>(Component);
|
|
353
|
+
if (!Prim) continue;
|
|
354
|
+
const FBox Box = Prim->Bounds.GetBox();
|
|
355
|
+
if (Region.IsValid && !Box.Intersect(Region)) continue;
|
|
356
|
+
const bool bRendered = Prim->IsVisible() && !Prim->bHiddenInGame && !Actor->IsHidden();
|
|
357
|
+
if (!bRendered)
|
|
358
|
+
{
|
|
359
|
+
++SkippedHidden;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
++PrimitivesScanned;
|
|
363
|
+
|
|
364
|
+
UStaticMeshComponent* StaticComp = Cast<UStaticMeshComponent>(Prim);
|
|
365
|
+
UStaticMesh* StaticMesh = StaticComp ? StaticComp->GetStaticMesh() : nullptr;
|
|
366
|
+
USkeletalMeshComponent* SkelComp = Cast<USkeletalMeshComponent>(Prim);
|
|
367
|
+
UInstancedStaticMeshComponent* ISM = Cast<UInstancedStaticMeshComponent>(Prim);
|
|
368
|
+
const int64 Placements = ISM ? FMath::Max(0, ISM->GetInstanceCount()) : 1;
|
|
369
|
+
|
|
370
|
+
int64 Lod0 = 0;
|
|
371
|
+
FString MeshPath;
|
|
372
|
+
FString Kind;
|
|
373
|
+
bool bNanite = false;
|
|
374
|
+
if (StaticMesh)
|
|
375
|
+
{
|
|
376
|
+
Lod0 = StaticMesh->GetNumTriangles(0);
|
|
377
|
+
MeshPath = StaticMesh->GetPathName();
|
|
378
|
+
Kind = TEXT("static");
|
|
379
|
+
bNanite = StaticMesh->IsNaniteEnabled() && !MCPIsDisallowNanite(StaticComp) && !MCPIsForceDisableNanite(StaticComp);
|
|
380
|
+
}
|
|
381
|
+
else if (SkelComp && SkelComp->GetSkeletalMeshAsset())
|
|
382
|
+
{
|
|
383
|
+
Lod0 = MCPPerfAuditSkeletalTriangles(SkelComp);
|
|
384
|
+
MeshPath = SkelComp->GetSkeletalMeshAsset()->GetPathName();
|
|
385
|
+
Kind = TEXT("skeletal");
|
|
386
|
+
}
|
|
387
|
+
const int64 Triangles = Lod0 * Placements;
|
|
388
|
+
TotalTriangles += Triangles;
|
|
389
|
+
|
|
390
|
+
const FIntPoint Key = CellKey(Prim->Bounds.Origin);
|
|
391
|
+
FMCPPerfAuditCell* Cell = Cells.Find(Key);
|
|
392
|
+
if (!Cell)
|
|
393
|
+
{
|
|
394
|
+
if (Cells.Num() >= MCPPerfAuditMaxCells)
|
|
395
|
+
{
|
|
396
|
+
return MCPError(FString::Printf(
|
|
397
|
+
TEXT("gridSize %.0f splits this level into more than %d occupied cells. Pass a larger gridSize or a region."),
|
|
398
|
+
Grid, MCPPerfAuditMaxCells));
|
|
399
|
+
}
|
|
400
|
+
Cell = &Cells.Add(Key);
|
|
401
|
+
Cell->X = Key.X;
|
|
402
|
+
Cell->Y = Key.Y;
|
|
403
|
+
}
|
|
404
|
+
Cell->Triangles += Triangles;
|
|
405
|
+
Cell->Primitives += 1;
|
|
406
|
+
|
|
407
|
+
FMCPPerfAuditPrimRow Base;
|
|
408
|
+
Base.ActorLabel = ActorLabel;
|
|
409
|
+
Base.ActorPath = ActorPath;
|
|
410
|
+
Base.Component = Prim->GetName();
|
|
411
|
+
Base.Mesh = MeshPath;
|
|
412
|
+
Base.Mobility = MCPPerfAuditMobility(Prim->Mobility);
|
|
413
|
+
Base.Triangles = Triangles;
|
|
414
|
+
Base.Box = Box;
|
|
415
|
+
|
|
416
|
+
// ── Triangles by mesh ───────────────────────────────────────────
|
|
417
|
+
if (!MeshPath.IsEmpty())
|
|
418
|
+
{
|
|
419
|
+
FMCPPerfAuditMesh& Mesh = Meshes.FindOrAdd(MeshPath);
|
|
420
|
+
Mesh.Path = MeshPath;
|
|
421
|
+
Mesh.Kind = Kind;
|
|
422
|
+
Mesh.Lod0Triangles = Lod0;
|
|
423
|
+
Mesh.Placements += Placements;
|
|
424
|
+
Mesh.Components += 1;
|
|
425
|
+
Mesh.bNanite = Mesh.bNanite || bNanite;
|
|
426
|
+
if (Mesh.LastActor != ActorPath)
|
|
427
|
+
{
|
|
428
|
+
Mesh.LastActor = ActorPath;
|
|
429
|
+
Mesh.Actors += 1;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ── Instancing candidates: plain components, one draw each ─────
|
|
434
|
+
if (StaticMesh && !ISM)
|
|
435
|
+
{
|
|
436
|
+
FMCPPerfAuditInstancing& Inst = Instancing.FindOrAdd(MeshPath);
|
|
437
|
+
Inst.Path = MeshPath;
|
|
438
|
+
Inst.Components += 1;
|
|
439
|
+
Inst.Sections = FMath::Max(1, StaticComp->GetNumMaterials());
|
|
440
|
+
Inst.Lod0Triangles = Lod0;
|
|
441
|
+
if (Prim->Mobility == EComponentMobility::Movable) Inst.Movable += 1;
|
|
442
|
+
if (Inst.LastActor != ActorPath)
|
|
443
|
+
{
|
|
444
|
+
Inst.LastActor = ActorPath;
|
|
445
|
+
Inst.Actors += 1;
|
|
446
|
+
if (Inst.SampleActors.Num() < 5) Inst.SampleActors.Add(ActorLabel);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// ── Dynamic shadow casters ──────────────────────────────────────
|
|
451
|
+
if (Prim->CastShadow && Prim->bCastDynamicShadow)
|
|
452
|
+
{
|
|
453
|
+
Cell->ShadowCasters += 1;
|
|
454
|
+
if (Prim->Mobility == EComponentMobility::Movable) ++MovableShadowCasters;
|
|
455
|
+
ShadowCasters.Add(Base);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// ── Materials: translucency and texel density ───────────────────
|
|
459
|
+
const int32 NumMaterials = Prim->GetNumMaterials();
|
|
460
|
+
bool bTranslucent = false;
|
|
461
|
+
double BestTexelsPerM = 0.0;
|
|
462
|
+
for (int32 Slot = 0; Slot < NumMaterials; ++Slot)
|
|
463
|
+
{
|
|
464
|
+
UMaterialInterface* Material = Prim->GetMaterial(Slot);
|
|
465
|
+
if (!Material) continue;
|
|
466
|
+
if (MCPPerfAuditIsTranslucent(Material))
|
|
467
|
+
{
|
|
468
|
+
bTranslucent = true;
|
|
469
|
+
if (StaticMesh)
|
|
470
|
+
{
|
|
471
|
+
NaniteBlockers.FindOrAdd(MeshPath).AddUnique(FString::Printf(
|
|
472
|
+
TEXT("slot %d uses translucent material %s"), Slot, *Material->GetPathName()));
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if (StaticMesh)
|
|
476
|
+
{
|
|
477
|
+
const FMeshUVChannelInfo* UV = StaticMesh->GetUVChannelData(Slot);
|
|
478
|
+
if (UV && UV->bInitialized && UV->LocalUVDensities[0] > KINDA_SMALL_NUMBER)
|
|
479
|
+
{
|
|
480
|
+
const float TextureSize = MCPPerfAuditLargestTexture(Material, World->GetFeatureLevel(), TextureCache);
|
|
481
|
+
const double WorldPerUV = UV->LocalUVDensities[0] * FMath::Max(KINDA_SMALL_NUMBER, StaticComp->GetTextureStreamingTransformScale());
|
|
482
|
+
if (TextureSize > 0.0f && WorldPerUV > 0.0)
|
|
483
|
+
{
|
|
484
|
+
BestTexelsPerM = FMath::Max(BestTexelsPerM, TextureSize / WorldPerUV * 100.0);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (BestTexelsPerM > 0.0)
|
|
490
|
+
{
|
|
491
|
+
FMCPPerfAuditPrimRow Row = Base;
|
|
492
|
+
Row.Value = BestTexelsPerM;
|
|
493
|
+
TexelRows.Add(Row);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// ── Lightmap density, static lighting only ──────────────────────
|
|
497
|
+
if (StaticComp && Prim->Mobility == EComponentMobility::Static && StaticComp->HasValidSettingsForStaticLighting(false))
|
|
498
|
+
{
|
|
499
|
+
const int32 Resolution = StaticComp->GetStaticLightMapResolution();
|
|
500
|
+
const double SizeM = Box.GetSize().GetMax() / 100.0;
|
|
501
|
+
if (Resolution > 0 && SizeM > KINDA_SMALL_NUMBER)
|
|
502
|
+
{
|
|
503
|
+
FMCPPerfAuditPrimRow Row = Base;
|
|
504
|
+
Row.Value = Resolution / SizeM;
|
|
505
|
+
Row.Extra = Resolution;
|
|
506
|
+
Row.SizeM = SizeM;
|
|
507
|
+
LightmapRows.Add(Row);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (bTranslucent)
|
|
512
|
+
{
|
|
513
|
+
Cell->TranslucentPrimitives += 1;
|
|
514
|
+
const FVector Size = Box.GetSize() / 100.0;
|
|
515
|
+
FMCPPerfAuditPrimRow Row = Base;
|
|
516
|
+
Row.AreaM2 = FMath::Max3(Size.X * Size.Y, Size.X * Size.Z, Size.Y * Size.Z);
|
|
517
|
+
TranslucentRows.Add(Row);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// ── Lights against cells and against each other ─────────────────────────
|
|
523
|
+
for (FMCPPerfAuditLight& Light : Lights)
|
|
524
|
+
{
|
|
525
|
+
for (TPair<FIntPoint, FMCPPerfAuditCell>& Pair : Cells)
|
|
526
|
+
{
|
|
527
|
+
if (MCPPerfAuditCellIntersectsSphere(Pair.Key.X, Pair.Key.Y, Grid, Light.Location, Light.Radius))
|
|
528
|
+
{
|
|
529
|
+
Pair.Value.ShadowedLights += 1;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
for (int32 i = 0; i < Lights.Num(); ++i)
|
|
534
|
+
{
|
|
535
|
+
for (int32 j = i + 1; j < Lights.Num(); ++j)
|
|
536
|
+
{
|
|
537
|
+
const double Reach = Lights[i].Radius + Lights[j].Radius;
|
|
538
|
+
if (FVector::DistSquared(Lights[i].Location, Lights[j].Location) <= Reach * Reach)
|
|
539
|
+
{
|
|
540
|
+
Lights[i].Overlaps += 1;
|
|
541
|
+
Lights[j].Overlaps += 1;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// ── Translucent stacking ────────────────────────────────────────────────
|
|
547
|
+
bool bTranslucentPairsCapped = false;
|
|
548
|
+
if (TranslucentRows.Num() <= MCPPerfAuditMaxTranslucentPairs)
|
|
549
|
+
{
|
|
550
|
+
for (int32 i = 0; i < TranslucentRows.Num(); ++i)
|
|
551
|
+
{
|
|
552
|
+
for (int32 j = i + 1; j < TranslucentRows.Num(); ++j)
|
|
553
|
+
{
|
|
554
|
+
if (TranslucentRows[i].Box.Intersect(TranslucentRows[j].Box))
|
|
555
|
+
{
|
|
556
|
+
TranslucentRows[i].Overlaps += 1;
|
|
557
|
+
TranslucentRows[j].Overlaps += 1;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
else
|
|
563
|
+
{
|
|
564
|
+
bTranslucentPairsCapped = true;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// ── Build the result ────────────────────────────────────────────────────
|
|
568
|
+
TSharedPtr<FJsonObject> Result = MCPSuccess();
|
|
569
|
+
Result->SetStringField(TEXT("world"), WorldScope);
|
|
570
|
+
Result->SetStringField(TEXT("worldName"), World->GetName());
|
|
571
|
+
Result->SetBoolField(TEXT("loadedOnly"), true);
|
|
572
|
+
Result->SetNumberField(TEXT("gridSize"), Grid);
|
|
573
|
+
Result->SetNumberField(TEXT("maxResults"), MaxResults);
|
|
574
|
+
if (Region.IsValid)
|
|
575
|
+
{
|
|
576
|
+
TSharedPtr<FJsonObject> RegionObj = MakeShared<FJsonObject>();
|
|
577
|
+
RegionObj->SetObjectField(TEXT("min"), MCPVec3ToJsonObject(Region.Min));
|
|
578
|
+
RegionObj->SetObjectField(TEXT("max"), MCPVec3ToJsonObject(Region.Max));
|
|
579
|
+
Result->SetObjectField(TEXT("region"), RegionObj);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
TSharedPtr<FJsonObject> Totals = MakeShared<FJsonObject>();
|
|
583
|
+
Totals->SetNumberField(TEXT("actorsScanned"), ActorsScanned);
|
|
584
|
+
Totals->SetNumberField(TEXT("primitives"), PrimitivesScanned);
|
|
585
|
+
Totals->SetNumberField(TEXT("skippedHidden"), SkippedHidden);
|
|
586
|
+
Totals->SetNumberField(TEXT("lod0Triangles"), static_cast<double>(TotalTriangles));
|
|
587
|
+
Totals->SetNumberField(TEXT("uniqueMeshes"), Meshes.Num());
|
|
588
|
+
Totals->SetNumberField(TEXT("occupiedCells"), Cells.Num());
|
|
589
|
+
Result->SetObjectField(TEXT("totals"), Totals);
|
|
590
|
+
|
|
591
|
+
auto Cap = [MaxResults](int32 Num) { return FMath::Min(Num, MaxResults); };
|
|
592
|
+
|
|
593
|
+
// Triangles by mesh.
|
|
594
|
+
{
|
|
595
|
+
TArray<FMCPPerfAuditMesh> Rows;
|
|
596
|
+
Meshes.GenerateValueArray(Rows);
|
|
597
|
+
Rows.Sort([](const FMCPPerfAuditMesh& A, const FMCPPerfAuditMesh& B)
|
|
598
|
+
{
|
|
599
|
+
const int64 TA = A.Lod0Triangles * A.Placements;
|
|
600
|
+
const int64 TB = B.Lod0Triangles * B.Placements;
|
|
601
|
+
return TA != TB ? TA > TB : A.Path < B.Path;
|
|
602
|
+
});
|
|
603
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
604
|
+
for (int32 i = 0; i < Cap(Rows.Num()); ++i)
|
|
605
|
+
{
|
|
606
|
+
const FMCPPerfAuditMesh& Row = Rows[i];
|
|
607
|
+
TSharedPtr<FJsonObject> Obj = MakeShared<FJsonObject>();
|
|
608
|
+
Obj->SetStringField(TEXT("mesh"), Row.Path);
|
|
609
|
+
Obj->SetStringField(TEXT("kind"), Row.Kind);
|
|
610
|
+
Obj->SetNumberField(TEXT("lod0Triangles"), static_cast<double>(Row.Lod0Triangles));
|
|
611
|
+
Obj->SetNumberField(TEXT("placements"), static_cast<double>(Row.Placements));
|
|
612
|
+
Obj->SetNumberField(TEXT("components"), Row.Components);
|
|
613
|
+
Obj->SetNumberField(TEXT("actors"), Row.Actors);
|
|
614
|
+
Obj->SetNumberField(TEXT("totalTriangles"), static_cast<double>(Row.Lod0Triangles * Row.Placements));
|
|
615
|
+
Obj->SetNumberField(TEXT("shareOfTriangles"), TotalTriangles > 0
|
|
616
|
+
? static_cast<double>(Row.Lod0Triangles * Row.Placements) / static_cast<double>(TotalTriangles) : 0.0);
|
|
617
|
+
if (Row.Kind == TEXT("static")) Obj->SetBoolField(TEXT("nanite"), Row.bNanite);
|
|
618
|
+
Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
619
|
+
}
|
|
620
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
621
|
+
Section->SetNumberField(TEXT("total"), Rows.Num());
|
|
622
|
+
Section->SetArrayField(TEXT("rows"), Out);
|
|
623
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < Rows.Num());
|
|
624
|
+
Section->SetStringField(TEXT("note"), TEXT("LOD0 triangles times placements. For a Nanite mesh this counts its fallback mesh, not the Nanite geometry."));
|
|
625
|
+
Result->SetObjectField(TEXT("trianglesByMesh"), Section);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// Cells, by triangles and by shadowed-light overlap.
|
|
629
|
+
{
|
|
630
|
+
TArray<FMCPPerfAuditCell> Rows;
|
|
631
|
+
Cells.GenerateValueArray(Rows);
|
|
632
|
+
auto CellJson = [Grid](const FMCPPerfAuditCell& Cell)
|
|
633
|
+
{
|
|
634
|
+
TSharedPtr<FJsonObject> Obj = MakeShared<FJsonObject>();
|
|
635
|
+
Obj->SetNumberField(TEXT("cellX"), Cell.X);
|
|
636
|
+
Obj->SetNumberField(TEXT("cellY"), Cell.Y);
|
|
637
|
+
TSharedPtr<FJsonObject> Min = MakeShared<FJsonObject>();
|
|
638
|
+
Min->SetNumberField(TEXT("x"), Cell.X * Grid);
|
|
639
|
+
Min->SetNumberField(TEXT("y"), Cell.Y * Grid);
|
|
640
|
+
Obj->SetObjectField(TEXT("min"), Min);
|
|
641
|
+
TSharedPtr<FJsonObject> Max = MakeShared<FJsonObject>();
|
|
642
|
+
Max->SetNumberField(TEXT("x"), (Cell.X + 1) * Grid);
|
|
643
|
+
Max->SetNumberField(TEXT("y"), (Cell.Y + 1) * Grid);
|
|
644
|
+
Obj->SetObjectField(TEXT("max"), Max);
|
|
645
|
+
Obj->SetNumberField(TEXT("triangles"), static_cast<double>(Cell.Triangles));
|
|
646
|
+
Obj->SetNumberField(TEXT("primitives"), Cell.Primitives);
|
|
647
|
+
Obj->SetNumberField(TEXT("shadowCasters"), Cell.ShadowCasters);
|
|
648
|
+
Obj->SetNumberField(TEXT("shadowedLights"), Cell.ShadowedLights);
|
|
649
|
+
Obj->SetNumberField(TEXT("translucentPrimitives"), Cell.TranslucentPrimitives);
|
|
650
|
+
return Obj;
|
|
651
|
+
};
|
|
652
|
+
TArray<FMCPPerfAuditCell> ByTriangles = Rows;
|
|
653
|
+
ByTriangles.Sort([](const FMCPPerfAuditCell& A, const FMCPPerfAuditCell& B) { return A.Triangles > B.Triangles; });
|
|
654
|
+
TArray<TSharedPtr<FJsonValue>> TriOut;
|
|
655
|
+
for (int32 i = 0; i < Cap(ByTriangles.Num()); ++i) TriOut.Add(MakeShared<FJsonValueObject>(CellJson(ByTriangles[i])));
|
|
656
|
+
|
|
657
|
+
TArray<FMCPPerfAuditCell> ByLights = Rows.FilterByPredicate([](const FMCPPerfAuditCell& C) { return C.ShadowedLights > 0; });
|
|
658
|
+
ByLights.Sort([](const FMCPPerfAuditCell& A, const FMCPPerfAuditCell& B) { return A.ShadowedLights > B.ShadowedLights; });
|
|
659
|
+
TArray<TSharedPtr<FJsonValue>> LightOut;
|
|
660
|
+
for (int32 i = 0; i < Cap(ByLights.Num()); ++i) LightOut.Add(MakeShared<FJsonValueObject>(CellJson(ByLights[i])));
|
|
661
|
+
|
|
662
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
663
|
+
Section->SetNumberField(TEXT("total"), Rows.Num());
|
|
664
|
+
Section->SetArrayField(TEXT("byTriangles"), TriOut);
|
|
665
|
+
Section->SetArrayField(TEXT("byShadowedLights"), LightOut);
|
|
666
|
+
Section->SetBoolField(TEXT("truncated"), TriOut.Num() < Rows.Num());
|
|
667
|
+
Section->SetNumberField(TEXT("maxShadowedLightsInCell"), ByLights.Num() > 0 ? ByLights[0].ShadowedLights : 0);
|
|
668
|
+
Section->SetStringField(TEXT("note"), TEXT("Cells are gridSize squares on X/Y; a primitive belongs to the cell its bounds centre is in, and a light counts in every occupied cell its attenuation sphere reaches."));
|
|
669
|
+
Result->SetObjectField(TEXT("regions"), Section);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Instancing candidates.
|
|
673
|
+
{
|
|
674
|
+
TArray<FMCPPerfAuditInstancing> Rows;
|
|
675
|
+
for (const TPair<FString, FMCPPerfAuditInstancing>& Pair : Instancing)
|
|
676
|
+
{
|
|
677
|
+
if (Pair.Value.Components >= InstancingMin) Rows.Add(Pair.Value);
|
|
678
|
+
}
|
|
679
|
+
Rows.Sort([](const FMCPPerfAuditInstancing& A, const FMCPPerfAuditInstancing& B)
|
|
680
|
+
{
|
|
681
|
+
return A.Components * A.Sections != B.Components * B.Sections
|
|
682
|
+
? A.Components * A.Sections > B.Components * B.Sections : A.Path < B.Path;
|
|
683
|
+
});
|
|
684
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
685
|
+
for (int32 i = 0; i < Cap(Rows.Num()); ++i)
|
|
686
|
+
{
|
|
687
|
+
const FMCPPerfAuditInstancing& Row = Rows[i];
|
|
688
|
+
TSharedPtr<FJsonObject> Obj = MakeShared<FJsonObject>();
|
|
689
|
+
Obj->SetStringField(TEXT("mesh"), Row.Path);
|
|
690
|
+
Obj->SetNumberField(TEXT("components"), Row.Components);
|
|
691
|
+
Obj->SetNumberField(TEXT("actors"), Row.Actors);
|
|
692
|
+
Obj->SetNumberField(TEXT("materialSections"), Row.Sections);
|
|
693
|
+
Obj->SetNumberField(TEXT("separateDraws"), Row.Components * Row.Sections);
|
|
694
|
+
Obj->SetNumberField(TEXT("movableComponents"), Row.Movable);
|
|
695
|
+
Obj->SetNumberField(TEXT("lod0Triangles"), static_cast<double>(Row.Lod0Triangles));
|
|
696
|
+
Obj->SetArrayField(TEXT("sampleActors"), MCPStringListToJson(Row.SampleActors));
|
|
697
|
+
Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
698
|
+
}
|
|
699
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
700
|
+
Section->SetNumberField(TEXT("minCount"), InstancingMin);
|
|
701
|
+
Section->SetNumberField(TEXT("total"), Rows.Num());
|
|
702
|
+
Section->SetArrayField(TEXT("rows"), Out);
|
|
703
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < Rows.Num());
|
|
704
|
+
Section->SetStringField(TEXT("note"), TEXT("The same static mesh placed as separate (non-instanced) components. Each component is its own draw per material section; placed as instances of one ISM or HISM component (level(add_hismc_instances)) they draw together."));
|
|
705
|
+
Result->SetObjectField(TEXT("instancingCandidates"), Section);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// Dynamic shadow casters.
|
|
709
|
+
{
|
|
710
|
+
ShadowCasters.Sort([](const FMCPPerfAuditPrimRow& A, const FMCPPerfAuditPrimRow& B) { return A.Triangles > B.Triangles; });
|
|
711
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
712
|
+
for (int32 i = 0; i < Cap(ShadowCasters.Num()); ++i)
|
|
713
|
+
{
|
|
714
|
+
TSharedPtr<FJsonObject> Obj = MCPPerfAuditPrimJson(ShadowCasters[i]);
|
|
715
|
+
Obj->SetNumberField(TEXT("triangles"), static_cast<double>(ShadowCasters[i].Triangles));
|
|
716
|
+
Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
717
|
+
}
|
|
718
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
719
|
+
Section->SetNumberField(TEXT("count"), ShadowCasters.Num());
|
|
720
|
+
Section->SetNumberField(TEXT("movableCount"), MovableShadowCasters);
|
|
721
|
+
Section->SetArrayField(TEXT("costliest"), Out);
|
|
722
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < ShadowCasters.Num());
|
|
723
|
+
Section->SetStringField(TEXT("note"), TEXT("Rendered primitives with CastShadow and bCastDynamicShadow, ranked by LOD0 triangles (times instances). Movable casters re-render into shadow maps whenever they or a light move."));
|
|
724
|
+
Result->SetObjectField(TEXT("dynamicShadowCasters"), Section);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// Shadowed lights.
|
|
728
|
+
{
|
|
729
|
+
Lights.Sort([](const FMCPPerfAuditLight& A, const FMCPPerfAuditLight& B) { return A.Overlaps > B.Overlaps; });
|
|
730
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
731
|
+
TArray<TSharedPtr<FJsonValue>> OverLimit;
|
|
732
|
+
int32 StationaryOver = 0;
|
|
733
|
+
int32 MaxOverlap = 0;
|
|
734
|
+
for (int32 i = 0; i < Lights.Num(); ++i)
|
|
735
|
+
{
|
|
736
|
+
const FMCPPerfAuditLight& Light = Lights[i];
|
|
737
|
+
MaxOverlap = FMath::Max(MaxOverlap, Light.Overlaps);
|
|
738
|
+
TSharedPtr<FJsonObject> Obj = MakeShared<FJsonObject>();
|
|
739
|
+
Obj->SetStringField(TEXT("actorLabel"), Light.ActorLabel);
|
|
740
|
+
Obj->SetStringField(TEXT("actorPath"), Light.ActorPath);
|
|
741
|
+
Obj->SetStringField(TEXT("component"), Light.Component);
|
|
742
|
+
Obj->SetStringField(TEXT("type"), Light.Type);
|
|
743
|
+
Obj->SetStringField(TEXT("mobility"), Light.Mobility);
|
|
744
|
+
Obj->SetNumberField(TEXT("attenuationRadius"), Light.Radius);
|
|
745
|
+
Obj->SetNumberField(TEXT("overlappingShadowedLights"), Light.Overlaps);
|
|
746
|
+
if (i < MaxResults) Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
747
|
+
if (Light.bStationary && Light.Overlaps >= MCPPerfAuditStationaryChannelLimit)
|
|
748
|
+
{
|
|
749
|
+
++StationaryOver;
|
|
750
|
+
if (OverLimit.Num() < MaxResults) OverLimit.Add(MakeShared<FJsonValueObject>(Obj));
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
754
|
+
Section->SetNumberField(TEXT("shadowedLocalLights"), Lights.Num());
|
|
755
|
+
Section->SetNumberField(TEXT("shadowedDirectionalLights"), ShadowedDirectional);
|
|
756
|
+
Section->SetNumberField(TEXT("maxOverlap"), MaxOverlap);
|
|
757
|
+
Section->SetArrayField(TEXT("rows"), Out);
|
|
758
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < Lights.Num());
|
|
759
|
+
Section->SetNumberField(TEXT("stationaryOverChannelLimit"), StationaryOver);
|
|
760
|
+
Section->SetArrayField(TEXT("stationaryOverChannelLimitRows"), OverLimit);
|
|
761
|
+
Section->SetStringField(TEXT("note"), TEXT("Shadow-casting point, spot and rect lights; overlap is attenuation spheres touching. A stationary light whose sphere touches four or more other shadowed stationary lights may exceed the four shadow channels stationary lights share, and the engine then drops its shadows."));
|
|
762
|
+
Result->SetObjectField(TEXT("lights"), Section);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
auto OutlierSection = [&](const TArray<FMCPPerfAuditPrimRow>& Rows, const TCHAR* ValueKey, const TCHAR* Note, bool bLightmap)
|
|
766
|
+
{
|
|
767
|
+
double Median = 0.0;
|
|
768
|
+
const TArray<FMCPPerfAuditPrimRow> Outliers = MCPPerfAuditOutliers(Rows, OutlierFactor, Median);
|
|
769
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
770
|
+
for (int32 i = 0; i < Cap(Outliers.Num()); ++i)
|
|
771
|
+
{
|
|
772
|
+
const FMCPPerfAuditPrimRow& Row = Outliers[i];
|
|
773
|
+
TSharedPtr<FJsonObject> Obj = MCPPerfAuditPrimJson(Row);
|
|
774
|
+
Obj->SetNumberField(ValueKey, Row.Value);
|
|
775
|
+
Obj->SetNumberField(TEXT("ratioToMedian"), Row.Ratio);
|
|
776
|
+
Obj->SetStringField(TEXT("direction"), Row.Ratio >= 1.0 ? TEXT("high") : TEXT("low"));
|
|
777
|
+
if (bLightmap)
|
|
778
|
+
{
|
|
779
|
+
Obj->SetNumberField(TEXT("lightmapResolution"), Row.Extra);
|
|
780
|
+
Obj->SetNumberField(TEXT("worldSizeM"), Row.SizeM);
|
|
781
|
+
}
|
|
782
|
+
Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
783
|
+
}
|
|
784
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
785
|
+
Section->SetNumberField(TEXT("evaluated"), Rows.Num());
|
|
786
|
+
Section->SetNumberField(TEXT("median"), Median);
|
|
787
|
+
Section->SetNumberField(TEXT("outlierFactor"), OutlierFactor);
|
|
788
|
+
Section->SetNumberField(TEXT("count"), Outliers.Num());
|
|
789
|
+
Section->SetArrayField(TEXT("rows"), Out);
|
|
790
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < Outliers.Num());
|
|
791
|
+
Section->SetStringField(TEXT("note"), Note);
|
|
792
|
+
return Section;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
Result->SetObjectField(TEXT("texelDensityOutliers"), OutlierSection(TexelRows, TEXT("texelsPerMeter"),
|
|
796
|
+
TEXT("Largest texture the material samples over the mesh's UV density at the component's scale, per component (its densest slot), against the median of every component that could be evaluated. A material that samples no texture, or a mesh without computed UV density, is not evaluated."),
|
|
797
|
+
false));
|
|
798
|
+
|
|
799
|
+
{
|
|
800
|
+
bool bForceNoPrecomputed = false;
|
|
801
|
+
if (AWorldSettings* Settings = World->GetWorldSettings())
|
|
802
|
+
{
|
|
803
|
+
bForceNoPrecomputed = Settings->bForceNoPrecomputedLighting != 0;
|
|
804
|
+
}
|
|
805
|
+
bool bAllowStatic = true;
|
|
806
|
+
if (IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.AllowStaticLighting")))
|
|
807
|
+
{
|
|
808
|
+
bAllowStatic = CVar->GetInt() != 0;
|
|
809
|
+
}
|
|
810
|
+
TSharedPtr<FJsonObject> Section = OutlierSection(LightmapRows, TEXT("lightmapTexelsPerMeter"),
|
|
811
|
+
TEXT("Static-mobility static mesh components set up for static lighting: effective lightmap resolution over the largest bounds dimension, against the median."),
|
|
812
|
+
true);
|
|
813
|
+
Section->SetBoolField(TEXT("staticLightingAllowed"), bAllowStatic);
|
|
814
|
+
Section->SetBoolField(TEXT("forceNoPrecomputedLighting"), bForceNoPrecomputed);
|
|
815
|
+
if (!bAllowStatic || bForceNoPrecomputed)
|
|
816
|
+
{
|
|
817
|
+
Section->SetStringField(TEXT("staticLightingNote"),
|
|
818
|
+
TEXT("Static lighting is off for this project or level, so lightmap resolution costs nothing at runtime here; the rows matter only if static lighting is turned back on."));
|
|
819
|
+
}
|
|
820
|
+
Result->SetObjectField(TEXT("lightmapResolutionOutliers"), Section);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// Nanite candidates: heavy static meshes that are not Nanite.
|
|
824
|
+
{
|
|
825
|
+
TArray<FMCPPerfAuditMesh> Rows;
|
|
826
|
+
for (const TPair<FString, FMCPPerfAuditMesh>& Pair : Meshes)
|
|
827
|
+
{
|
|
828
|
+
if (Pair.Value.Kind == TEXT("static") && !Pair.Value.bNanite && Pair.Value.Lod0Triangles >= HeavyTriangles) Rows.Add(Pair.Value);
|
|
829
|
+
}
|
|
830
|
+
Rows.Sort([](const FMCPPerfAuditMesh& A, const FMCPPerfAuditMesh& B)
|
|
831
|
+
{
|
|
832
|
+
return A.Lod0Triangles * A.Placements > B.Lod0Triangles * B.Placements;
|
|
833
|
+
});
|
|
834
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
835
|
+
int32 Eligible = 0;
|
|
836
|
+
for (int32 i = 0; i < Rows.Num(); ++i)
|
|
837
|
+
{
|
|
838
|
+
const FMCPPerfAuditMesh& Row = Rows[i];
|
|
839
|
+
const TArray<FString>* Blockers = NaniteBlockers.Find(Row.Path);
|
|
840
|
+
const bool bEligible = !Blockers || Blockers->Num() == 0;
|
|
841
|
+
if (bEligible) ++Eligible;
|
|
842
|
+
if (Out.Num() >= MaxResults) continue;
|
|
843
|
+
TSharedPtr<FJsonObject> Obj = MakeShared<FJsonObject>();
|
|
844
|
+
Obj->SetStringField(TEXT("mesh"), Row.Path);
|
|
845
|
+
Obj->SetNumberField(TEXT("lod0Triangles"), static_cast<double>(Row.Lod0Triangles));
|
|
846
|
+
Obj->SetNumberField(TEXT("placements"), static_cast<double>(Row.Placements));
|
|
847
|
+
Obj->SetNumberField(TEXT("totalTriangles"), static_cast<double>(Row.Lod0Triangles * Row.Placements));
|
|
848
|
+
Obj->SetBoolField(TEXT("eligible"), bEligible);
|
|
849
|
+
Obj->SetArrayField(TEXT("blockers"), MCPStringListToJson(Blockers ? *Blockers : TArray<FString>()));
|
|
850
|
+
Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
851
|
+
}
|
|
852
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
853
|
+
Section->SetNumberField(TEXT("heavyTriangleThreshold"), static_cast<double>(HeavyTriangles));
|
|
854
|
+
Section->SetNumberField(TEXT("total"), Rows.Num());
|
|
855
|
+
Section->SetNumberField(TEXT("eligible"), Eligible);
|
|
856
|
+
Section->SetArrayField(TEXT("rows"), Out);
|
|
857
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < Rows.Num());
|
|
858
|
+
Section->SetStringField(TEXT("note"), TEXT("Static meshes at or over heavyTriangleThreshold LOD0 triangles that render without Nanite (mesh setting off, or the component disallows it). A translucent material blocks Nanite; level(set_nanite_settings) turns it on for the rest."));
|
|
859
|
+
Result->SetObjectField(TEXT("naniteCandidates"), Section);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// Translucent overdraw candidates: large, or stacked on other translucency.
|
|
863
|
+
{
|
|
864
|
+
TArray<FMCPPerfAuditPrimRow> Rows = TranslucentRows.FilterByPredicate([&](const FMCPPerfAuditPrimRow& Row)
|
|
865
|
+
{
|
|
866
|
+
return Row.AreaM2 >= TranslucentAreaM2 || Row.Overlaps + 1 >= StackedTranslucent;
|
|
867
|
+
});
|
|
868
|
+
Rows.Sort([](const FMCPPerfAuditPrimRow& A, const FMCPPerfAuditPrimRow& B)
|
|
869
|
+
{
|
|
870
|
+
return A.AreaM2 * (A.Overlaps + 1) > B.AreaM2 * (B.Overlaps + 1);
|
|
871
|
+
});
|
|
872
|
+
TArray<TSharedPtr<FJsonValue>> Out;
|
|
873
|
+
for (int32 i = 0; i < Cap(Rows.Num()); ++i)
|
|
874
|
+
{
|
|
875
|
+
const FMCPPerfAuditPrimRow& Row = Rows[i];
|
|
876
|
+
TSharedPtr<FJsonObject> Obj = MCPPerfAuditPrimJson(Row);
|
|
877
|
+
Obj->SetNumberField(TEXT("areaM2"), Row.AreaM2);
|
|
878
|
+
Obj->SetNumberField(TEXT("stackDepth"), Row.Overlaps + 1);
|
|
879
|
+
TArray<FString> Reasons;
|
|
880
|
+
if (Row.AreaM2 >= TranslucentAreaM2) Reasons.Add(TEXT("large"));
|
|
881
|
+
if (Row.Overlaps + 1 >= StackedTranslucent) Reasons.Add(TEXT("stacked"));
|
|
882
|
+
Obj->SetArrayField(TEXT("reasons"), MCPStringListToJson(Reasons));
|
|
883
|
+
Out.Add(MakeShared<FJsonValueObject>(Obj));
|
|
884
|
+
}
|
|
885
|
+
TSharedPtr<FJsonObject> Section = MakeShared<FJsonObject>();
|
|
886
|
+
Section->SetNumberField(TEXT("translucentPrimitives"), TranslucentRows.Num());
|
|
887
|
+
Section->SetNumberField(TEXT("areaThresholdM2"), TranslucentAreaM2);
|
|
888
|
+
Section->SetNumberField(TEXT("stackedCount"), StackedTranslucent);
|
|
889
|
+
Section->SetNumberField(TEXT("count"), Rows.Num());
|
|
890
|
+
Section->SetArrayField(TEXT("rows"), Out);
|
|
891
|
+
Section->SetBoolField(TEXT("truncated"), Out.Num() < Rows.Num());
|
|
892
|
+
Section->SetBoolField(TEXT("stackingSkipped"), bTranslucentPairsCapped);
|
|
893
|
+
Section->SetStringField(TEXT("note"), TEXT("Rendered primitives with a translucent material whose largest bounds face is at least areaThresholdM2, or whose bounds overlap enough other translucent primitives to stack stackedCount deep. Every translucent layer shades every pixel it covers."));
|
|
894
|
+
Result->SetObjectField(TEXT("translucentOverdraw"), Section);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
Result->SetStringField(TEXT("note"),
|
|
898
|
+
TEXT("Static estimates from asset and component data over the loaded actors, not measurements. Confirm a suspicion with a trace: editor(start_trace), editor(stop_trace), editor(analyze_trace)."));
|
|
899
|
+
|
|
900
|
+
if (!bDump)
|
|
901
|
+
{
|
|
902
|
+
return MCPResult(Result);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
const FString DefaultPath = FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("UE_MCP"), TEXT("PerfAudit"),
|
|
906
|
+
FString::Printf(TEXT("%s_%s.json"), *World->GetName(), *FDateTime::Now().ToString(TEXT("%Y%m%d_%H%M%S"))));
|
|
907
|
+
const FString Target = MCPResolveDumpPath(OutputPath.IsEmpty() ? DefaultPath : OutputPath);
|
|
908
|
+
FString JsonText;
|
|
909
|
+
const TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&JsonText);
|
|
910
|
+
if (!FJsonSerializer::Serialize(Result.ToSharedRef(), Writer))
|
|
911
|
+
{
|
|
912
|
+
return MCPError(TEXT("Failed to serialise the performance audit to JSON."));
|
|
913
|
+
}
|
|
914
|
+
FString Error;
|
|
915
|
+
if (!MCPWriteDumpFile(Target, JsonText, TEXT("performance audit"), Error))
|
|
916
|
+
{
|
|
917
|
+
return MCPError(Error);
|
|
918
|
+
}
|
|
919
|
+
TSharedPtr<FJsonObject> Short = MCPSuccess();
|
|
920
|
+
Short->SetBoolField(TEXT("dumpedToFile"), true);
|
|
921
|
+
Short->SetStringField(TEXT("outputPath"), FPaths::ConvertRelativePathToFull(Target));
|
|
922
|
+
Short->SetStringField(TEXT("world"), WorldScope);
|
|
923
|
+
Short->SetObjectField(TEXT("totals"), Totals);
|
|
924
|
+
return MCPResult(Short);
|
|
925
|
+
}
|