@fps-games/editor 0.2.1-beta.3 → 0.2.1-beta.4
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/dist/build-info.json +44 -44
- package/dist/editor-commands/capabilities/assets.d.ts +8 -0
- package/dist/editor-commands/capabilities/assets.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/assets.js +41 -41
- package/dist/editor-commands/capabilities/assets.js.map +1 -0
- package/dist/editor-commands/capabilities/editor-state.d.ts +5 -0
- package/dist/editor-commands/capabilities/editor-state.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/editor-state.js +22 -22
- package/dist/editor-commands/capabilities/editor-state.js.map +1 -0
- package/dist/editor-commands/capabilities/hierarchy.d.ts +4 -0
- package/dist/editor-commands/capabilities/hierarchy.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/hierarchy.js +5 -5
- package/dist/editor-commands/capabilities/hierarchy.js.map +1 -0
- package/dist/editor-commands/capabilities/host-lifecycle.d.ts +11 -0
- package/dist/editor-commands/capabilities/host-lifecycle.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/host-lifecycle.js +149 -0
- package/dist/editor-commands/capabilities/host-lifecycle.js.map +1 -0
- package/dist/editor-commands/capabilities/prefabs.d.ts +5 -0
- package/dist/editor-commands/capabilities/prefabs.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/prefabs.js +93 -93
- package/dist/editor-commands/capabilities/prefabs.js.map +1 -0
- package/dist/editor-commands/capabilities/scene-objects.d.ts +8 -0
- package/dist/editor-commands/capabilities/scene-objects.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/scene-objects.js +480 -0
- package/dist/editor-commands/capabilities/scene-objects.js.map +1 -0
- package/dist/editor-commands/capabilities/selection.d.ts +5 -0
- package/dist/editor-commands/capabilities/selection.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/selection.js +60 -0
- package/dist/editor-commands/capabilities/selection.js.map +1 -0
- package/dist/editor-commands/capabilities/shadows.d.ts +5 -0
- package/dist/editor-commands/capabilities/shadows.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/shadows.js +74 -74
- package/dist/editor-commands/capabilities/shadows.js.map +1 -0
- package/dist/editor-commands/capabilities/transform.d.ts +5 -0
- package/dist/editor-commands/capabilities/transform.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/transform.js +164 -0
- package/dist/editor-commands/capabilities/transform.js.map +1 -0
- package/dist/editor-commands/capabilities/ui-regions.d.ts +4 -0
- package/dist/editor-commands/capabilities/ui-regions.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/ui-regions.js +55 -57
- package/dist/editor-commands/capabilities/ui-regions.js.map +1 -0
- package/dist/editor-commands/capabilities/viewport.d.ts +5 -0
- package/dist/editor-commands/capabilities/viewport.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/viewport.js +100 -100
- package/dist/editor-commands/capabilities/viewport.js.map +1 -0
- package/dist/editor-commands/command-sources.d.ts +7 -0
- package/dist/editor-commands/command-sources.d.ts.map +1 -0
- package/dist/editor-commands/command-sources.js +34 -0
- package/dist/editor-commands/command-sources.js.map +1 -0
- package/dist/editor-commands/diagnostics.d.ts +12 -0
- package/dist/editor-commands/diagnostics.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/diagnostics.js +4 -4
- package/dist/editor-commands/diagnostics.js.map +1 -0
- package/dist/{agent-bridge → editor-commands}/index.d.ts +1 -1
- package/dist/editor-commands/index.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/index.js +1 -1
- package/dist/editor-commands/index.js.map +1 -0
- package/dist/editor-commands/register.d.ts +4 -0
- package/dist/editor-commands/register.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/register.js +323 -286
- package/dist/editor-commands/register.js.map +1 -0
- package/dist/{agent-bridge → editor-commands}/shared.d.ts +80 -80
- package/dist/editor-commands/shared.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/shared.js +29 -29
- package/dist/editor-commands/shared.js.map +1 -0
- package/dist/editor-commands/source-types.d.ts +110 -0
- package/dist/editor-commands/source-types.d.ts.map +1 -0
- package/dist/editor-commands/source-types.js.map +1 -0
- package/dist/editor-plugin-commands.d.ts +4 -0
- package/dist/editor-plugin-commands.d.ts.map +1 -0
- package/dist/editor-plugin-commands.js +18 -0
- package/dist/editor-plugin-commands.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/local-editor-commands.d.ts +2 -0
- package/dist/local-editor-commands.d.ts.map +1 -0
- package/dist/local-editor-commands.js +2 -0
- package/dist/local-editor-commands.js.map +1 -0
- package/dist/local-editor-harness.d.ts +35 -21
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +1721 -367
- package/dist/local-editor-harness.js.map +1 -1
- package/dist/local-editor-prefab-stage-transaction.d.ts +2 -1
- package/dist/local-editor-prefab-stage-transaction.d.ts.map +1 -1
- package/dist/local-editor-prefab-stage-transaction.js +6 -5
- package/dist/local-editor-prefab-stage-transaction.js.map +1 -1
- package/dist/local-editor-scene-view-interaction-runtime.d.ts.map +1 -1
- package/dist/local-editor-scene-view-interaction-runtime.js +2 -5
- package/dist/local-editor-scene-view-interaction-runtime.js.map +1 -1
- package/dist/playable-local-editor-entry.d.ts +10 -0
- package/dist/playable-local-editor-entry.d.ts.map +1 -1
- package/dist/playable-local-editor-entry.js +10 -2
- package/dist/playable-local-editor-entry.js.map +1 -1
- package/dist/playable-local-editor-host.d.ts +3 -32
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js +6 -70
- package/dist/playable-local-editor-host.js.map +1 -1
- package/dist/playable-product-local-editor.d.ts +1 -2
- package/dist/playable-product-local-editor.d.ts.map +1 -1
- package/dist/playable-product-local-editor.js +0 -1
- package/dist/playable-product-local-editor.js.map +1 -1
- package/dist/playable-product-projection-preview.d.ts.map +1 -1
- package/dist/playable-product-projection-preview.js +1 -1
- package/dist/playable-product-projection-preview.js.map +1 -1
- package/dist/playable-product-scene-capabilities.d.ts +0 -2
- package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
- package/dist/playable-product-scene-capabilities.js +33 -6
- package/dist/playable-product-scene-capabilities.js.map +1 -1
- package/dist/playable-runtime-babylon.d.ts +4 -0
- package/dist/playable-runtime-babylon.d.ts.map +1 -1
- package/dist/playable-runtime-babylon.js +4 -0
- package/dist/playable-runtime-babylon.js.map +1 -1
- package/dist/playable-sdk.d.ts +1 -1
- package/dist/playable-sdk.d.ts.map +1 -1
- package/dist/playable-sdk.js.map +1 -1
- package/dist/playable-standard-project.d.ts +0 -2
- package/dist/playable-standard-project.d.ts.map +1 -1
- package/dist/playable-standard-project.js +1 -2
- package/dist/playable-standard-project.js.map +1 -1
- package/dist/project-service-projection.d.ts +16 -0
- package/dist/project-service-projection.d.ts.map +1 -0
- package/dist/project-service-projection.js +67 -0
- package/dist/project-service-projection.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.d.ts +18 -0
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.js +54 -18
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +9 -9
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +127 -13
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +66 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +6 -6
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.d.ts +32 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.js +254 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +3 -1
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js +2 -0
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.d.ts +68 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.js +650 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.d.ts +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.js +22 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts +8 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js +117 -6
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts +14 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js +100 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +8 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +75 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +37 -12
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +25 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +332 -107
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +7 -7
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.d.ts +107 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.js +1211 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.d.ts +34 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.js +260 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.d.ts +9 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.js +14 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.d.ts +18 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.js +113 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.d.ts +82 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.js +1098 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.d.ts +6 -7
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.js +62 -103
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.d.ts +30 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.js +540 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.d.ts +9 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.js +61 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts +55 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-session.js +247 -6
- package/node_modules/@fps-games/editor-core/dist/editor-session.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.d.ts +6 -2
- package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.js +6 -2
- package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-core/package.json +6 -6
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.js +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/bridge-command/protocol.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/bridge-command/protocol.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js +41 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.d.ts +27 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.js +214 -7
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.js +11 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.d.ts +2 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.js +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.js +77 -31
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.d.ts +8 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.d.ts +21 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.js +90 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts +27 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js +161 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.d.ts +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.js +5 -92
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.d.ts +7 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.js +26 -9
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.d.ts +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.js +19 -8
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.js +16 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.d.ts +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.js +12 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.d.ts +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.js +10 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.js +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.d.ts +17 -82
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.js +53 -57
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.js +3 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.d.ts +10 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.js +256 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.js +7 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +8 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js +134 -12
- package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.js +47 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.d.ts +27 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.js +592 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +3 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.js +61 -6
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.d.ts +0 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.js +1 -10
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +21 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.d.ts +13 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.js +18 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.d.ts +28 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.js +863 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.d.ts +1626 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/{agent-bridge.js → editor-command-capabilities.js} +766 -620
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.d.ts +69 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.js +22 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.d.ts +136 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.js +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.d.ts +225 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.js +4 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +6 -3
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.js +6 -3
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/package.json +2 -2
- package/node_modules/@fps-games/editor-tooling/package.json +3 -3
- package/node_modules/@fps-games/editor-ui/package.json +1 -1
- package/node_modules/@fps-games/playable-assets/package.json +1 -1
- package/node_modules/@fps-games/playable-contracts/package.json +1 -1
- package/node_modules/@fps-games/playable-rendering/package.json +2 -2
- package/node_modules/@fps-games/playable-runtime/package.json +12 -12
- package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
- package/node_modules/@fps-games/playable-scene/package.json +2 -2
- package/node_modules/@fps-games/plugin-api/package.json +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-assets/package.json +6 -6
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.d.ts +1 -0
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.d.ts.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.js +78 -4
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.js.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
- package/node_modules/@fps-games/plugin-host/package.json +2 -2
- package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-markers/package.json +5 -5
- package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-materials/package.json +5 -5
- package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
- package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-scene/package.json +5 -5
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
- package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
- package/package.json +23 -23
- package/dist/agent-bridge/capabilities/assets.d.ts +0 -8
- package/dist/agent-bridge/capabilities/assets.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/assets.js.map +0 -1
- package/dist/agent-bridge/capabilities/editor-state.d.ts +0 -5
- package/dist/agent-bridge/capabilities/editor-state.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/editor-state.js.map +0 -1
- package/dist/agent-bridge/capabilities/hierarchy.d.ts +0 -4
- package/dist/agent-bridge/capabilities/hierarchy.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/hierarchy.js.map +0 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts +0 -11
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.js +0 -149
- package/dist/agent-bridge/capabilities/host-lifecycle.js.map +0 -1
- package/dist/agent-bridge/capabilities/prefabs.d.ts +0 -5
- package/dist/agent-bridge/capabilities/prefabs.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/prefabs.js.map +0 -1
- package/dist/agent-bridge/capabilities/scene-objects.d.ts +0 -8
- package/dist/agent-bridge/capabilities/scene-objects.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/scene-objects.js +0 -480
- package/dist/agent-bridge/capabilities/scene-objects.js.map +0 -1
- package/dist/agent-bridge/capabilities/selection.d.ts +0 -5
- package/dist/agent-bridge/capabilities/selection.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/selection.js +0 -60
- package/dist/agent-bridge/capabilities/selection.js.map +0 -1
- package/dist/agent-bridge/capabilities/shadows.d.ts +0 -5
- package/dist/agent-bridge/capabilities/shadows.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/shadows.js.map +0 -1
- package/dist/agent-bridge/capabilities/transform.d.ts +0 -5
- package/dist/agent-bridge/capabilities/transform.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/transform.js +0 -164
- package/dist/agent-bridge/capabilities/transform.js.map +0 -1
- package/dist/agent-bridge/capabilities/ui-regions.d.ts +0 -4
- package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/ui-regions.js.map +0 -1
- package/dist/agent-bridge/capabilities/viewport.d.ts +0 -5
- package/dist/agent-bridge/capabilities/viewport.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/viewport.js.map +0 -1
- package/dist/agent-bridge/capability-sources.d.ts +0 -7
- package/dist/agent-bridge/capability-sources.d.ts.map +0 -1
- package/dist/agent-bridge/capability-sources.js +0 -34
- package/dist/agent-bridge/capability-sources.js.map +0 -1
- package/dist/agent-bridge/diagnostics.d.ts +0 -12
- package/dist/agent-bridge/diagnostics.d.ts.map +0 -1
- package/dist/agent-bridge/diagnostics.js.map +0 -1
- package/dist/agent-bridge/index.d.ts.map +0 -1
- package/dist/agent-bridge/index.js.map +0 -1
- package/dist/agent-bridge/register.d.ts +0 -4
- package/dist/agent-bridge/register.d.ts.map +0 -1
- package/dist/agent-bridge/register.js.map +0 -1
- package/dist/agent-bridge/shared.d.ts.map +0 -1
- package/dist/agent-bridge/shared.js.map +0 -1
- package/dist/agent-bridge/source-types.d.ts +0 -110
- package/dist/agent-bridge/source-types.d.ts.map +0 -1
- package/dist/agent-bridge/source-types.js.map +0 -1
- package/dist/editor-plugin-agent-capabilities.d.ts +0 -4
- package/dist/editor-plugin-agent-capabilities.d.ts.map +0 -1
- package/dist/editor-plugin-agent-capabilities.js +0 -64
- package/dist/editor-plugin-agent-capabilities.js.map +0 -1
- package/dist/local-editor-agent-actions.d.ts +0 -43
- package/dist/local-editor-agent-actions.d.ts.map +0 -1
- package/dist/local-editor-agent-actions.js +0 -321
- package/dist/local-editor-agent-actions.js.map +0 -1
- package/dist/local-editor-agent-bridge-transport.d.ts +0 -129
- package/dist/local-editor-agent-bridge-transport.d.ts.map +0 -1
- package/dist/local-editor-agent-bridge-transport.js +0 -403
- package/dist/local-editor-agent-bridge-transport.js.map +0 -1
- package/dist/local-editor-agent-bridge.d.ts +0 -2
- package/dist/local-editor-agent-bridge.d.ts.map +0 -1
- package/dist/local-editor-agent-bridge.js +0 -2
- package/dist/local-editor-agent-bridge.js.map +0 -1
- package/dist/local-editor-agent-context.d.ts +0 -68
- package/dist/local-editor-agent-context.d.ts.map +0 -1
- package/dist/local-editor-agent-context.js +0 -716
- package/dist/local-editor-agent-context.js.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts +0 -22
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js +0 -106
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.d.ts +0 -17
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.js +0 -14
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.js.map +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.d.ts +0 -23
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.js +0 -47
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.js.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.d.ts +0 -112
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.js +0 -159
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.js.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.d.ts +0 -15
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.js +0 -76
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts +0 -1622
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts +0 -68
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js +0 -23
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +0 -187
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.js +0 -5
- package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +0 -1
- /package/dist/{agent-bridge → editor-commands}/source-types.js +0 -0
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { createEditorAuthoringHost, createEditorCommandObservabilityStore, createEditorSession, } from '@fps-games/editor-core';
|
|
5
|
+
import { EDITOR_COMMAND_BUILT_IN_METADATA, EDITOR_COMMAND_BUILT_IN_PRESENTATION, EDITOR_COMMAND_BUILT_IN_TARGETS, EDITOR_COMMAND_ID, EDITOR_COMMAND_SCHEMAS, EDITOR_COMMAND_SCHEMA_VERSION, } from '@fps-games/editor-protocol';
|
|
6
|
+
import { createEditorScenePrefabGroupNode, createEditorScenePrefabNodeFromAsset, createEditorScenePrefabPrimitiveNode, deleteEditorScenePrefabNode, findEditorScenePrefabAsset, findEditorScenePrefabNode, readEditorScenePrefabNodes, readEditorScenePrefabRootNodeId, renameEditorScenePrefabAsset, renameEditorScenePrefabNode, reparentEditorScenePrefabNode, setEditorScenePrefabNodeTransform, } from '../document/index.js';
|
|
7
|
+
import { registerFpsGameEditorStandardAuthoringCommands } from '../product/standard-authoring-commands.js';
|
|
8
|
+
import { getFpsGameEditorProjectAuthoringBackend } from './project-authoring-backend.js';
|
|
9
|
+
export async function createFpsGameEditorProjectServiceAuthority(options) {
|
|
10
|
+
const document = await loadInitialDocument(options);
|
|
11
|
+
const session = createEditorSession({
|
|
12
|
+
persistedDocument: document,
|
|
13
|
+
reduceDocument(current, command) {
|
|
14
|
+
if (command.type === 'document.replace')
|
|
15
|
+
return command.document;
|
|
16
|
+
return command.patch?.kind === 'replace' ? command.patch.document : current;
|
|
17
|
+
},
|
|
18
|
+
isDocumentStructureChange: command => command.type === 'document.replace'
|
|
19
|
+
|| command.type === 'document.patch',
|
|
20
|
+
});
|
|
21
|
+
const observability = createEditorCommandObservabilityStore();
|
|
22
|
+
let browserCommandForwarder = null;
|
|
23
|
+
const host = createEditorAuthoringHost({
|
|
24
|
+
serviceInstanceId: options.serviceInstanceId,
|
|
25
|
+
session,
|
|
26
|
+
commandSystemOptions: {
|
|
27
|
+
onOperationSettled: event => observability.recordOperation(event),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const disposeCommands = [];
|
|
31
|
+
const preparedExports = new Map();
|
|
32
|
+
try {
|
|
33
|
+
disposeCommands.push(registerFpsGameEditorStandardAuthoringCommands({
|
|
34
|
+
host,
|
|
35
|
+
listAssets: async () => listProjectAssets(options.server, host.getSnapshot().document),
|
|
36
|
+
sceneAssembly: createGenericSceneAssembly(),
|
|
37
|
+
}));
|
|
38
|
+
disposeCommands.push(registerProjectPrefabAuthoringCommands(host));
|
|
39
|
+
disposeCommands.push(registerProjectViewCommands(host, (context, target) => (browserCommandForwarder
|
|
40
|
+
? browserCommandForwarder(context, target)
|
|
41
|
+
: Promise.resolve(commandFailure(target === 'renderer' ? 'renderer.sessionUnavailable' : 'view.sessionUnavailable', `Command requires a Browser attachment: ${context.commandId}`)))));
|
|
42
|
+
disposeCommands.push(registerProjectDocumentCommands(host, options.server, preparedExports));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
for (const dispose of disposeCommands.splice(0).reverse())
|
|
46
|
+
dispose();
|
|
47
|
+
host.dispose();
|
|
48
|
+
await host.drain();
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
host,
|
|
53
|
+
readTraces: observability.read,
|
|
54
|
+
recordOperation: observability.recordOperation,
|
|
55
|
+
readDocumentExport(transactionId) {
|
|
56
|
+
const prepared = preparedExports.get(transactionId);
|
|
57
|
+
return prepared ? structuredClone(prepared) : null;
|
|
58
|
+
},
|
|
59
|
+
bindBrowserCommandForwarder(forwarder) {
|
|
60
|
+
if (browserCommandForwarder)
|
|
61
|
+
throw new Error('Browser command forwarder is already bound.');
|
|
62
|
+
browserCommandForwarder = forwarder;
|
|
63
|
+
let active = true;
|
|
64
|
+
return () => {
|
|
65
|
+
if (!active)
|
|
66
|
+
return;
|
|
67
|
+
active = false;
|
|
68
|
+
if (browserCommandForwarder === forwarder)
|
|
69
|
+
browserCommandForwarder = null;
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
async dispose() {
|
|
73
|
+
browserCommandForwarder = null;
|
|
74
|
+
preparedExports.clear();
|
|
75
|
+
for (const dispose of disposeCommands.splice(0).reverse())
|
|
76
|
+
dispose();
|
|
77
|
+
host.dispose();
|
|
78
|
+
await host.drain();
|
|
79
|
+
observability.clear();
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async function loadInitialDocument(options) {
|
|
84
|
+
const backend = getFpsGameEditorProjectAuthoringBackend(options.server);
|
|
85
|
+
if (backend)
|
|
86
|
+
return normalizeDocument(await backend.loadEditorScene());
|
|
87
|
+
const configuredPath = options.project?.source.editorScene ?? 'src/config/editor-scene.json';
|
|
88
|
+
try {
|
|
89
|
+
const source = await readFile(path.resolve(options.projectRoot, configuredPath), 'utf8');
|
|
90
|
+
return normalizeDocument(JSON.parse(source));
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (options.project)
|
|
94
|
+
throw error;
|
|
95
|
+
return normalizeDocument({ schemaVersion: 1, assets: [], scene: { gameObjects: [] } });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function normalizeDocument(value) {
|
|
99
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
100
|
+
throw new Error('Project Editor Service expected the editor scene to be a JSON object.');
|
|
101
|
+
}
|
|
102
|
+
const document = structuredClone(value);
|
|
103
|
+
const scene = document.scene;
|
|
104
|
+
if (!scene || typeof scene !== 'object' || Array.isArray(scene)) {
|
|
105
|
+
throw new Error('Project Editor Service expected scene.gameObjects.');
|
|
106
|
+
}
|
|
107
|
+
const gameObjects = scene.gameObjects;
|
|
108
|
+
if (!Array.isArray(gameObjects))
|
|
109
|
+
throw new Error('Project Editor Service expected scene.gameObjects to be an array.');
|
|
110
|
+
if (!Array.isArray(document.assets))
|
|
111
|
+
document.assets = [];
|
|
112
|
+
return document;
|
|
113
|
+
}
|
|
114
|
+
async function listProjectAssets(server, document) {
|
|
115
|
+
const backend = getFpsGameEditorProjectAuthoringBackend(server);
|
|
116
|
+
const values = backend ? await backend.listEditorAssets() : document.assets;
|
|
117
|
+
return (Array.isArray(values) ? values : [])
|
|
118
|
+
.map((value, index) => normalizeAsset(value, index))
|
|
119
|
+
.filter((value) => value !== null);
|
|
120
|
+
}
|
|
121
|
+
function normalizeAsset(value, index) {
|
|
122
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
123
|
+
return null;
|
|
124
|
+
const record = value;
|
|
125
|
+
const assetId = readString(record.assetId) ?? readString(record.id);
|
|
126
|
+
if (!assetId)
|
|
127
|
+
return null;
|
|
128
|
+
return {
|
|
129
|
+
...record,
|
|
130
|
+
id: readString(record.id) ?? assetId,
|
|
131
|
+
assetId,
|
|
132
|
+
type: readString(record.type) ?? 'glb',
|
|
133
|
+
kind: readString(record.kind) ?? 'model',
|
|
134
|
+
displayName: readString(record.displayName) ?? readString(record.label) ?? assetId,
|
|
135
|
+
origin: readString(record.origin) ?? 'project',
|
|
136
|
+
dedupeKey: readString(record.dedupeKey) ?? `project:${assetId}:${index}`,
|
|
137
|
+
placeable: record.placeable !== false,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function createGenericSceneAssembly() {
|
|
141
|
+
return {
|
|
142
|
+
getHierarchyItems(document) {
|
|
143
|
+
return document.scene.gameObjects.map(object => ({
|
|
144
|
+
id: object.id,
|
|
145
|
+
label: object.name ?? object.id,
|
|
146
|
+
...(object.parentId ? { parentId: object.parentId } : {}),
|
|
147
|
+
}));
|
|
148
|
+
},
|
|
149
|
+
createCreatePrimitivePatch(document, input) {
|
|
150
|
+
const next = structuredClone(document);
|
|
151
|
+
const id = uniqueObjectId(next, `primitive_${input.shape}`);
|
|
152
|
+
const created = createBaseObject(id, input.name ?? titleCase(input.shape), input.parentId);
|
|
153
|
+
created.kind = 'primitive';
|
|
154
|
+
created.primitive = { shape: input.shape };
|
|
155
|
+
next.scene.gameObjects.push(created);
|
|
156
|
+
return {
|
|
157
|
+
patch: { kind: 'replace', document: next },
|
|
158
|
+
label: `Create ${input.shape}`,
|
|
159
|
+
changedIds: [id],
|
|
160
|
+
createdId: id,
|
|
161
|
+
selectId: id,
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
createDeleteSubtreePatch(document, input) {
|
|
165
|
+
const protectedIds = new Set(['root', 'main_camera', 'environment_light', 'sun_light']);
|
|
166
|
+
const roots = new Set(input.ids.filter(id => !protectedIds.has(id)));
|
|
167
|
+
if (roots.size === 0)
|
|
168
|
+
return null;
|
|
169
|
+
const deleted = new Set(roots);
|
|
170
|
+
let changed = true;
|
|
171
|
+
while (changed) {
|
|
172
|
+
changed = false;
|
|
173
|
+
for (const object of document.scene.gameObjects) {
|
|
174
|
+
if (object.parentId && deleted.has(object.parentId) && !deleted.has(object.id)) {
|
|
175
|
+
deleted.add(object.id);
|
|
176
|
+
changed = true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const next = structuredClone(document);
|
|
181
|
+
next.scene.gameObjects = next.scene.gameObjects.filter(object => !deleted.has(object.id));
|
|
182
|
+
return {
|
|
183
|
+
patch: { kind: 'replace', document: next },
|
|
184
|
+
label: `Delete ${deleted.size} object(s)`,
|
|
185
|
+
changedIds: [...deleted],
|
|
186
|
+
deletedIds: [...deleted],
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
patchGameObjectField(document, id, field, value) {
|
|
190
|
+
const next = structuredClone(document);
|
|
191
|
+
const target = next.scene.gameObjects.find(object => object.id === id);
|
|
192
|
+
if (!target)
|
|
193
|
+
return document;
|
|
194
|
+
const transform = getTransform(target);
|
|
195
|
+
const key = field.slice('transform.'.length);
|
|
196
|
+
if (!transform || !['position', 'rotation', 'scale'].includes(key))
|
|
197
|
+
return document;
|
|
198
|
+
transform[key] = structuredClone(value);
|
|
199
|
+
return next;
|
|
200
|
+
},
|
|
201
|
+
addAssetLibraryItemToDocument(document, asset, transform) {
|
|
202
|
+
const next = structuredClone(document);
|
|
203
|
+
const id = uniqueObjectId(next, slug(asset.displayName ?? asset.assetId));
|
|
204
|
+
const created = createBaseObject(id, asset.displayName ?? asset.assetId);
|
|
205
|
+
const component = getTransform(created);
|
|
206
|
+
if (transform) {
|
|
207
|
+
component.position = structuredClone(transform.position);
|
|
208
|
+
component.rotation = structuredClone(transform.rotation);
|
|
209
|
+
component.scale = structuredClone(transform.scale);
|
|
210
|
+
}
|
|
211
|
+
created.kind = asset.kind === 'prefab' ? 'instance' : 'transform';
|
|
212
|
+
created.components.push({
|
|
213
|
+
type: 'ModelRenderer',
|
|
214
|
+
assetId: asset.assetId,
|
|
215
|
+
});
|
|
216
|
+
next.scene.gameObjects.push(created);
|
|
217
|
+
return { document: next, gameObject: created };
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function registerProjectPrefabAuthoringCommands(host) {
|
|
222
|
+
const unregister = [];
|
|
223
|
+
const register = (commandId, handler) => unregister.push(host.registerCommand({
|
|
224
|
+
manifest: builtInCommandManifest(commandId),
|
|
225
|
+
handler,
|
|
226
|
+
}));
|
|
227
|
+
try {
|
|
228
|
+
register(EDITOR_COMMAND_ID.PREFAB_RESOLVE, (input, context) => {
|
|
229
|
+
const prefabs = context.session.getWorkingDocument().assets
|
|
230
|
+
.filter(asset => asset.type === 'prefab' && asset.prefab)
|
|
231
|
+
.map(toPrefabSummary);
|
|
232
|
+
const query = readString(input.assetId)
|
|
233
|
+
?? readString(input.name)
|
|
234
|
+
?? readString(input.query);
|
|
235
|
+
const matches = !query
|
|
236
|
+
? prefabs
|
|
237
|
+
: prefabs.filter((prefab) => {
|
|
238
|
+
const assetId = typeof prefab.assetId === 'string' ? prefab.assetId : '';
|
|
239
|
+
const displayName = typeof prefab.displayName === 'string' ? prefab.displayName : '';
|
|
240
|
+
return assetId === query
|
|
241
|
+
|| displayName.toLocaleLowerCase() === query.toLocaleLowerCase()
|
|
242
|
+
|| displayName.toLocaleLowerCase().includes(query.toLocaleLowerCase());
|
|
243
|
+
});
|
|
244
|
+
return { ok: true, output: {
|
|
245
|
+
prefabs,
|
|
246
|
+
resolvedPrefab: matches.length === 1 ? matches[0] : null,
|
|
247
|
+
ambiguous: matches.length > 1,
|
|
248
|
+
} };
|
|
249
|
+
});
|
|
250
|
+
register(EDITOR_COMMAND_ID.PREFAB_ASSET_RENAME, (input, context) => {
|
|
251
|
+
const assetId = readString(input.assetId);
|
|
252
|
+
if (!assetId)
|
|
253
|
+
return commandFailure('prefab.assetIdRequired', 'Headless prefab rename requires assetId.');
|
|
254
|
+
const document = context.session.getWorkingDocument();
|
|
255
|
+
const previous = findEditorScenePrefabAsset(document, assetId);
|
|
256
|
+
if (!previous)
|
|
257
|
+
return commandFailure('prefab.notFound', `Prefab asset was not found: ${assetId}`);
|
|
258
|
+
const result = renameEditorScenePrefabAsset(document, assetId, input.displayName);
|
|
259
|
+
const failure = prefabMutationFailure(result);
|
|
260
|
+
if (failure)
|
|
261
|
+
return failure;
|
|
262
|
+
commitPrefabMutation(context, document, result, `Rename prefab ${assetId}`);
|
|
263
|
+
return { ok: true, output: {
|
|
264
|
+
assetId,
|
|
265
|
+
previousDisplayName: previous.displayName ?? previous.id,
|
|
266
|
+
displayName: result.prefabAsset.displayName ?? result.prefabAsset.id,
|
|
267
|
+
stageActive: false,
|
|
268
|
+
renamed: result.changed,
|
|
269
|
+
} };
|
|
270
|
+
});
|
|
271
|
+
register(EDITOR_COMMAND_ID.PREFAB_SCENE_GET, (input, context) => {
|
|
272
|
+
const document = context.session.getWorkingDocument();
|
|
273
|
+
const prefab = resolveHeadlessPrefab(document, input);
|
|
274
|
+
if (!prefab)
|
|
275
|
+
return commandFailure('prefab.assetIdRequired', 'Headless prefab scene reads require an unambiguous assetId.');
|
|
276
|
+
return { ok: true, output: createPrefabSceneOutput(prefab, context.session.getState({ cloneDocuments: false }).dirty) };
|
|
277
|
+
});
|
|
278
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_CREATE_FROM_ASSET, (input, context) => {
|
|
279
|
+
const document = context.session.getWorkingDocument();
|
|
280
|
+
const prefab = resolveHeadlessPrefab(document, { assetId: input.prefabAssetId });
|
|
281
|
+
const assetId = readString(input.assetId);
|
|
282
|
+
const asset = assetId ? document.assets.find(candidate => candidate.id === assetId) : null;
|
|
283
|
+
if (!prefab || !asset) {
|
|
284
|
+
return commandFailure('prefab.assetNotFound', 'Headless prefab node creation requires prefabAssetId and a valid assetId.');
|
|
285
|
+
}
|
|
286
|
+
return finishPrefabNodeMutation(context, document, prefab.id, createEditorScenePrefabNodeFromAsset(prefab, asset, {
|
|
287
|
+
...(readString(input.parentNodeId) ? { parentId: readString(input.parentNodeId) } : {}),
|
|
288
|
+
...(readString(input.name) ? { name: readString(input.name) } : {}),
|
|
289
|
+
...(readString(input.sourceNodePath) ? { sourceNodePath: readString(input.sourceNodePath) } : {}),
|
|
290
|
+
...(readTransform(input) ? { transform: readTransform(input) } : {}),
|
|
291
|
+
}), 'Create prefab node from asset');
|
|
292
|
+
});
|
|
293
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_CREATE_GROUP, (input, context) => {
|
|
294
|
+
const document = context.session.getWorkingDocument();
|
|
295
|
+
const prefab = resolveHeadlessPrefab(document, { assetId: input.prefabAssetId });
|
|
296
|
+
if (!prefab)
|
|
297
|
+
return commandFailure('prefab.assetIdRequired', 'Headless prefab group creation requires prefabAssetId.');
|
|
298
|
+
return finishPrefabNodeMutation(context, document, prefab.id, createEditorScenePrefabGroupNode(prefab, {
|
|
299
|
+
...(readString(input.parentNodeId) ? { parentId: readString(input.parentNodeId) } : {}),
|
|
300
|
+
...(readString(input.name) ? { name: readString(input.name) } : {}),
|
|
301
|
+
...(readTransform(input) ? { transform: readTransform(input) } : {}),
|
|
302
|
+
}), 'Create prefab group');
|
|
303
|
+
});
|
|
304
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_CREATE_PRIMITIVE, (input, context) => {
|
|
305
|
+
const document = context.session.getWorkingDocument();
|
|
306
|
+
const prefab = resolveHeadlessPrefab(document, { assetId: input.prefabAssetId });
|
|
307
|
+
const shape = readString(input.shape);
|
|
308
|
+
if (!prefab || !shape) {
|
|
309
|
+
return commandFailure('prefab.invalidInput', 'Headless prefab primitive creation requires prefabAssetId and shape.');
|
|
310
|
+
}
|
|
311
|
+
return finishPrefabNodeMutation(context, document, prefab.id, createEditorScenePrefabPrimitiveNode(prefab, {
|
|
312
|
+
shape,
|
|
313
|
+
...(readString(input.parentNodeId) ? { parentId: readString(input.parentNodeId) } : {}),
|
|
314
|
+
...(readString(input.name) ? { name: readString(input.name) } : {}),
|
|
315
|
+
...(readTransform(input) ? { transform: readTransform(input) } : {}),
|
|
316
|
+
}), 'Create prefab primitive');
|
|
317
|
+
});
|
|
318
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_SET_TRANSFORM, (input, context) => {
|
|
319
|
+
const resolved = resolvePrefabNodeMutation(context.session.getWorkingDocument(), input);
|
|
320
|
+
if (!resolved.ok)
|
|
321
|
+
return resolved.failure;
|
|
322
|
+
const current = resolved.node.transform && resolved.node.transform.mode !== 'matrix'
|
|
323
|
+
? resolved.node.transform
|
|
324
|
+
: identityTransform();
|
|
325
|
+
const transform = {
|
|
326
|
+
type: 'Transform',
|
|
327
|
+
position: readVec3(input.position) ?? current.position,
|
|
328
|
+
rotation: readVec3(input.rotation) ?? current.rotation,
|
|
329
|
+
scale: readVec3(input.scale) ?? current.scale ?? { x: 1, y: 1, z: 1 },
|
|
330
|
+
};
|
|
331
|
+
return finishPrefabNodeMutation(context, resolved.document, resolved.prefab.id, setEditorScenePrefabNodeTransform(resolved.prefab, resolved.node.id, transform), 'Set prefab node transform');
|
|
332
|
+
});
|
|
333
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_REPARENT, (input, context) => {
|
|
334
|
+
const resolved = resolvePrefabNodeMutation(context.session.getWorkingDocument(), input);
|
|
335
|
+
const parentNodeId = readString(input.parentNodeId);
|
|
336
|
+
if (!resolved.ok)
|
|
337
|
+
return resolved.failure;
|
|
338
|
+
if (!parentNodeId)
|
|
339
|
+
return commandFailure('prefab.parentNotFound', 'Prefab parentNodeId is required.');
|
|
340
|
+
return finishPrefabNodeMutation(context, resolved.document, resolved.prefab.id, reparentEditorScenePrefabNode(resolved.prefab, resolved.node.id, parentNodeId), 'Reparent prefab node');
|
|
341
|
+
});
|
|
342
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_RENAME, (input, context) => {
|
|
343
|
+
const resolved = resolvePrefabNodeMutation(context.session.getWorkingDocument(), input);
|
|
344
|
+
if (!resolved.ok)
|
|
345
|
+
return resolved.failure;
|
|
346
|
+
const previousName = resolved.node.name ?? resolved.node.id;
|
|
347
|
+
const result = renameEditorScenePrefabNode(resolved.prefab, resolved.node.id, input.name);
|
|
348
|
+
const failure = prefabMutationFailure(result);
|
|
349
|
+
if (failure)
|
|
350
|
+
return failure;
|
|
351
|
+
commitPrefabMutation(context, resolved.document, result, 'Rename prefab node');
|
|
352
|
+
return { ok: true, output: {
|
|
353
|
+
nodeId: resolved.node.id,
|
|
354
|
+
previousName,
|
|
355
|
+
name: result.node?.name ?? previousName,
|
|
356
|
+
selectedNodeId: result.selectedNodeId ?? resolved.node.id,
|
|
357
|
+
nodes: readEditorScenePrefabNodes(result.prefabAsset).map(toCommandPrefabNode),
|
|
358
|
+
} };
|
|
359
|
+
});
|
|
360
|
+
register(EDITOR_COMMAND_ID.PREFAB_NODE_DELETE, (input, context) => {
|
|
361
|
+
const resolved = resolvePrefabNodeMutation(context.session.getWorkingDocument(), input);
|
|
362
|
+
if (!resolved.ok)
|
|
363
|
+
return resolved.failure;
|
|
364
|
+
return finishPrefabNodeMutation(context, resolved.document, resolved.prefab.id, deleteEditorScenePrefabNode(resolved.prefab, resolved.node.id), 'Delete prefab node');
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
for (const dispose of unregister.splice(0).reverse())
|
|
369
|
+
dispose();
|
|
370
|
+
throw error;
|
|
371
|
+
}
|
|
372
|
+
return () => { for (const dispose of unregister.splice(0).reverse())
|
|
373
|
+
dispose(); };
|
|
374
|
+
}
|
|
375
|
+
function builtInCommandManifest(id) {
|
|
376
|
+
const metadata = EDITOR_COMMAND_BUILT_IN_METADATA[id];
|
|
377
|
+
const schema = EDITOR_COMMAND_SCHEMAS[id];
|
|
378
|
+
const presentation = EDITOR_COMMAND_BUILT_IN_PRESENTATION[id];
|
|
379
|
+
if (!metadata || !schema)
|
|
380
|
+
throw new Error(`Built-in Editor command contract is missing: ${id}`);
|
|
381
|
+
return {
|
|
382
|
+
schemaVersion: EDITOR_COMMAND_SCHEMA_VERSION,
|
|
383
|
+
id,
|
|
384
|
+
version: 1,
|
|
385
|
+
title: metadata.title,
|
|
386
|
+
target: metadata.target,
|
|
387
|
+
access: metadata.access,
|
|
388
|
+
stability: metadata.stability,
|
|
389
|
+
inputSchema: schema.inputSchema,
|
|
390
|
+
outputSchema: schema.outputSchema,
|
|
391
|
+
requires: { editorReady: true },
|
|
392
|
+
effects: {
|
|
393
|
+
persistence: metadata.access === 'write' ? 'authoring' : 'none',
|
|
394
|
+
undoable: metadata.access === 'write',
|
|
395
|
+
idempotent: metadata.access === 'read',
|
|
396
|
+
},
|
|
397
|
+
presentation: {
|
|
398
|
+
category: metadata.category,
|
|
399
|
+
inputMode: Array.isArray(schema.inputSchema.required) && schema.inputSchema.required.length
|
|
400
|
+
? 'schema-form'
|
|
401
|
+
: 'none',
|
|
402
|
+
...(presentation?.aliases ? { aliases: presentation.aliases } : {}),
|
|
403
|
+
...(presentation?.keywords ? { keywords: presentation.keywords } : {}),
|
|
404
|
+
...(presentation?.examples ? { examples: presentation.examples } : {}),
|
|
405
|
+
...(presentation?.shortcut ? { shortcut: presentation.shortcut } : {}),
|
|
406
|
+
...(presentation?.menu ? { menu: presentation.menu } : {}),
|
|
407
|
+
},
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function resolveHeadlessPrefab(document, input) {
|
|
411
|
+
const assetId = readString(input.assetId);
|
|
412
|
+
return assetId ? findEditorScenePrefabAsset(document, assetId) : null;
|
|
413
|
+
}
|
|
414
|
+
function resolvePrefabNodeMutation(document, input) {
|
|
415
|
+
const prefab = resolveHeadlessPrefab(document, input);
|
|
416
|
+
if (!prefab)
|
|
417
|
+
return { ok: false, failure: commandFailure('prefab.assetIdRequired', 'Headless prefab node mutation requires assetId.') };
|
|
418
|
+
const nodeId = readString(input.nodeId);
|
|
419
|
+
const node = nodeId ? findEditorScenePrefabNode(prefab, nodeId) : null;
|
|
420
|
+
if (!node)
|
|
421
|
+
return { ok: false, failure: commandFailure('prefab.nodeNotFound', `Prefab node was not found: ${nodeId ?? ''}`) };
|
|
422
|
+
return { ok: true, document, prefab, node };
|
|
423
|
+
}
|
|
424
|
+
function finishPrefabNodeMutation(context, document, assetId, result, label) {
|
|
425
|
+
const failure = prefabMutationFailure(result);
|
|
426
|
+
if (failure)
|
|
427
|
+
return failure;
|
|
428
|
+
commitPrefabMutation(context, document, result, label);
|
|
429
|
+
return { ok: true, output: {
|
|
430
|
+
stage: toHeadlessPrefabStage(result.prefabAsset, context.session.getState({ cloneDocuments: false }).dirty),
|
|
431
|
+
changed: result.changed,
|
|
432
|
+
...(result.createdNodeId ? { createdNodeId: result.createdNodeId } : {}),
|
|
433
|
+
...(result.node?.id ? { changedNodeId: result.node.id } : {}),
|
|
434
|
+
...(result.deletedNodeIds?.length ? { deletedNodeIds: result.deletedNodeIds } : {}),
|
|
435
|
+
selectedNodeId: result.selectedNodeId ?? result.node?.id ?? null,
|
|
436
|
+
node: result.node ? toCommandPrefabNode(result.node) : null,
|
|
437
|
+
rootNodeId: readEditorScenePrefabRootNodeId(result.prefabAsset) ?? 'prefab-root',
|
|
438
|
+
nodes: readEditorScenePrefabNodes(result.prefabAsset).map(toCommandPrefabNode),
|
|
439
|
+
status: result.changed ? label : `${label}: unchanged`,
|
|
440
|
+
} };
|
|
441
|
+
}
|
|
442
|
+
function commitPrefabMutation(context, document, result, label) {
|
|
443
|
+
if (!result.changed)
|
|
444
|
+
return;
|
|
445
|
+
const next = structuredClone(document);
|
|
446
|
+
const index = next.assets.findIndex(asset => asset.id === result.prefabAsset.id);
|
|
447
|
+
if (index < 0)
|
|
448
|
+
throw new Error(`Prefab asset disappeared during mutation: ${result.prefabAsset.id}`);
|
|
449
|
+
next.assets[index] = result.prefabAsset;
|
|
450
|
+
context.dispatch({ type: 'document.replace', document: next, label });
|
|
451
|
+
}
|
|
452
|
+
function prefabMutationFailure(result) {
|
|
453
|
+
const error = result.diagnostics.find(diagnostic => diagnostic.severity === 'error');
|
|
454
|
+
return error ? commandFailure(error.code, error.message) : null;
|
|
455
|
+
}
|
|
456
|
+
function createPrefabSceneOutput(prefab, dirty) {
|
|
457
|
+
const nodes = readEditorScenePrefabNodes(prefab);
|
|
458
|
+
return {
|
|
459
|
+
stage: toHeadlessPrefabStage(prefab, dirty),
|
|
460
|
+
rootNodeId: readEditorScenePrefabRootNodeId(prefab) ?? 'prefab-root',
|
|
461
|
+
selectedNodeId: null,
|
|
462
|
+
nodes: nodes.map(toCommandPrefabNode),
|
|
463
|
+
diagnostics: [],
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function toPrefabSummary(asset) {
|
|
467
|
+
return {
|
|
468
|
+
assetId: asset.id,
|
|
469
|
+
displayName: asset.displayName ?? asset.id,
|
|
470
|
+
...(asset.prefab?.sourceAssetId ? { sourceAssetId: asset.prefab.sourceAssetId } : {}),
|
|
471
|
+
...(asset.prefab?.sourceAssetGuid ? { sourceAssetGuid: asset.prefab.sourceAssetGuid } : {}),
|
|
472
|
+
placeable: true,
|
|
473
|
+
readonly: false,
|
|
474
|
+
status: 'available',
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function toHeadlessPrefabStage(asset, dirty) {
|
|
478
|
+
return {
|
|
479
|
+
assetId: asset.id,
|
|
480
|
+
label: asset.displayName ?? asset.id,
|
|
481
|
+
...(asset.prefab?.sourceAssetId ? { sourceAssetId: asset.prefab.sourceAssetId } : {}),
|
|
482
|
+
...(asset.prefab?.sourceAssetGuid ? { sourceAssetGuid: asset.prefab.sourceAssetGuid } : {}),
|
|
483
|
+
selectedItemId: null,
|
|
484
|
+
readonly: false,
|
|
485
|
+
dirty,
|
|
486
|
+
documentDirty: dirty,
|
|
487
|
+
canSave: dirty,
|
|
488
|
+
canDiscard: dirty,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function toCommandPrefabNode(node) {
|
|
492
|
+
return {
|
|
493
|
+
nodeId: node.id,
|
|
494
|
+
...(node.guid ? { guid: node.guid } : {}),
|
|
495
|
+
...(node.name ? { name: node.name } : {}),
|
|
496
|
+
parentNodeId: node.parentId ?? null,
|
|
497
|
+
kind: node.kind,
|
|
498
|
+
...(node.transform && node.transform.mode !== 'matrix' ? { transform: {
|
|
499
|
+
position: { ...node.transform.position },
|
|
500
|
+
rotation: { ...node.transform.rotation },
|
|
501
|
+
scale: { ...(node.transform.scale ?? { x: 1, y: 1, z: 1 }) },
|
|
502
|
+
} } : {}),
|
|
503
|
+
...(node.sourceAssetId ? { sourceAssetId: node.sourceAssetId } : {}),
|
|
504
|
+
...(node.sourceNodePath ? { sourceNodePath: node.sourceNodePath } : {}),
|
|
505
|
+
...(node.childPrefabId ? { childPrefabId: node.childPrefabId } : {}),
|
|
506
|
+
...(node.primitive ? { primitive: node.primitive } : {}),
|
|
507
|
+
...(node.marker ? { marker: node.marker } : {}),
|
|
508
|
+
...(node.defaults ? { defaults: node.defaults } : {}),
|
|
509
|
+
...(node.overrides ? { overrides: node.overrides } : {}),
|
|
510
|
+
readonly: false,
|
|
511
|
+
diagnostics: [],
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function readTransform(input) {
|
|
515
|
+
const position = readVec3(input.position);
|
|
516
|
+
const rotation = readVec3(input.rotation);
|
|
517
|
+
const scale = readVec3(input.scale);
|
|
518
|
+
if (!position && !rotation && !scale)
|
|
519
|
+
return null;
|
|
520
|
+
return {
|
|
521
|
+
type: 'Transform',
|
|
522
|
+
position: position ?? { x: 0, y: 0, z: 0 },
|
|
523
|
+
rotation: rotation ?? { x: 0, y: 0, z: 0 },
|
|
524
|
+
scale: scale ?? { x: 1, y: 1, z: 1 },
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function readVec3(value) {
|
|
528
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
529
|
+
return null;
|
|
530
|
+
const vector = value;
|
|
531
|
+
return typeof vector.x === 'number' && typeof vector.y === 'number' && typeof vector.z === 'number'
|
|
532
|
+
? { x: vector.x, y: vector.y, z: vector.z }
|
|
533
|
+
: null;
|
|
534
|
+
}
|
|
535
|
+
function identityTransform() {
|
|
536
|
+
return {
|
|
537
|
+
type: 'Transform',
|
|
538
|
+
position: { x: 0, y: 0, z: 0 },
|
|
539
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
540
|
+
scale: { x: 1, y: 1, z: 1 },
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function registerProjectDocumentCommands(host, server, preparedExports) {
|
|
544
|
+
const unregister = [];
|
|
545
|
+
let authoringSourceCursor = readProjectAuthoringSourceCursor(host.getSnapshot().document);
|
|
546
|
+
const register = (manifest, handler, expectedRevisionPolicy) => unregister.push(host.registerCommand({
|
|
547
|
+
manifest,
|
|
548
|
+
handler,
|
|
549
|
+
...(expectedRevisionPolicy ? { expectedRevisionPolicy } : {}),
|
|
550
|
+
}));
|
|
551
|
+
try {
|
|
552
|
+
register({
|
|
553
|
+
schemaVersion: EDITOR_COMMAND_SCHEMA_VERSION,
|
|
554
|
+
id: 'authoring.proposal.commit',
|
|
555
|
+
version: 1,
|
|
556
|
+
title: 'Commit Browser Authoring Proposal',
|
|
557
|
+
description: 'Commits a Browser-composed document through the project Authoring Host while preserving the originating command identity.',
|
|
558
|
+
target: 'authoring',
|
|
559
|
+
access: 'write',
|
|
560
|
+
stability: 'experimental',
|
|
561
|
+
requires: { viewAttached: true },
|
|
562
|
+
inputSchema: {
|
|
563
|
+
type: 'object',
|
|
564
|
+
additionalProperties: false,
|
|
565
|
+
required: ['commandId', 'inputFingerprint', 'document'],
|
|
566
|
+
properties: {
|
|
567
|
+
commandId: { type: 'string', minLength: 1 },
|
|
568
|
+
inputFingerprint: { type: 'string' },
|
|
569
|
+
document: { type: 'object' },
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
outputSchema: { type: 'object' },
|
|
573
|
+
effects: { persistence: 'authoring', undoable: true, idempotent: false },
|
|
574
|
+
presentation: { category: 'Authoring', inputMode: 'schema-form' },
|
|
575
|
+
}, (input, context) => {
|
|
576
|
+
if (context.source !== 'browser-ui' || context.principal.type !== 'human' || !context.clientId) {
|
|
577
|
+
return commandFailure('authoring.proposal.browserRequired', 'Authoring proposals are accepted only from the authenticated Browser UI.');
|
|
578
|
+
}
|
|
579
|
+
if (context.intentCommandId !== input.commandId) {
|
|
580
|
+
return commandFailure('authoring.proposal.identityMismatch', 'Browser authoring proposal identity does not match the invocation intent.');
|
|
581
|
+
}
|
|
582
|
+
const document = normalizeDocument(input.document);
|
|
583
|
+
context.dispatch({ type: 'document.replace', document, label: input.commandId });
|
|
584
|
+
const state = context.session.getState({ cloneDocuments: false });
|
|
585
|
+
return { ok: true, output: {
|
|
586
|
+
intentCommandId: input.commandId,
|
|
587
|
+
inputFingerprint: input.inputFingerprint,
|
|
588
|
+
documentRevision: state.documentRevision,
|
|
589
|
+
dirty: state.dirty,
|
|
590
|
+
} };
|
|
591
|
+
});
|
|
592
|
+
register(documentManifest('document.save', 'Save Project Document'), async (_input, context) => {
|
|
593
|
+
const backend = getFpsGameEditorProjectAuthoringBackend(server);
|
|
594
|
+
if (!backend)
|
|
595
|
+
return commandFailure('document.persistenceUnavailable', 'Project authoring persistence is unavailable.');
|
|
596
|
+
const document = rebaseProjectAuthoringSourceRevision(context.session.getWorkingDocument(), authoringSourceCursor);
|
|
597
|
+
const result = await backend.saveEditorScene({
|
|
598
|
+
saveMode: 'local-commit-save',
|
|
599
|
+
rawEditorScene: document,
|
|
600
|
+
body: createExpectedAuthoringSourceRevisionBody(authoringSourceCursor),
|
|
601
|
+
});
|
|
602
|
+
const savedDocument = readPreparedProjectDocument(result);
|
|
603
|
+
authoringSourceCursor = readProjectAuthoringSourceCursor(savedDocument)
|
|
604
|
+
?? authoringSourceCursor;
|
|
605
|
+
context.session.markSaved(savedDocument);
|
|
606
|
+
const state = context.session.getState({ cloneDocuments: false });
|
|
607
|
+
return { ok: true, output: summarizeSaveResult(result, state.documentRevision) };
|
|
608
|
+
});
|
|
609
|
+
register(documentManifest('document.export', 'Prepare Project Export'), async (_input, context) => {
|
|
610
|
+
const backend = getFpsGameEditorProjectAuthoringBackend(server);
|
|
611
|
+
if (!backend)
|
|
612
|
+
return commandFailure('document.persistenceUnavailable', 'Project authoring persistence is unavailable.');
|
|
613
|
+
const state = context.session.getState({ cloneDocuments: false });
|
|
614
|
+
const document = rebaseProjectAuthoringSourceRevision(state.workingDocument, authoringSourceCursor);
|
|
615
|
+
const result = await backend.saveEditorScene({
|
|
616
|
+
saveMode: 'prepare-platform-save',
|
|
617
|
+
rawEditorScene: document,
|
|
618
|
+
body: createExpectedAuthoringSourceRevisionBody(authoringSourceCursor),
|
|
619
|
+
});
|
|
620
|
+
const preparedDocument = readPreparedProjectDocument(result);
|
|
621
|
+
authoringSourceCursor = readProjectAuthoringSourceCursor(preparedDocument)
|
|
622
|
+
?? authoringSourceCursor;
|
|
623
|
+
const transactionId = randomUUID();
|
|
624
|
+
preparedExports.set(transactionId, {
|
|
625
|
+
transactionId,
|
|
626
|
+
documentRevision: state.documentRevision,
|
|
627
|
+
document: preparedDocument,
|
|
628
|
+
sceneJsonText: readRequiredSceneJsonText(result),
|
|
629
|
+
...(typeof result.expectedVersion === 'number'
|
|
630
|
+
? { expectedVersion: result.expectedVersion }
|
|
631
|
+
: {}),
|
|
632
|
+
});
|
|
633
|
+
while (preparedExports.size > 32)
|
|
634
|
+
preparedExports.delete(preparedExports.keys().next().value);
|
|
635
|
+
return { ok: true, output: { ...summarizeSaveResult(result, state.documentRevision), transactionId } };
|
|
636
|
+
});
|
|
637
|
+
register(documentManifest('document.commit', 'Commit Saved Checkpoint', {
|
|
638
|
+
type: 'object',
|
|
639
|
+
additionalProperties: false,
|
|
640
|
+
required: ['transactionId'],
|
|
641
|
+
properties: { transactionId: { type: 'string', minLength: 1 } },
|
|
642
|
+
}), (input, context) => {
|
|
643
|
+
const prepared = preparedExports.get(input.transactionId);
|
|
644
|
+
if (!prepared)
|
|
645
|
+
return commandFailure('document.commitUnavailable', 'Prepared export transaction is missing, stale, or already committed.');
|
|
646
|
+
if (context.expectedRevision?.document !== prepared.documentRevision) {
|
|
647
|
+
return commandFailure('document.commitRevisionMismatch', `Prepared export revision ${prepared.documentRevision} does not match expected revision ${String(context.expectedRevision?.document)}.`);
|
|
648
|
+
}
|
|
649
|
+
const currentState = context.session.getState({ cloneDocuments: false });
|
|
650
|
+
if (currentState.documentRevision === prepared.documentRevision) {
|
|
651
|
+
context.session.markSaved(prepared.document);
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
context.session.markPersistedCheckpoint(prepared.document);
|
|
655
|
+
}
|
|
656
|
+
preparedExports.delete(input.transactionId);
|
|
657
|
+
const state = context.session.getState({ cloneDocuments: false });
|
|
658
|
+
return { ok: true, output: {
|
|
659
|
+
transactionId: input.transactionId,
|
|
660
|
+
preparedRevision: prepared.documentRevision,
|
|
661
|
+
documentRevision: state.documentRevision,
|
|
662
|
+
dirty: state.dirty,
|
|
663
|
+
} };
|
|
664
|
+
}, 'handler-validated');
|
|
665
|
+
}
|
|
666
|
+
catch (error) {
|
|
667
|
+
for (const dispose of unregister.splice(0).reverse())
|
|
668
|
+
dispose();
|
|
669
|
+
throw error;
|
|
670
|
+
}
|
|
671
|
+
return () => { for (const dispose of unregister.splice(0).reverse())
|
|
672
|
+
dispose(); };
|
|
673
|
+
}
|
|
674
|
+
function readProjectAuthoringSourceCursor(document) {
|
|
675
|
+
const record = document && typeof document === 'object' && !Array.isArray(document)
|
|
676
|
+
? document
|
|
677
|
+
: null;
|
|
678
|
+
const meta = record?.meta && typeof record.meta === 'object' && !Array.isArray(record.meta)
|
|
679
|
+
? record.meta
|
|
680
|
+
: null;
|
|
681
|
+
const source = meta?.authoringSource
|
|
682
|
+
&& typeof meta.authoringSource === 'object'
|
|
683
|
+
&& !Array.isArray(meta.authoringSource)
|
|
684
|
+
? meta.authoringSource
|
|
685
|
+
: null;
|
|
686
|
+
return typeof source?.sourceId === 'string' && source.sourceId.trim()
|
|
687
|
+
&& typeof source.sourceType === 'string' && source.sourceType.trim()
|
|
688
|
+
&& typeof source.revision === 'number' && Number.isFinite(source.revision)
|
|
689
|
+
? {
|
|
690
|
+
sourceId: source.sourceId,
|
|
691
|
+
sourceType: source.sourceType,
|
|
692
|
+
revision: source.revision,
|
|
693
|
+
}
|
|
694
|
+
: null;
|
|
695
|
+
}
|
|
696
|
+
function rebaseProjectAuthoringSourceRevision(document, cursor) {
|
|
697
|
+
const clone = structuredClone(document);
|
|
698
|
+
if (cursor === null)
|
|
699
|
+
return clone;
|
|
700
|
+
const current = readProjectAuthoringSourceCursor(clone);
|
|
701
|
+
if (current?.sourceId === cursor.sourceId
|
|
702
|
+
&& current.sourceType === cursor.sourceType
|
|
703
|
+
&& current.revision === cursor.revision)
|
|
704
|
+
return clone;
|
|
705
|
+
const meta = clone.meta && typeof clone.meta === 'object' && !Array.isArray(clone.meta)
|
|
706
|
+
? clone.meta
|
|
707
|
+
: {};
|
|
708
|
+
meta.authoringSource = { ...cursor };
|
|
709
|
+
clone.meta = meta;
|
|
710
|
+
return clone;
|
|
711
|
+
}
|
|
712
|
+
function createExpectedAuthoringSourceRevisionBody(cursor) {
|
|
713
|
+
return cursor === null ? {} : { expectedAuthoringSourceRevision: cursor.revision };
|
|
714
|
+
}
|
|
715
|
+
function readPreparedProjectDocument(result) {
|
|
716
|
+
if (!result.editorScene) {
|
|
717
|
+
throw new Error('Project authoring backend did not return the prepared editor scene.');
|
|
718
|
+
}
|
|
719
|
+
return normalizeDocument(result.editorScene);
|
|
720
|
+
}
|
|
721
|
+
function readRequiredSceneJsonText(result) {
|
|
722
|
+
if (typeof result.sceneJsonText === 'string' && result.sceneJsonText.trim()) {
|
|
723
|
+
return result.sceneJsonText;
|
|
724
|
+
}
|
|
725
|
+
throw new Error('Project authoring backend did not return the prepared runtime scene artifact.');
|
|
726
|
+
}
|
|
727
|
+
function registerProjectViewCommands(host, forward) {
|
|
728
|
+
const unregister = [];
|
|
729
|
+
const register = (manifest) => unregister.push(host.registerCommand({
|
|
730
|
+
manifest,
|
|
731
|
+
handler: (_input, context) => forward(context, manifest.target),
|
|
732
|
+
}));
|
|
733
|
+
try {
|
|
734
|
+
for (const commandId of Object.keys(EDITOR_COMMAND_BUILT_IN_METADATA)) {
|
|
735
|
+
const target = EDITOR_COMMAND_BUILT_IN_TARGETS[commandId];
|
|
736
|
+
if (target !== 'view' && target !== 'renderer')
|
|
737
|
+
continue;
|
|
738
|
+
register(browserCommandManifest(commandId, target));
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
catch (error) {
|
|
742
|
+
for (const dispose of unregister.splice(0).reverse())
|
|
743
|
+
dispose();
|
|
744
|
+
throw error;
|
|
745
|
+
}
|
|
746
|
+
return () => { for (const dispose of unregister.splice(0).reverse())
|
|
747
|
+
dispose(); };
|
|
748
|
+
}
|
|
749
|
+
function browserCommandManifest(id, target) {
|
|
750
|
+
const schema = EDITOR_COMMAND_SCHEMAS[id];
|
|
751
|
+
const metadata = EDITOR_COMMAND_BUILT_IN_METADATA[id];
|
|
752
|
+
if (!metadata)
|
|
753
|
+
throw new Error(`Editor command metadata is missing: ${id}`);
|
|
754
|
+
const access = metadata.access;
|
|
755
|
+
const presentation = EDITOR_COMMAND_BUILT_IN_PRESENTATION[id];
|
|
756
|
+
return {
|
|
757
|
+
schemaVersion: EDITOR_COMMAND_SCHEMA_VERSION,
|
|
758
|
+
id,
|
|
759
|
+
version: 1,
|
|
760
|
+
title: metadata.title,
|
|
761
|
+
target,
|
|
762
|
+
access,
|
|
763
|
+
stability: metadata.stability,
|
|
764
|
+
inputSchema: schema?.inputSchema ?? { type: 'object' },
|
|
765
|
+
outputSchema: schema?.outputSchema ?? { type: 'object' },
|
|
766
|
+
requires: {
|
|
767
|
+
editorReady: true,
|
|
768
|
+
...(target === 'view' ? { viewAttached: true } : { rendererAttached: true }),
|
|
769
|
+
},
|
|
770
|
+
effects: {
|
|
771
|
+
persistence: access === 'read' ? 'none' : 'view',
|
|
772
|
+
undoable: false,
|
|
773
|
+
idempotent: access === 'read',
|
|
774
|
+
},
|
|
775
|
+
presentation: {
|
|
776
|
+
category: metadata.category,
|
|
777
|
+
inputMode: Array.isArray(schema?.inputSchema.required) && schema.inputSchema.required.length
|
|
778
|
+
? 'schema-form'
|
|
779
|
+
: 'none',
|
|
780
|
+
...(presentation?.aliases ? { aliases: presentation.aliases } : {}),
|
|
781
|
+
...(presentation?.keywords ? { keywords: presentation.keywords } : {}),
|
|
782
|
+
...(presentation?.examples ? { examples: presentation.examples } : {}),
|
|
783
|
+
...(presentation?.shortcut ? { shortcut: presentation.shortcut } : {}),
|
|
784
|
+
...(presentation?.menu ? { menu: presentation.menu } : {}),
|
|
785
|
+
},
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
function documentManifest(id, title, inputSchema = { type: 'object', additionalProperties: false }) {
|
|
789
|
+
return {
|
|
790
|
+
schemaVersion: EDITOR_COMMAND_SCHEMA_VERSION,
|
|
791
|
+
id,
|
|
792
|
+
version: 1,
|
|
793
|
+
title,
|
|
794
|
+
target: 'authoring',
|
|
795
|
+
access: 'write',
|
|
796
|
+
stability: 'stable',
|
|
797
|
+
inputSchema,
|
|
798
|
+
outputSchema: { type: 'object' },
|
|
799
|
+
effects: { persistence: 'filesystem', undoable: false, idempotent: false },
|
|
800
|
+
presentation: {
|
|
801
|
+
category: 'Document',
|
|
802
|
+
inputMode: Array.isArray(inputSchema.required) && inputSchema.required.length ? 'schema-form' : 'none',
|
|
803
|
+
...(id === 'document.save' ? {
|
|
804
|
+
shortcut: 'Mod+S',
|
|
805
|
+
menu: { path: ['File', 'Save'] },
|
|
806
|
+
} : {}),
|
|
807
|
+
},
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
function summarizeSaveResult(result, documentRevision) {
|
|
811
|
+
const sceneJsonText = typeof result.sceneJsonText === 'string' ? result.sceneJsonText : undefined;
|
|
812
|
+
return {
|
|
813
|
+
documentRevision,
|
|
814
|
+
...(typeof result.expectedVersion === 'number' ? { expectedVersion: result.expectedVersion } : {}),
|
|
815
|
+
...(sceneJsonText ? { sceneJsonBytes: Buffer.byteLength(sceneJsonText) } : {}),
|
|
816
|
+
prepared: true,
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
function commandFailure(code, message) {
|
|
820
|
+
return { ok: false, diagnostics: [{ severity: 'error', source: 'adapter', code, message }] };
|
|
821
|
+
}
|
|
822
|
+
function createBaseObject(id, name, parentId) {
|
|
823
|
+
return {
|
|
824
|
+
id,
|
|
825
|
+
guid: `go_${randomUUID()}`,
|
|
826
|
+
name,
|
|
827
|
+
active: true,
|
|
828
|
+
...(parentId ? { parentId } : {}),
|
|
829
|
+
components: [{
|
|
830
|
+
type: 'Transform',
|
|
831
|
+
position: { x: 0, y: 0, z: 0 },
|
|
832
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
833
|
+
scale: { x: 1, y: 1, z: 1 },
|
|
834
|
+
}],
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
function getTransform(object) {
|
|
838
|
+
const components = Array.isArray(object.components) ? object.components : [];
|
|
839
|
+
return components.find(component => component && typeof component === 'object'
|
|
840
|
+
&& component.type === 'Transform') ?? null;
|
|
841
|
+
}
|
|
842
|
+
function uniqueObjectId(document, prefix) {
|
|
843
|
+
const safePrefix = slug(prefix) || 'object';
|
|
844
|
+
const ids = new Set(document.scene.gameObjects.map(object => object.id));
|
|
845
|
+
if (!ids.has(safePrefix))
|
|
846
|
+
return safePrefix;
|
|
847
|
+
for (let sequence = 2; sequence < 10000; sequence += 1) {
|
|
848
|
+
const candidate = `${safePrefix}_${sequence}`;
|
|
849
|
+
if (!ids.has(candidate))
|
|
850
|
+
return candidate;
|
|
851
|
+
}
|
|
852
|
+
return `${safePrefix}_${randomUUID()}`;
|
|
853
|
+
}
|
|
854
|
+
function slug(value) {
|
|
855
|
+
return value.trim().toLocaleLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '');
|
|
856
|
+
}
|
|
857
|
+
function titleCase(value) {
|
|
858
|
+
return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : 'Object';
|
|
859
|
+
}
|
|
860
|
+
function readString(value) {
|
|
861
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
862
|
+
}
|
|
863
|
+
//# sourceMappingURL=project-editor-service.js.map
|