@fps-games/editor 0.1.5-beta.5 → 0.1.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-bridge/capabilities/assets.d.ts +8 -0
- package/dist/agent-bridge/capabilities/assets.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/assets.js +226 -0
- package/dist/agent-bridge/capabilities/assets.js.map +1 -0
- package/dist/agent-bridge/capabilities/editor-state.d.ts +5 -0
- package/dist/agent-bridge/capabilities/editor-state.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/editor-state.js +72 -0
- package/dist/agent-bridge/capabilities/editor-state.js.map +1 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts +4 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.js +87 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.js.map +1 -0
- package/dist/agent-bridge/capabilities/prefabs.d.ts +5 -0
- package/dist/agent-bridge/capabilities/prefabs.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/prefabs.js +735 -0
- package/dist/agent-bridge/capabilities/prefabs.js.map +1 -0
- package/dist/agent-bridge/capabilities/scene-objects.d.ts +9 -0
- package/dist/agent-bridge/capabilities/scene-objects.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/scene-objects.js +394 -0
- package/dist/agent-bridge/capabilities/scene-objects.js.map +1 -0
- package/dist/agent-bridge/capabilities/selection.d.ts +5 -0
- package/dist/agent-bridge/capabilities/selection.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/selection.js +57 -0
- package/dist/agent-bridge/capabilities/selection.js.map +1 -0
- package/dist/agent-bridge/capabilities/shadows.d.ts +5 -0
- package/dist/agent-bridge/capabilities/shadows.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/shadows.js +1876 -0
- package/dist/agent-bridge/capabilities/shadows.js.map +1 -0
- package/dist/agent-bridge/capabilities/transform.d.ts +5 -0
- package/dist/agent-bridge/capabilities/transform.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/transform.js +162 -0
- package/dist/agent-bridge/capabilities/transform.js.map +1 -0
- package/dist/agent-bridge/capabilities/ui-regions.d.ts +4 -0
- package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/ui-regions.js +168 -0
- package/dist/agent-bridge/capabilities/ui-regions.js.map +1 -0
- package/dist/agent-bridge/capabilities/viewport.d.ts +5 -0
- package/dist/agent-bridge/capabilities/viewport.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/viewport.js +407 -0
- package/dist/agent-bridge/capabilities/viewport.js.map +1 -0
- package/dist/agent-bridge/capability-sources.d.ts +6 -0
- package/dist/agent-bridge/capability-sources.d.ts.map +1 -0
- package/dist/agent-bridge/capability-sources.js +26 -0
- package/dist/agent-bridge/capability-sources.js.map +1 -0
- package/dist/agent-bridge/diagnostics.d.ts +12 -0
- package/dist/agent-bridge/diagnostics.d.ts.map +1 -0
- package/dist/agent-bridge/diagnostics.js +45 -0
- package/dist/agent-bridge/diagnostics.js.map +1 -0
- package/dist/agent-bridge/index.d.ts +5 -0
- package/dist/agent-bridge/index.d.ts.map +1 -0
- package/dist/agent-bridge/index.js +5 -0
- package/dist/agent-bridge/index.js.map +1 -0
- package/dist/agent-bridge/register.d.ts +4 -0
- package/dist/agent-bridge/register.d.ts.map +1 -0
- package/dist/agent-bridge/register.js +908 -0
- package/dist/agent-bridge/register.js.map +1 -0
- package/dist/agent-bridge/shared.d.ts +189 -0
- package/dist/agent-bridge/shared.d.ts.map +1 -0
- package/dist/agent-bridge/shared.js +39 -0
- package/dist/agent-bridge/shared.js.map +1 -0
- package/dist/agent-bridge/source-types.d.ts +90 -0
- package/dist/agent-bridge/source-types.d.ts.map +1 -0
- package/dist/agent-bridge/source-types.js +2 -0
- package/dist/agent-bridge/source-types.js.map +1 -0
- package/dist/build-info.json +17 -17
- package/dist/local-editor-agent-actions.d.ts +8 -1
- package/dist/local-editor-agent-actions.d.ts.map +1 -1
- package/dist/local-editor-agent-actions.js +171 -12
- package/dist/local-editor-agent-actions.js.map +1 -1
- package/dist/local-editor-agent-bridge-transport.d.ts +95 -0
- package/dist/local-editor-agent-bridge-transport.d.ts.map +1 -0
- package/dist/local-editor-agent-bridge-transport.js +340 -0
- package/dist/local-editor-agent-bridge-transport.js.map +1 -0
- package/dist/local-editor-agent-bridge.d.ts +2 -0
- package/dist/local-editor-agent-bridge.d.ts.map +1 -0
- package/dist/local-editor-agent-bridge.js +2 -0
- package/dist/local-editor-agent-bridge.js.map +1 -0
- package/dist/local-editor-agent-context.d.ts +29 -1
- package/dist/local-editor-agent-context.d.ts.map +1 -1
- package/dist/local-editor-agent-context.js +403 -0
- package/dist/local-editor-agent-context.js.map +1 -1
- package/dist/local-editor-harness.d.ts +128 -6
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +2730 -151
- package/dist/local-editor-harness.js.map +1 -1
- package/dist/local-editor-marker-graph.d.ts +92 -0
- package/dist/local-editor-marker-graph.d.ts.map +1 -0
- package/dist/local-editor-marker-graph.js +1432 -0
- package/dist/local-editor-marker-graph.js.map +1 -0
- package/dist/local-editor-performance-stats.js +1 -1
- package/dist/local-editor-performance-stats.js.map +1 -1
- package/dist/playable-babylon-facade.d.ts +2 -2
- package/dist/playable-babylon-facade.d.ts.map +1 -1
- package/dist/playable-babylon-facade.js +1 -1
- package/dist/playable-babylon-facade.js.map +1 -1
- package/dist/playable-babylon-rendering.js +20 -0
- package/dist/playable-babylon-rendering.js.map +1 -1
- package/dist/playable-local-editor-host.d.ts +57 -7
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js +25 -1
- package/dist/playable-local-editor-host.js.map +1 -1
- package/dist/playable-sdk.d.ts +4 -2
- package/dist/playable-sdk.d.ts.map +1 -1
- package/dist/playable-sdk.js +2 -1
- package/dist/playable-sdk.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/blob-shadow-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/blob-shadow-system.js +6 -4
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/blob-shadow-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-shaders.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-shaders.js +103 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-shaders.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-system.js +330 -27
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.js +159 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.js +8 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.d.ts +53 -2
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.js +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.js +11 -0
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/editor-sky.d.ts +3 -1
- package/node_modules/@fps-games/editor-babylon/dist/editor-sky.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/editor-sky.js +114 -18
- package/node_modules/@fps-games/editor-babylon/dist/editor-sky.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.d.ts +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.js +3 -0
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/index.d.ts +3 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/index.js +3 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.d.ts +52 -0
- package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js +1395 -0
- package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.js +4 -65
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/material-slot-source-resolver.d.ts +28 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-slot-source-resolver.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-slot-source-resolver.js +235 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-slot-source-resolver.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/prefab-comparison-preview-controller.d.ts +37 -0
- package/node_modules/@fps-games/editor-babylon/dist/prefab-comparison-preview-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/prefab-comparison-preview-controller.js +451 -0
- package/node_modules/@fps-games/editor-babylon/dist/prefab-comparison-preview-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection-asset-container-importer.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection-asset-container-importer.js +14 -3
- package/node_modules/@fps-games/editor-babylon/dist/projection-asset-container-importer.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection-pick-resolver.d.ts +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection-pick-resolver.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection-pick-resolver.js +20 -4
- package/node_modules/@fps-games/editor-babylon/dist/projection-pick-resolver.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection-source-owner-path.d.ts +3 -6
- package/node_modules/@fps-games/editor-babylon/dist/projection-source-owner-path.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection-source-owner-path.js +4 -37
- package/node_modules/@fps-games/editor-babylon/dist/projection-source-owner-path.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +74 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +641 -52
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts +11 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js +113 -29
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.d.ts +13 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.js +543 -3
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +5 -5
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +8 -2
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js +4 -0
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.d.ts +5 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js +23 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-context-menu.js +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-context-menu.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-actions.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-actions.js +76 -9
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-actions.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-attach-dialog.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-attach-dialog.js +3 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-attach-dialog.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.d.ts +21 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.js +75 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts +2 -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 +326 -72
- 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-scope.d.ts +5 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.js +92 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.d.ts +4 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.js +22 -7
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts +4 -0
- 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 +24 -11
- 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-icons.d.ts +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js +7 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.js +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +4 -0
- 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 +1471 -29
- 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-prefab-stage.d.ts +70 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +171 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.d.ts +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js +2 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.js +9 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +301 -3
- 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-workbench.d.ts +12 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +13 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +6 -4
- 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 +1501 -122
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +3 -3
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts +18 -0
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js +102 -0
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.js +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/scene-graph.d.ts +1 -1
- package/node_modules/@fps-games/editor-core/dist/scene-graph.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts +3 -1
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.js +1 -0
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.js.map +1 -1
- package/node_modules/@fps-games/editor-core/package.json +2 -2
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.js +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.d.ts +6 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.js +89 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.d.ts +18 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.js +121 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.d.ts +4 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.d.ts +27 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.js +782 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.js +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.d.ts +80 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.js +600 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.d.ts +51 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.js +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js +17 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/document.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/document.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/document.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/types.d.ts +3 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.js +48 -20
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/types.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts +97 -2
- 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 +1143 -8
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/types.d.ts +145 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.js +24 -9
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.d.ts +6 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.js +31 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.d.ts +82 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.js +396 -22
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/validation.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/validation.js +0 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/validation.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.d.ts +29 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.js +143 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.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 +3 -7
- 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/material-binding/binding.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js +6 -0
- 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/types.d.ts +2 -10
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js +107 -11
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.js +4 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/transform.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/transform.js +19 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/transform.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js +19 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.d.ts +1 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.js +0 -14
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.d.ts +1 -7
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.js +3 -32
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js +82 -63
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/types.d.ts +7 -23
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.js +996 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.d.ts +152 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.js +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/protocol.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/protocol.js +44 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/protocol.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js +244 -12
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.js +216 -67
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/object.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/object.js +7 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/object.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/patch.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/patch.js +45 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/patch.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/hierarchy.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/hierarchy.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/hierarchy.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.js +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.d.ts +21 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.js +158 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.js +83 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.d.ts +35 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.js +363 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.d.ts +105 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.js +6 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.js +44 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.d.ts +26 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.js +105 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +3 -0
- 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 +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/package.json +3 -3
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts +1127 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js +2180 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts +68 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js +23 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +57 -3
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +21 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.js +3 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/marker-graph.d.ts +128 -0
- package/node_modules/@fps-games/editor-protocol/dist/marker-graph.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/marker-graph.js +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/marker-graph.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/package.json +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,996 @@
|
|
|
1
|
+
import { findEditorSceneModelRenderer, findEditorSceneTransform, isEditorScenePrefabAsset, mergeEditorSceneMaterialBindingOverrides, mergeEditorScenePrefabOverrides, readEditorSceneNodeKind, readEditorScenePrefabNodes, readEditorScenePrefabRootNodeId, resolveEditorSceneGameObjectRendering, resolveEditorScenePrefabInstanceRelation, } from '../document/index.js';
|
|
2
|
+
import { resolveEditorSceneMaterialAssetIntegrity, resolveEditorSceneMaterialSlotReimportDiff, } from '../material-binding/index.js';
|
|
3
|
+
import { mergeEditorShadowSettings, readEditorShadowSettingsWithLegacy, resolveEditorShadowPlan, } from '../shadow-system/index.js';
|
|
4
|
+
import { getEditorSceneAuthoringSourceRef, } from '../authoring/index.js';
|
|
5
|
+
export const PLAYABLE_EDITOR_SCENE_COMPILER_ID = '@fps-games/editor.playable-sdk.scene-compiler';
|
|
6
|
+
export const PLAYABLE_EDITOR_SCENE_COMPILER_VERSION = '1';
|
|
7
|
+
export function compileEditorSceneDocumentToSceneConfig(editorDocument, baseSceneConfig) {
|
|
8
|
+
const nextSceneConfig = structuredClone(baseSceneConfig);
|
|
9
|
+
const previousScene = isRecord(nextSceneConfig.scene)
|
|
10
|
+
? nextSceneConfig.scene
|
|
11
|
+
: undefined;
|
|
12
|
+
const sourceRef = getEditorSceneAuthoringSourceRef(editorDocument);
|
|
13
|
+
const generatedFrom = {
|
|
14
|
+
...sourceRef,
|
|
15
|
+
compilerId: PLAYABLE_EDITOR_SCENE_COMPILER_ID,
|
|
16
|
+
compilerVersion: PLAYABLE_EDITOR_SCENE_COMPILER_VERSION,
|
|
17
|
+
compiledAt: new Date().toISOString(),
|
|
18
|
+
};
|
|
19
|
+
nextSceneConfig.schemaVersion = 2;
|
|
20
|
+
nextSceneConfig.meta = {
|
|
21
|
+
...(nextSceneConfig.meta ?? {}),
|
|
22
|
+
generatedFrom,
|
|
23
|
+
};
|
|
24
|
+
const rootId = previousScene?.rootId || 'root';
|
|
25
|
+
const compiledGameObjects = editorDocument.scene.gameObjects
|
|
26
|
+
.filter((gameObject) => gameObject.id !== rootId);
|
|
27
|
+
const materialAssets = resolveCompiledEditorSceneMaterialAssets(editorDocument, previousScene?.materialAssets);
|
|
28
|
+
const documentWithResolvedMaterialAssets = {
|
|
29
|
+
...editorDocument,
|
|
30
|
+
scene: {
|
|
31
|
+
...editorDocument.scene,
|
|
32
|
+
materialAssets,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const compiledNodes = compiledGameObjects.flatMap(gameObject => compileGameObjectToRuntimeNodes(gameObject, sourceRef, documentWithResolvedMaterialAssets));
|
|
36
|
+
const compiledScene = {
|
|
37
|
+
rootId,
|
|
38
|
+
assets: documentWithResolvedMaterialAssets.assets
|
|
39
|
+
.filter(isEditorSceneModelAsset)
|
|
40
|
+
.map(compileAsset),
|
|
41
|
+
nodes: compiledNodes,
|
|
42
|
+
materialAssets,
|
|
43
|
+
materials: previousScene?.materials ?? [],
|
|
44
|
+
textures: previousScene?.textures ?? [],
|
|
45
|
+
};
|
|
46
|
+
nextSceneConfig.scene = compiledScene;
|
|
47
|
+
return {
|
|
48
|
+
sceneConfig: nextSceneConfig,
|
|
49
|
+
summary: {
|
|
50
|
+
assetCount: compiledScene.assets.length,
|
|
51
|
+
gameObjectCount: editorDocument.scene.gameObjects.length,
|
|
52
|
+
nodeCount: compiledScene.nodes.length,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function resolveCompiledEditorSceneMaterialAssets(editorDocument, previousMaterialAssets) {
|
|
57
|
+
const materialAssets = editorDocument.scene.materialAssets
|
|
58
|
+
? structuredClone(editorDocument.scene.materialAssets)
|
|
59
|
+
: (previousMaterialAssets ?? []).map(materialAsset => structuredClone(materialAsset));
|
|
60
|
+
const materialAssetIds = new Set(materialAssets.map(materialAsset => materialAsset.id));
|
|
61
|
+
const previousMaterialAssetById = new Map((previousMaterialAssets ?? []).map(materialAsset => [materialAsset.id, materialAsset]));
|
|
62
|
+
const integrity = resolveEditorSceneMaterialAssetIntegrity(createEditorSceneCompilerMaterialIntegrityDocument(editorDocument, materialAssets));
|
|
63
|
+
for (const materialAssetId of integrity.missingMaterialAssetIds) {
|
|
64
|
+
if (materialAssetIds.has(materialAssetId))
|
|
65
|
+
continue;
|
|
66
|
+
const previousMaterialAsset = previousMaterialAssetById.get(materialAssetId);
|
|
67
|
+
if (!previousMaterialAsset)
|
|
68
|
+
continue;
|
|
69
|
+
materialAssetIds.add(materialAssetId);
|
|
70
|
+
materialAssets.push(structuredClone(previousMaterialAsset));
|
|
71
|
+
}
|
|
72
|
+
return materialAssets;
|
|
73
|
+
}
|
|
74
|
+
function createEditorSceneCompilerMaterialIntegrityDocument(editorDocument, materialAssets) {
|
|
75
|
+
const documentWithMaterialAssets = {
|
|
76
|
+
...editorDocument,
|
|
77
|
+
scene: {
|
|
78
|
+
...editorDocument.scene,
|
|
79
|
+
materialAssets,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
...documentWithMaterialAssets,
|
|
84
|
+
scene: {
|
|
85
|
+
...documentWithMaterialAssets.scene,
|
|
86
|
+
gameObjects: [
|
|
87
|
+
...documentWithMaterialAssets.scene.gameObjects.map((gameObject) => {
|
|
88
|
+
const visualOverrides = compileEditorSceneVisualOverrides(gameObject, documentWithMaterialAssets);
|
|
89
|
+
if (visualOverrides) {
|
|
90
|
+
return {
|
|
91
|
+
...gameObject,
|
|
92
|
+
overrides: visualOverrides,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (!('overrides' in gameObject))
|
|
96
|
+
return gameObject;
|
|
97
|
+
const next = { ...gameObject };
|
|
98
|
+
delete next.overrides;
|
|
99
|
+
return next;
|
|
100
|
+
}),
|
|
101
|
+
...createEditorSceneCompilerPrefabMaterialIntegrityGameObjects(documentWithMaterialAssets),
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function createEditorSceneCompilerPrefabMaterialIntegrityGameObjects(editorDocument) {
|
|
107
|
+
const gameObjects = [];
|
|
108
|
+
for (const gameObject of editorDocument.scene.gameObjects) {
|
|
109
|
+
const relation = resolveEditorScenePrefabInstanceRelation(editorDocument, gameObject.id);
|
|
110
|
+
if (!relation.definition || !isExplicitEditorScenePrefabCompositionAsset(relation.definition))
|
|
111
|
+
continue;
|
|
112
|
+
gameObjects.push(...createEditorSceneCompilerPrefabCompositionMaterialIntegrityGameObjects({
|
|
113
|
+
editorDocument,
|
|
114
|
+
prefabAsset: relation.definition,
|
|
115
|
+
hostGameObject: gameObject,
|
|
116
|
+
instanceOverrides: gameObject.overrides,
|
|
117
|
+
visitedPrefabIds: new Set(),
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
return gameObjects;
|
|
121
|
+
}
|
|
122
|
+
function createEditorSceneCompilerPrefabCompositionMaterialIntegrityGameObjects(input) {
|
|
123
|
+
if (input.visitedPrefabIds.has(input.prefabAsset.id))
|
|
124
|
+
return [];
|
|
125
|
+
input.visitedPrefabIds.add(input.prefabAsset.id);
|
|
126
|
+
const nodes = orderEditorScenePrefabNodesForCompile(readEditorScenePrefabNodes(input.prefabAsset), readEditorScenePrefabRootNodeId(input.prefabAsset) ?? '');
|
|
127
|
+
const rootNode = nodes.find(node => node.id === readEditorScenePrefabRootNodeId(input.prefabAsset));
|
|
128
|
+
if (!rootNode) {
|
|
129
|
+
input.visitedPrefabIds.delete(input.prefabAsset.id);
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
const primaryModelNodeId = findEditorScenePrefabPrimaryModelNodeId(nodes, input.prefabAsset);
|
|
133
|
+
const gameObjects = [];
|
|
134
|
+
for (const node of nodes) {
|
|
135
|
+
if (node.kind === 'prefabInstance' && node.childPrefabId) {
|
|
136
|
+
const childPrefab = input.editorDocument.assets.find(asset => asset.id === node.childPrefabId);
|
|
137
|
+
if (childPrefab && isExplicitEditorScenePrefabCompositionAsset(childPrefab)) {
|
|
138
|
+
gameObjects.push(...createEditorSceneCompilerPrefabCompositionMaterialIntegrityGameObjects({
|
|
139
|
+
editorDocument: input.editorDocument,
|
|
140
|
+
prefabAsset: childPrefab,
|
|
141
|
+
hostGameObject: input.hostGameObject,
|
|
142
|
+
instanceOverrides: node.overrides,
|
|
143
|
+
visitedPrefabIds: new Set(input.visitedPrefabIds),
|
|
144
|
+
}));
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const legacyChildGameObject = createEditorSceneCompilerPrefabLegacyChildMaterialIntegrityGameObject({
|
|
148
|
+
editorDocument: input.editorDocument,
|
|
149
|
+
hostGameObject: input.hostGameObject,
|
|
150
|
+
node,
|
|
151
|
+
childPrefab,
|
|
152
|
+
});
|
|
153
|
+
if (legacyChildGameObject)
|
|
154
|
+
gameObjects.push(legacyChildGameObject);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const syntheticGameObject = createEditorSceneCompilerPrefabCompositionMaterialGameObject(input.hostGameObject, node);
|
|
158
|
+
if (!syntheticGameObject)
|
|
159
|
+
continue;
|
|
160
|
+
const asset = node.kind === 'model' && node.sourceAssetId
|
|
161
|
+
? input.editorDocument.assets.find(asset => asset.id === node.sourceAssetId)
|
|
162
|
+
: undefined;
|
|
163
|
+
const overrides = compileEditorScenePrefabCompositionVisualOverrides({
|
|
164
|
+
hostGameObject: syntheticGameObject,
|
|
165
|
+
prefabAsset: input.prefabAsset,
|
|
166
|
+
rootNode,
|
|
167
|
+
node,
|
|
168
|
+
asset,
|
|
169
|
+
editorDocument: input.editorDocument,
|
|
170
|
+
instanceOverrides: node.id === primaryModelNodeId ? input.instanceOverrides : undefined,
|
|
171
|
+
});
|
|
172
|
+
if (!overrides)
|
|
173
|
+
continue;
|
|
174
|
+
gameObjects.push({
|
|
175
|
+
...syntheticGameObject,
|
|
176
|
+
overrides,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
input.visitedPrefabIds.delete(input.prefabAsset.id);
|
|
180
|
+
return gameObjects;
|
|
181
|
+
}
|
|
182
|
+
function createEditorSceneCompilerPrefabLegacyChildMaterialIntegrityGameObject(input) {
|
|
183
|
+
const sourceAssetId = input.childPrefab?.prefab?.sourceAssetId;
|
|
184
|
+
if (!input.childPrefab || !sourceAssetId)
|
|
185
|
+
return null;
|
|
186
|
+
const sourceAsset = input.editorDocument.assets.find(asset => asset.id === sourceAssetId);
|
|
187
|
+
const syntheticGameObject = createEditorSceneCompilerPrefabModelGameObject(input.hostGameObject, input.node, sourceAssetId);
|
|
188
|
+
const overrides = compileEditorScenePrefabLegacyChildVisualOverrides({
|
|
189
|
+
node: input.node,
|
|
190
|
+
childPrefab: input.childPrefab,
|
|
191
|
+
sourceAsset,
|
|
192
|
+
editorDocument: input.editorDocument,
|
|
193
|
+
hostGameObject: syntheticGameObject,
|
|
194
|
+
});
|
|
195
|
+
return overrides
|
|
196
|
+
? {
|
|
197
|
+
...syntheticGameObject,
|
|
198
|
+
overrides,
|
|
199
|
+
}
|
|
200
|
+
: null;
|
|
201
|
+
}
|
|
202
|
+
function isEditorSceneModelAsset(asset) {
|
|
203
|
+
return asset.type === 'glb';
|
|
204
|
+
}
|
|
205
|
+
function compileAsset(asset) {
|
|
206
|
+
return {
|
|
207
|
+
id: asset.id,
|
|
208
|
+
type: asset.type,
|
|
209
|
+
...(asset.guid ? { guid: asset.guid } : {}),
|
|
210
|
+
...(asset.displayName ? { displayName: asset.displayName } : {}),
|
|
211
|
+
...(asset.category ? { category: asset.category } : {}),
|
|
212
|
+
...(typeof asset.materialMode === 'string' ? { materialMode: asset.materialMode } : {}),
|
|
213
|
+
...(asset.defaults ? { defaults: structuredClone(asset.defaults) } : {}),
|
|
214
|
+
...(asset.external ? { external: structuredClone(asset.external) } : {}),
|
|
215
|
+
...(asset.metadata ? { metadata: structuredClone(asset.metadata) } : {}),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function compileGameObjectToRuntimeNodes(gameObject, sourceRef, editorDocument) {
|
|
219
|
+
const relation = resolveEditorScenePrefabInstanceRelation(editorDocument, gameObject.id);
|
|
220
|
+
if (relation.definition && isExplicitEditorScenePrefabCompositionAsset(relation.definition)) {
|
|
221
|
+
return compileEditorScenePrefabCompositionInstance(gameObject, relation.definition, sourceRef, editorDocument, new Set());
|
|
222
|
+
}
|
|
223
|
+
return [compileGameObject(gameObject, sourceRef, editorDocument)];
|
|
224
|
+
}
|
|
225
|
+
function compileGameObject(gameObject, sourceRef, editorDocument) {
|
|
226
|
+
const transform = findEditorSceneTransform(gameObject);
|
|
227
|
+
const modelRenderer = findEditorSceneModelRenderer(gameObject);
|
|
228
|
+
const primitiveRenderer = findEditorScenePrimitiveRenderer(gameObject);
|
|
229
|
+
const nodeKind = readEditorSceneNodeKind(gameObject);
|
|
230
|
+
const visualOverrides = compileEditorSceneVisualOverrides(gameObject, editorDocument);
|
|
231
|
+
const rendering = resolveEditorSceneGameObjectRendering(gameObject);
|
|
232
|
+
const source = {
|
|
233
|
+
sourceId: sourceRef.sourceId,
|
|
234
|
+
sourceType: sourceRef.sourceType,
|
|
235
|
+
revision: sourceRef.revision,
|
|
236
|
+
...(gameObject.guid ? { objectGuid: gameObject.guid } : {}),
|
|
237
|
+
objectId: gameObject.id,
|
|
238
|
+
component: modelRenderer ? 'ModelRenderer' : (primitiveRenderer || nodeKind === 'primitive') ? 'PrimitiveRenderer' : nodeKind === 'transform' ? 'Transform' : 'GameObject',
|
|
239
|
+
};
|
|
240
|
+
const base = {
|
|
241
|
+
id: gameObject.id,
|
|
242
|
+
...(gameObject.name ? { name: gameObject.name } : {}),
|
|
243
|
+
...(gameObject.parentId ? { parentId: gameObject.parentId } : {}),
|
|
244
|
+
...(gameObject.active === false ? { enabled: false } : {}),
|
|
245
|
+
...(gameObject.shadowMode ? { shadowMode: gameObject.shadowMode } : {}),
|
|
246
|
+
...(gameObject.shadow ? { shadow: structuredClone(gameObject.shadow) } : {}),
|
|
247
|
+
...compileEditorSceneGameObjectShadowPlan(editorDocument, gameObject),
|
|
248
|
+
...(rendering ? { rendering } : {}),
|
|
249
|
+
source,
|
|
250
|
+
...(transform && 'position' in transform
|
|
251
|
+
? {
|
|
252
|
+
transform: {
|
|
253
|
+
position: transform.position,
|
|
254
|
+
rotation: transform.rotation,
|
|
255
|
+
...(transform.scale ? { scale: transform.scale } : {}),
|
|
256
|
+
},
|
|
257
|
+
}
|
|
258
|
+
: {}),
|
|
259
|
+
};
|
|
260
|
+
if (nodeKind === 'primitive') {
|
|
261
|
+
return {
|
|
262
|
+
...base,
|
|
263
|
+
kind: 'primitive',
|
|
264
|
+
primitive: {
|
|
265
|
+
shape: primitiveRenderer?.shape ?? 'cube',
|
|
266
|
+
},
|
|
267
|
+
...(visualOverrides ? { overrides: visualOverrides } : {}),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (!modelRenderer) {
|
|
271
|
+
if (nodeKind === 'transform') {
|
|
272
|
+
return {
|
|
273
|
+
...base,
|
|
274
|
+
kind: 'transform',
|
|
275
|
+
...(typeof gameObject.transformType === 'string' ? { transformType: gameObject.transformType } : {}),
|
|
276
|
+
...(gameObject.camera ? { camera: compileEditorSceneCamera(gameObject.camera) } : {}),
|
|
277
|
+
...(gameObject.light ? { light: compileEditorSceneLight(gameObject.light) } : {}),
|
|
278
|
+
...(gameObject.marker ? {
|
|
279
|
+
marker: {
|
|
280
|
+
label: gameObject.name || gameObject.id,
|
|
281
|
+
...structuredClone(gameObject.marker),
|
|
282
|
+
},
|
|
283
|
+
} : {}),
|
|
284
|
+
...(gameObject.groundDecal ? { groundDecal: structuredClone(gameObject.groundDecal) } : {}),
|
|
285
|
+
...(visualOverrides ? { overrides: visualOverrides } : {}),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
...base,
|
|
290
|
+
kind: 'group',
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
...base,
|
|
295
|
+
kind: 'instance',
|
|
296
|
+
instance: {
|
|
297
|
+
assetId: modelRenderer.assetId,
|
|
298
|
+
},
|
|
299
|
+
...(visualOverrides ? { overrides: visualOverrides } : {}),
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function compileEditorScenePrefabCompositionInstance(gameObject, prefabAsset, sourceRef, editorDocument, visitedPrefabIds) {
|
|
303
|
+
return compileEditorScenePrefabCompositionNodes({
|
|
304
|
+
prefabAsset,
|
|
305
|
+
sourceRef,
|
|
306
|
+
editorDocument,
|
|
307
|
+
hostGameObject: gameObject,
|
|
308
|
+
rootRuntimeId: gameObject.id,
|
|
309
|
+
rootParentId: gameObject.parentId,
|
|
310
|
+
rootName: gameObject.name ?? prefabAsset.displayName ?? prefabAsset.id,
|
|
311
|
+
rootTransform: findEditorSceneTransform(gameObject) ?? undefined,
|
|
312
|
+
rootActive: gameObject.active,
|
|
313
|
+
rootShadowMode: gameObject.shadowMode,
|
|
314
|
+
rootShadow: gameObject.shadow,
|
|
315
|
+
instanceOverrides: gameObject.overrides,
|
|
316
|
+
propertyPathPrefix: `assets.${prefabAsset.id}.prefab.nodes`,
|
|
317
|
+
visitedPrefabIds,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function compileEditorScenePrefabCompositionNodes(input) {
|
|
321
|
+
if (input.visitedPrefabIds.has(input.prefabAsset.id)) {
|
|
322
|
+
return [compileEditorScenePrefabPlaceholderNode({
|
|
323
|
+
id: input.rootRuntimeId,
|
|
324
|
+
name: input.rootName ?? input.prefabAsset.displayName ?? input.prefabAsset.id,
|
|
325
|
+
parentId: input.rootParentId,
|
|
326
|
+
transform: input.rootTransform,
|
|
327
|
+
editorDocument: input.editorDocument,
|
|
328
|
+
sourceRef: input.sourceRef,
|
|
329
|
+
hostGameObject: input.hostGameObject,
|
|
330
|
+
component: 'PrefabCycle',
|
|
331
|
+
propertyPath: input.propertyPathPrefix,
|
|
332
|
+
})];
|
|
333
|
+
}
|
|
334
|
+
input.visitedPrefabIds.add(input.prefabAsset.id);
|
|
335
|
+
const prefabNodes = readEditorScenePrefabNodes(input.prefabAsset);
|
|
336
|
+
const rootNodeId = readEditorScenePrefabRootNodeId(input.prefabAsset);
|
|
337
|
+
const rootNode = rootNodeId
|
|
338
|
+
? prefabNodes.find(node => node.id === rootNodeId)
|
|
339
|
+
: null;
|
|
340
|
+
if (!rootNode || prefabNodes.length === 0) {
|
|
341
|
+
input.visitedPrefabIds.delete(input.prefabAsset.id);
|
|
342
|
+
return [compileEditorScenePrefabPlaceholderNode({
|
|
343
|
+
id: input.rootRuntimeId,
|
|
344
|
+
name: input.rootName ?? input.prefabAsset.displayName ?? input.prefabAsset.id,
|
|
345
|
+
parentId: input.rootParentId,
|
|
346
|
+
transform: input.rootTransform,
|
|
347
|
+
editorDocument: input.editorDocument,
|
|
348
|
+
sourceRef: input.sourceRef,
|
|
349
|
+
hostGameObject: input.hostGameObject,
|
|
350
|
+
component: 'Prefab',
|
|
351
|
+
propertyPath: input.propertyPathPrefix,
|
|
352
|
+
})];
|
|
353
|
+
}
|
|
354
|
+
const runtimeIdForNode = (node) => node.id === rootNode.id ? input.rootRuntimeId : `${input.rootRuntimeId}:${node.id}`;
|
|
355
|
+
const orderedNodes = orderEditorScenePrefabNodesForCompile(prefabNodes, rootNode.id);
|
|
356
|
+
const primaryModelNodeId = findEditorScenePrefabPrimaryModelNodeId(orderedNodes, input.prefabAsset);
|
|
357
|
+
const compiledNodes = [];
|
|
358
|
+
for (const node of orderedNodes) {
|
|
359
|
+
const runtimeId = runtimeIdForNode(node);
|
|
360
|
+
const parentId = node.id === rootNode.id
|
|
361
|
+
? input.rootParentId
|
|
362
|
+
: runtimeIdForNode(prefabNodes.find(candidate => candidate.id === node.parentId) ?? rootNode);
|
|
363
|
+
if (node.kind === 'prefabInstance' && node.childPrefabId) {
|
|
364
|
+
const childPrefab = input.editorDocument.assets.find(asset => asset.id === node.childPrefabId);
|
|
365
|
+
if (childPrefab && isExplicitEditorScenePrefabCompositionAsset(childPrefab)) {
|
|
366
|
+
compiledNodes.push(...compileEditorScenePrefabCompositionNodes({
|
|
367
|
+
prefabAsset: childPrefab,
|
|
368
|
+
sourceRef: input.sourceRef,
|
|
369
|
+
editorDocument: input.editorDocument,
|
|
370
|
+
hostGameObject: input.hostGameObject,
|
|
371
|
+
rootRuntimeId: runtimeId,
|
|
372
|
+
rootParentId: parentId,
|
|
373
|
+
rootName: node.name ?? childPrefab.displayName ?? childPrefab.id,
|
|
374
|
+
rootTransform: node.transform,
|
|
375
|
+
rootActive: node.defaults?.active,
|
|
376
|
+
rootShadowMode: node.defaults?.shadowMode,
|
|
377
|
+
rootShadow: node.defaults?.shadow,
|
|
378
|
+
instanceOverrides: node.overrides,
|
|
379
|
+
propertyPathPrefix: `${input.propertyPathPrefix}.${node.id}.childPrefab.nodes`,
|
|
380
|
+
visitedPrefabIds: new Set(input.visitedPrefabIds),
|
|
381
|
+
}));
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
compiledNodes.push(compileEditorScenePrefabLegacyChildInstanceNode({
|
|
385
|
+
node,
|
|
386
|
+
runtimeId,
|
|
387
|
+
parentId,
|
|
388
|
+
childPrefab,
|
|
389
|
+
editorDocument: input.editorDocument,
|
|
390
|
+
sourceRef: input.sourceRef,
|
|
391
|
+
hostGameObject: input.hostGameObject,
|
|
392
|
+
propertyPath: `${input.propertyPathPrefix}.${node.id}`,
|
|
393
|
+
}));
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
compiledNodes.push(compileEditorScenePrefabCompositionNode({
|
|
397
|
+
node,
|
|
398
|
+
rootNode,
|
|
399
|
+
prefabAsset: input.prefabAsset,
|
|
400
|
+
runtimeId,
|
|
401
|
+
parentId,
|
|
402
|
+
sourceRef: input.sourceRef,
|
|
403
|
+
editorDocument: input.editorDocument,
|
|
404
|
+
hostGameObject: input.hostGameObject,
|
|
405
|
+
rootRuntimeName: input.rootName,
|
|
406
|
+
rootRuntimeTransform: input.rootTransform,
|
|
407
|
+
rootRuntimeActive: input.rootActive,
|
|
408
|
+
rootRuntimeShadowMode: input.rootShadowMode,
|
|
409
|
+
rootRuntimeShadow: input.rootShadow,
|
|
410
|
+
instanceOverrides: node.id === primaryModelNodeId ? input.instanceOverrides : undefined,
|
|
411
|
+
propertyPath: `${input.propertyPathPrefix}.${node.id}`,
|
|
412
|
+
}));
|
|
413
|
+
}
|
|
414
|
+
input.visitedPrefabIds.delete(input.prefabAsset.id);
|
|
415
|
+
return compileEditorScenePrefabScopedShadowPlans({
|
|
416
|
+
compiledNodes,
|
|
417
|
+
editorDocument: input.editorDocument,
|
|
418
|
+
hostGameObject: input.hostGameObject,
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function compileEditorScenePrefabCompositionNode(input) {
|
|
422
|
+
const isRoot = input.node.id === input.rootNode.id;
|
|
423
|
+
const transform = isRoot
|
|
424
|
+
? (input.rootRuntimeTransform ?? input.node.transform)
|
|
425
|
+
: input.node.transform;
|
|
426
|
+
const sourceAsset = input.node.kind === 'model' && input.node.sourceAssetId
|
|
427
|
+
? input.editorDocument.assets.find(asset => asset.id === input.node.sourceAssetId)
|
|
428
|
+
: undefined;
|
|
429
|
+
const base = compileEditorScenePrefabRuntimeNodeBase({
|
|
430
|
+
id: input.runtimeId,
|
|
431
|
+
name: isRoot
|
|
432
|
+
? (input.rootRuntimeName ?? input.node.name ?? input.prefabAsset.displayName ?? input.prefabAsset.id)
|
|
433
|
+
: input.node.name,
|
|
434
|
+
parentId: input.parentId,
|
|
435
|
+
transform,
|
|
436
|
+
active: isRoot
|
|
437
|
+
? (input.rootRuntimeActive ?? input.node.defaults?.active ?? input.prefabAsset.prefab?.defaults?.active)
|
|
438
|
+
: input.node.defaults?.active,
|
|
439
|
+
shadowMode: isRoot
|
|
440
|
+
? (input.rootRuntimeShadowMode ?? input.node.defaults?.shadowMode ?? input.prefabAsset.prefab?.defaults?.shadowMode)
|
|
441
|
+
: (input.node.defaults?.shadowMode ?? input.prefabAsset.prefab?.defaults?.shadowMode),
|
|
442
|
+
shadow: isRoot
|
|
443
|
+
? mergeEditorShadowSettings(input.prefabAsset.prefab?.defaults?.shadow, input.node.defaults?.shadow, input.rootRuntimeShadow)
|
|
444
|
+
: mergeEditorShadowSettings(input.prefabAsset.prefab?.defaults?.shadow, input.node.defaults?.shadow),
|
|
445
|
+
sourceAsset,
|
|
446
|
+
editorDocument: input.editorDocument,
|
|
447
|
+
sourceRef: input.sourceRef,
|
|
448
|
+
hostGameObject: input.hostGameObject,
|
|
449
|
+
component: input.node.kind === 'model'
|
|
450
|
+
? 'PrefabModel'
|
|
451
|
+
: input.node.kind === 'primitive'
|
|
452
|
+
? 'PrefabPrimitive'
|
|
453
|
+
: input.node.kind === 'light'
|
|
454
|
+
? 'PrefabLight'
|
|
455
|
+
: 'PrefabNode',
|
|
456
|
+
propertyPath: input.propertyPath,
|
|
457
|
+
});
|
|
458
|
+
if (input.node.kind === 'model' && input.node.sourceAssetId) {
|
|
459
|
+
const visualOverrides = compileEditorScenePrefabCompositionVisualOverrides({
|
|
460
|
+
hostGameObject: input.hostGameObject,
|
|
461
|
+
prefabAsset: input.prefabAsset,
|
|
462
|
+
rootNode: input.rootNode,
|
|
463
|
+
node: input.node,
|
|
464
|
+
asset: sourceAsset,
|
|
465
|
+
editorDocument: input.editorDocument,
|
|
466
|
+
instanceOverrides: input.instanceOverrides,
|
|
467
|
+
});
|
|
468
|
+
return {
|
|
469
|
+
...base,
|
|
470
|
+
kind: 'instance',
|
|
471
|
+
instance: {
|
|
472
|
+
assetId: input.node.sourceAssetId,
|
|
473
|
+
},
|
|
474
|
+
...(visualOverrides ? { overrides: visualOverrides } : {}),
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
if (input.node.kind === 'primitive') {
|
|
478
|
+
const visualOverrides = compileEditorScenePrefabCompositionVisualOverrides({
|
|
479
|
+
hostGameObject: input.hostGameObject,
|
|
480
|
+
prefabAsset: input.prefabAsset,
|
|
481
|
+
rootNode: input.rootNode,
|
|
482
|
+
node: input.node,
|
|
483
|
+
asset: undefined,
|
|
484
|
+
editorDocument: input.editorDocument,
|
|
485
|
+
instanceOverrides: input.instanceOverrides,
|
|
486
|
+
});
|
|
487
|
+
return {
|
|
488
|
+
...base,
|
|
489
|
+
kind: 'primitive',
|
|
490
|
+
primitive: {
|
|
491
|
+
shape: input.node.primitive?.shape ?? 'cube',
|
|
492
|
+
},
|
|
493
|
+
...(visualOverrides ? { overrides: visualOverrides } : {}),
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
if (input.node.kind === 'light') {
|
|
497
|
+
return {
|
|
498
|
+
...base,
|
|
499
|
+
kind: 'transform',
|
|
500
|
+
transformType: 'light',
|
|
501
|
+
...(input.node.light ? { light: compileEditorSceneLight(input.node.light) } : {}),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
return {
|
|
505
|
+
...base,
|
|
506
|
+
kind: 'group',
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function compileEditorScenePrefabLegacyChildInstanceNode(input) {
|
|
510
|
+
const sourceAssetId = input.childPrefab?.prefab?.sourceAssetId;
|
|
511
|
+
if (!sourceAssetId || !input.childPrefab) {
|
|
512
|
+
return compileEditorScenePrefabPlaceholderNode({
|
|
513
|
+
id: input.runtimeId,
|
|
514
|
+
name: input.node.name ?? input.node.childPrefabId ?? 'Prefab Instance',
|
|
515
|
+
parentId: input.parentId,
|
|
516
|
+
transform: input.node.transform,
|
|
517
|
+
sourceRef: input.sourceRef,
|
|
518
|
+
editorDocument: input.editorDocument,
|
|
519
|
+
hostGameObject: input.hostGameObject,
|
|
520
|
+
component: 'PrefabInstance',
|
|
521
|
+
propertyPath: input.propertyPath,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
const sourceAsset = input.editorDocument.assets.find(asset => asset.id === sourceAssetId);
|
|
525
|
+
const visualOverrides = compileEditorScenePrefabLegacyChildVisualOverrides({
|
|
526
|
+
node: input.node,
|
|
527
|
+
childPrefab: input.childPrefab,
|
|
528
|
+
sourceAsset,
|
|
529
|
+
editorDocument: input.editorDocument,
|
|
530
|
+
hostGameObject: createEditorSceneCompilerPrefabModelGameObject(input.hostGameObject, input.node, sourceAssetId),
|
|
531
|
+
});
|
|
532
|
+
return {
|
|
533
|
+
...compileEditorScenePrefabRuntimeNodeBase({
|
|
534
|
+
id: input.runtimeId,
|
|
535
|
+
name: input.node.name ?? input.childPrefab?.displayName ?? input.node.childPrefabId,
|
|
536
|
+
parentId: input.parentId,
|
|
537
|
+
transform: input.node.transform,
|
|
538
|
+
active: input.node.defaults?.active ?? input.childPrefab?.prefab?.defaults?.active,
|
|
539
|
+
shadowMode: input.node.defaults?.shadowMode ?? input.childPrefab?.prefab?.defaults?.shadowMode,
|
|
540
|
+
shadow: mergeEditorShadowSettings(input.childPrefab?.prefab?.defaults?.shadow, input.node.defaults?.shadow),
|
|
541
|
+
sourceAsset,
|
|
542
|
+
sourceRef: input.sourceRef,
|
|
543
|
+
editorDocument: input.editorDocument,
|
|
544
|
+
hostGameObject: input.hostGameObject,
|
|
545
|
+
component: 'PrefabInstance',
|
|
546
|
+
propertyPath: input.propertyPath,
|
|
547
|
+
}),
|
|
548
|
+
kind: 'instance',
|
|
549
|
+
instance: {
|
|
550
|
+
assetId: sourceAssetId,
|
|
551
|
+
},
|
|
552
|
+
...(visualOverrides ? { overrides: visualOverrides } : {}),
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
function compileEditorScenePrefabPlaceholderNode(input) {
|
|
556
|
+
return {
|
|
557
|
+
...compileEditorScenePrefabRuntimeNodeBase({
|
|
558
|
+
id: input.id,
|
|
559
|
+
name: input.name,
|
|
560
|
+
parentId: input.parentId,
|
|
561
|
+
transform: input.transform,
|
|
562
|
+
editorDocument: input.editorDocument,
|
|
563
|
+
sourceRef: input.sourceRef,
|
|
564
|
+
hostGameObject: input.hostGameObject,
|
|
565
|
+
component: input.component,
|
|
566
|
+
propertyPath: input.propertyPath,
|
|
567
|
+
}),
|
|
568
|
+
kind: 'group',
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
function compileEditorScenePrefabRuntimeNodeBase(input) {
|
|
572
|
+
return {
|
|
573
|
+
id: input.id,
|
|
574
|
+
...(input.name ? { name: input.name } : {}),
|
|
575
|
+
...(input.parentId ? { parentId: input.parentId } : {}),
|
|
576
|
+
...(input.active === false ? { enabled: false } : {}),
|
|
577
|
+
...(input.shadowMode ? { shadowMode: input.shadowMode } : {}),
|
|
578
|
+
...(input.shadow ? { shadow: structuredClone(input.shadow) } : {}),
|
|
579
|
+
...compileEditorScenePrefabRuntimeShadowPlan(input),
|
|
580
|
+
source: {
|
|
581
|
+
sourceId: input.sourceRef.sourceId,
|
|
582
|
+
sourceType: input.sourceRef.sourceType,
|
|
583
|
+
revision: input.sourceRef.revision,
|
|
584
|
+
...(input.hostGameObject.guid ? { objectGuid: input.hostGameObject.guid } : {}),
|
|
585
|
+
objectId: input.hostGameObject.id,
|
|
586
|
+
component: input.component,
|
|
587
|
+
propertyPath: input.propertyPath,
|
|
588
|
+
},
|
|
589
|
+
...(input.transform && 'position' in input.transform
|
|
590
|
+
? {
|
|
591
|
+
transform: {
|
|
592
|
+
position: input.transform.position,
|
|
593
|
+
rotation: input.transform.rotation,
|
|
594
|
+
...(input.transform.scale ? { scale: input.transform.scale } : {}),
|
|
595
|
+
},
|
|
596
|
+
}
|
|
597
|
+
: {}),
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function compileEditorSceneGameObjectShadowPlan(editorDocument, gameObject) {
|
|
601
|
+
const plan = resolveEditorShadowPlan({
|
|
602
|
+
document: editorDocument,
|
|
603
|
+
casterId: gameObject.id,
|
|
604
|
+
});
|
|
605
|
+
return shouldEmitEditorSceneRuntimeShadowPlan(plan, !!gameObject.shadowMode || !!gameObject.shadow)
|
|
606
|
+
? { shadowPlan: plan }
|
|
607
|
+
: {};
|
|
608
|
+
}
|
|
609
|
+
function compileEditorScenePrefabRuntimeShadowPlan(input) {
|
|
610
|
+
if (!input.editorDocument)
|
|
611
|
+
return {};
|
|
612
|
+
const readable = readEditorShadowSettingsWithLegacy({
|
|
613
|
+
shadowMode: input.shadowMode,
|
|
614
|
+
shadow: input.shadow,
|
|
615
|
+
});
|
|
616
|
+
const source = readEditorSceneCompilerAssetShadowSettings(input.sourceAsset);
|
|
617
|
+
const hasAuthoringShadow = !!input.shadowMode || !!input.shadow || !!readable.shadow || !!source.shadow;
|
|
618
|
+
if (!hasAuthoringShadow && readable.diagnostics.length === 0 && source.diagnostics.length === 0)
|
|
619
|
+
return {};
|
|
620
|
+
const plan = resolveEditorShadowPlan({
|
|
621
|
+
document: input.editorDocument,
|
|
622
|
+
casterId: input.hostGameObject.id,
|
|
623
|
+
settings: {
|
|
624
|
+
source: source.shadow,
|
|
625
|
+
instance: readable.shadow,
|
|
626
|
+
},
|
|
627
|
+
});
|
|
628
|
+
const remappedPlan = {
|
|
629
|
+
...plan,
|
|
630
|
+
casterId: input.id,
|
|
631
|
+
diagnostics: [
|
|
632
|
+
...source.diagnostics,
|
|
633
|
+
...readable.diagnostics,
|
|
634
|
+
...plan.diagnostics,
|
|
635
|
+
].map(diagnostic => ({
|
|
636
|
+
...diagnostic,
|
|
637
|
+
casterId: diagnostic.casterId === input.hostGameObject.id || !diagnostic.casterId
|
|
638
|
+
? input.id
|
|
639
|
+
: diagnostic.casterId,
|
|
640
|
+
})),
|
|
641
|
+
};
|
|
642
|
+
return shouldEmitEditorSceneRuntimeShadowPlan(remappedPlan, hasAuthoringShadow)
|
|
643
|
+
? { shadowPlan: remappedPlan }
|
|
644
|
+
: {};
|
|
645
|
+
}
|
|
646
|
+
function readEditorSceneCompilerAssetShadowSettings(asset) {
|
|
647
|
+
if (!asset)
|
|
648
|
+
return { diagnostics: [] };
|
|
649
|
+
const defaults = asset?.defaults && typeof asset.defaults === 'object' && !Array.isArray(asset.defaults)
|
|
650
|
+
? asset.defaults
|
|
651
|
+
: undefined;
|
|
652
|
+
if (!defaults)
|
|
653
|
+
return { diagnostics: [] };
|
|
654
|
+
const result = readEditorShadowSettingsWithLegacy({
|
|
655
|
+
shadow: defaults.shadow,
|
|
656
|
+
shadowMode: defaults.shadowMode,
|
|
657
|
+
});
|
|
658
|
+
return {
|
|
659
|
+
shadow: result.shadow,
|
|
660
|
+
diagnostics: result.diagnostics.map(diagnostic => ({
|
|
661
|
+
...diagnostic,
|
|
662
|
+
details: {
|
|
663
|
+
...(diagnostic.details ?? {}),
|
|
664
|
+
source: 'asset',
|
|
665
|
+
assetId: asset.id,
|
|
666
|
+
},
|
|
667
|
+
})),
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function shouldEmitEditorSceneRuntimeShadowPlan(plan, hasAuthoringShadow) {
|
|
671
|
+
return hasAuthoringShadow || plan.backend !== 'none' || plan.diagnostics.length > 0;
|
|
672
|
+
}
|
|
673
|
+
function compileEditorScenePrefabScopedShadowPlans(input) {
|
|
674
|
+
if (input.compiledNodes.length === 0)
|
|
675
|
+
return input.compiledNodes;
|
|
676
|
+
const compiledNodeIds = new Set(input.compiledNodes.map(node => node.id));
|
|
677
|
+
const shadowDocument = {
|
|
678
|
+
...input.editorDocument,
|
|
679
|
+
scene: {
|
|
680
|
+
...input.editorDocument.scene,
|
|
681
|
+
gameObjects: [
|
|
682
|
+
...input.editorDocument.scene.gameObjects.filter(gameObject => !compiledNodeIds.has(gameObject.id)),
|
|
683
|
+
...input.compiledNodes.map(node => createEditorSceneGameObjectFromRuntimeNode(node)),
|
|
684
|
+
],
|
|
685
|
+
},
|
|
686
|
+
};
|
|
687
|
+
const internalReceiverIds = input.compiledNodes
|
|
688
|
+
.filter((node) => node.shadow?.receive === 'enabled')
|
|
689
|
+
.map(node => node.id);
|
|
690
|
+
const internalLightId = input.compiledNodes
|
|
691
|
+
.map(node => createEditorSceneGameObjectFromRuntimeNode(node))
|
|
692
|
+
.find(gameObject => gameObject.light?.type === 'directional' && gameObject.active !== false)
|
|
693
|
+
?.id;
|
|
694
|
+
return input.compiledNodes.map((node) => {
|
|
695
|
+
const plan = resolveEditorShadowPlan({
|
|
696
|
+
document: shadowDocument,
|
|
697
|
+
casterId: node.id,
|
|
698
|
+
explicitReceiverIds: internalReceiverIds,
|
|
699
|
+
...(internalLightId ? { defaultLightId: internalLightId } : {}),
|
|
700
|
+
});
|
|
701
|
+
const hasAuthoringShadow = !!node.shadowMode || !!node.shadow;
|
|
702
|
+
if (!shouldEmitEditorSceneRuntimeShadowPlan(plan, hasAuthoringShadow)) {
|
|
703
|
+
if (!node.shadowPlan)
|
|
704
|
+
return node;
|
|
705
|
+
const next = { ...node };
|
|
706
|
+
delete next.shadowPlan;
|
|
707
|
+
return next;
|
|
708
|
+
}
|
|
709
|
+
return {
|
|
710
|
+
...node,
|
|
711
|
+
shadowPlan: plan,
|
|
712
|
+
};
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
function createEditorSceneGameObjectFromRuntimeNode(node) {
|
|
716
|
+
const components = [];
|
|
717
|
+
if (node.transform) {
|
|
718
|
+
components.push({
|
|
719
|
+
type: 'Transform',
|
|
720
|
+
position: node.transform.position,
|
|
721
|
+
rotation: node.transform.rotation,
|
|
722
|
+
...(node.transform.scale ? { scale: node.transform.scale } : {}),
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
if (node.kind === 'instance') {
|
|
726
|
+
components.push({
|
|
727
|
+
type: 'ModelRenderer',
|
|
728
|
+
assetId: node.instance.assetId,
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
return {
|
|
732
|
+
id: node.id,
|
|
733
|
+
...(node.name ? { name: node.name } : {}),
|
|
734
|
+
kind: node.kind,
|
|
735
|
+
...(node.parentId ? { parentId: node.parentId } : {}),
|
|
736
|
+
...(node.enabled === false ? { active: false } : {}),
|
|
737
|
+
...(node.shadowMode ? { shadowMode: node.shadowMode } : {}),
|
|
738
|
+
...(node.shadow ? { shadow: structuredClone(node.shadow) } : {}),
|
|
739
|
+
...(node.kind === 'primitive' ? { primitive: { shape: node.primitive.shape } } : {}),
|
|
740
|
+
...(node.kind === 'transform' && node.transformType ? { transformType: node.transformType } : {}),
|
|
741
|
+
...(node.kind === 'transform' && node.light ? { light: node.light } : {}),
|
|
742
|
+
...(node.kind === 'transform' && node.camera ? { camera: node.camera } : {}),
|
|
743
|
+
...(node.kind === 'transform' && node.marker ? { marker: structuredClone(node.marker) } : {}),
|
|
744
|
+
...(node.kind === 'transform' && node.groundDecal ? { groundDecal: node.groundDecal } : {}),
|
|
745
|
+
components,
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function compileEditorScenePrefabCompositionVisualOverrides(input) {
|
|
749
|
+
const materialHostGameObject = input.node.kind === 'model' && input.node.sourceAssetId
|
|
750
|
+
? createEditorSceneCompilerPrefabModelGameObject(input.hostGameObject, input.node, input.node.sourceAssetId)
|
|
751
|
+
: input.hostGameObject;
|
|
752
|
+
const prefabOverrides = mergeEditorScenePrefabOverrideList([
|
|
753
|
+
input.prefabAsset.prefab?.overrides,
|
|
754
|
+
input.rootNode.overrides,
|
|
755
|
+
input.node.id === input.rootNode.id ? undefined : input.node.overrides,
|
|
756
|
+
]);
|
|
757
|
+
const instanceOverrides = readEditorSceneCompilerVisualOverrides(input.instanceOverrides);
|
|
758
|
+
const compiledPrefabOverrides = prefabOverrides
|
|
759
|
+
? migrateSceneMaterialSlotBindings(prefabOverrides, input.asset, input.editorDocument, materialHostGameObject)
|
|
760
|
+
: undefined;
|
|
761
|
+
const compiledInstanceOverrides = instanceOverrides
|
|
762
|
+
? migrateSceneMaterialSlotBindings(instanceOverrides, input.asset, input.editorDocument, materialHostGameObject)
|
|
763
|
+
: undefined;
|
|
764
|
+
let next = mergeEditorScenePrefabOverrides(compiledPrefabOverrides, compiledInstanceOverrides);
|
|
765
|
+
if (instanceOverrides) {
|
|
766
|
+
for (const [key, value] of Object.entries(instanceOverrides)) {
|
|
767
|
+
if (isEditorScenePrefabMaterialOverrideKey(key) || value === undefined)
|
|
768
|
+
continue;
|
|
769
|
+
next ?? (next = {});
|
|
770
|
+
next[key] = value;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return next && Object.keys(next).length > 0 ? next : undefined;
|
|
774
|
+
}
|
|
775
|
+
function createEditorSceneCompilerPrefabModelGameObject(hostGameObject, node, assetId) {
|
|
776
|
+
return {
|
|
777
|
+
id: `${hostGameObject.id}:${node.id}`,
|
|
778
|
+
...(node.name ? { name: node.name } : {}),
|
|
779
|
+
kind: 'instance',
|
|
780
|
+
components: [
|
|
781
|
+
...(node.transform ? [node.transform] : []),
|
|
782
|
+
{
|
|
783
|
+
type: 'ModelRenderer',
|
|
784
|
+
assetId,
|
|
785
|
+
},
|
|
786
|
+
],
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function createEditorSceneCompilerPrefabPrimitiveGameObject(hostGameObject, node) {
|
|
790
|
+
return {
|
|
791
|
+
id: `${hostGameObject.id}:${node.id}`,
|
|
792
|
+
...(node.name ? { name: node.name } : {}),
|
|
793
|
+
kind: 'primitive',
|
|
794
|
+
primitive: { shape: node.primitive?.shape ?? 'cube' },
|
|
795
|
+
components: [
|
|
796
|
+
...(node.transform ? [node.transform] : []),
|
|
797
|
+
],
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function createEditorSceneCompilerPrefabCompositionMaterialGameObject(hostGameObject, node) {
|
|
801
|
+
if (node.kind === 'model' && node.sourceAssetId) {
|
|
802
|
+
return createEditorSceneCompilerPrefabModelGameObject(hostGameObject, node, node.sourceAssetId);
|
|
803
|
+
}
|
|
804
|
+
if (node.kind === 'primitive') {
|
|
805
|
+
return createEditorSceneCompilerPrefabPrimitiveGameObject(hostGameObject, node);
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
809
|
+
function compileEditorScenePrefabLegacyChildVisualOverrides(input) {
|
|
810
|
+
const prefabOverrides = mergeEditorScenePrefabOverrideList([
|
|
811
|
+
input.childPrefab.prefab?.overrides,
|
|
812
|
+
input.node.overrides,
|
|
813
|
+
]);
|
|
814
|
+
return prefabOverrides
|
|
815
|
+
? migrateSceneMaterialSlotBindings(prefabOverrides, input.sourceAsset, input.editorDocument, input.hostGameObject)
|
|
816
|
+
: undefined;
|
|
817
|
+
}
|
|
818
|
+
function mergeEditorScenePrefabOverrideList(overridesList) {
|
|
819
|
+
let next;
|
|
820
|
+
for (const overrides of overridesList) {
|
|
821
|
+
const readable = readEditorSceneCompilerVisualOverrides(overrides);
|
|
822
|
+
if (!readable)
|
|
823
|
+
continue;
|
|
824
|
+
next = mergeEditorScenePrefabOverrides(next, readable);
|
|
825
|
+
}
|
|
826
|
+
return next;
|
|
827
|
+
}
|
|
828
|
+
function orderEditorScenePrefabNodesForCompile(nodes, rootNodeId) {
|
|
829
|
+
const byParentId = new Map();
|
|
830
|
+
for (const node of nodes) {
|
|
831
|
+
if (!node.parentId)
|
|
832
|
+
continue;
|
|
833
|
+
const children = byParentId.get(node.parentId) ?? [];
|
|
834
|
+
children.push(node);
|
|
835
|
+
byParentId.set(node.parentId, children);
|
|
836
|
+
}
|
|
837
|
+
const ordered = [];
|
|
838
|
+
const visited = new Set();
|
|
839
|
+
const visit = (node) => {
|
|
840
|
+
if (visited.has(node.id))
|
|
841
|
+
return;
|
|
842
|
+
visited.add(node.id);
|
|
843
|
+
ordered.push(node);
|
|
844
|
+
for (const child of byParentId.get(node.id) ?? [])
|
|
845
|
+
visit(child);
|
|
846
|
+
};
|
|
847
|
+
const root = nodes.find(node => node.id === rootNodeId);
|
|
848
|
+
if (root)
|
|
849
|
+
visit(root);
|
|
850
|
+
for (const node of nodes)
|
|
851
|
+
visit(node);
|
|
852
|
+
return ordered;
|
|
853
|
+
}
|
|
854
|
+
function findEditorScenePrefabPrimaryModelNodeId(nodes, prefabAsset) {
|
|
855
|
+
const sourceAssetId = prefabAsset.prefab?.sourceAssetId;
|
|
856
|
+
return nodes.find(node => node.kind === 'model' && node.sourceAssetId === sourceAssetId)?.id
|
|
857
|
+
?? nodes.find(node => node.kind === 'model')?.id;
|
|
858
|
+
}
|
|
859
|
+
function isExplicitEditorScenePrefabCompositionAsset(asset) {
|
|
860
|
+
return isEditorScenePrefabAsset(asset) && Array.isArray(asset.prefab?.nodes) && asset.prefab.nodes.length > 0;
|
|
861
|
+
}
|
|
862
|
+
function findEditorScenePrimitiveRenderer(gameObject) {
|
|
863
|
+
return gameObject.primitive ?? null;
|
|
864
|
+
}
|
|
865
|
+
function compileEditorSceneVisualOverrides(gameObject, editorDocument) {
|
|
866
|
+
const nodeKind = readEditorSceneNodeKind(gameObject);
|
|
867
|
+
if (nodeKind !== 'instance' && nodeKind !== 'transform' && nodeKind !== 'primitive')
|
|
868
|
+
return undefined;
|
|
869
|
+
const modelRenderer = findEditorSceneModelRenderer(gameObject);
|
|
870
|
+
const asset = modelRenderer ? editorDocument.assets.find((entry) => entry.id === modelRenderer.assetId) : undefined;
|
|
871
|
+
return resolveEditorSceneCompileVisualOverrides(gameObject, editorDocument, asset);
|
|
872
|
+
}
|
|
873
|
+
function resolveEditorSceneCompileVisualOverrides(gameObject, editorDocument, asset) {
|
|
874
|
+
const instanceOverrides = readEditorSceneCompilerVisualOverrides(gameObject.overrides);
|
|
875
|
+
const relation = resolveEditorScenePrefabInstanceRelation(editorDocument, gameObject.id);
|
|
876
|
+
const prefabOverrides = readEditorSceneCompilerVisualOverrides(relation.definition?.prefab?.overrides);
|
|
877
|
+
const compiledPrefabOverrides = prefabOverrides
|
|
878
|
+
? migrateSceneMaterialSlotBindings(prefabOverrides, asset, editorDocument, gameObject)
|
|
879
|
+
: undefined;
|
|
880
|
+
const compiledInstanceOverrides = instanceOverrides
|
|
881
|
+
? migrateSceneMaterialSlotBindings(instanceOverrides, asset, editorDocument, gameObject)
|
|
882
|
+
: undefined;
|
|
883
|
+
let next = mergeEditorScenePrefabOverrides(compiledPrefabOverrides, compiledInstanceOverrides);
|
|
884
|
+
if (instanceOverrides) {
|
|
885
|
+
for (const [key, value] of Object.entries(instanceOverrides)) {
|
|
886
|
+
if (isEditorScenePrefabMaterialOverrideKey(key) || value === undefined)
|
|
887
|
+
continue;
|
|
888
|
+
next ?? (next = {});
|
|
889
|
+
next[key] = value;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
return next && Object.keys(next).length > 0 ? next : undefined;
|
|
893
|
+
}
|
|
894
|
+
function readEditorSceneCompilerVisualOverrides(value) {
|
|
895
|
+
if (!isRecord(value))
|
|
896
|
+
return undefined;
|
|
897
|
+
const next = structuredClone(value);
|
|
898
|
+
return Object.keys(next).length > 0 ? next : undefined;
|
|
899
|
+
}
|
|
900
|
+
function isEditorScenePrefabMaterialOverrideKey(key) {
|
|
901
|
+
return key === 'materialBinding'
|
|
902
|
+
|| key === 'materialSlotBindings'
|
|
903
|
+
|| key === 'childMaterialBindings';
|
|
904
|
+
}
|
|
905
|
+
function migrateSceneMaterialSlotBindings(overrides, asset, editorDocument, gameObject) {
|
|
906
|
+
const gameObjectWithCompiledOverrides = {
|
|
907
|
+
...gameObject,
|
|
908
|
+
overrides,
|
|
909
|
+
};
|
|
910
|
+
const reimportDiff = resolveEditorSceneMaterialSlotReimportDiff(editorDocument, gameObjectWithCompiledOverrides);
|
|
911
|
+
if (reimportDiff.bindingRemaps.length > 0 && overrides.materialSlotBindings) {
|
|
912
|
+
for (const remap of reimportDiff.bindingRemaps) {
|
|
913
|
+
const sourceBinding = overrides.materialSlotBindings[remap.fromSlotId];
|
|
914
|
+
if (!sourceBinding || overrides.materialSlotBindings[remap.toSlotId])
|
|
915
|
+
continue;
|
|
916
|
+
overrides.materialSlotBindings[remap.toSlotId] = structuredClone(sourceBinding);
|
|
917
|
+
delete overrides.materialSlotBindings[remap.fromSlotId];
|
|
918
|
+
}
|
|
919
|
+
if (Object.keys(overrides.materialSlotBindings).length === 0) {
|
|
920
|
+
delete overrides.materialSlotBindings;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
const materialSlots = collectCompiledEditorSceneMaterialSlots(asset);
|
|
924
|
+
if (materialSlots.length === 0 || !overrides.childMaterialBindings)
|
|
925
|
+
return overrides;
|
|
926
|
+
const materialSlotBindings = {
|
|
927
|
+
...(overrides.materialSlotBindings ?? {}),
|
|
928
|
+
};
|
|
929
|
+
const childMaterialBindings = {
|
|
930
|
+
...overrides.childMaterialBindings,
|
|
931
|
+
};
|
|
932
|
+
for (const slot of materialSlots) {
|
|
933
|
+
const legacy = findLegacySceneMaterialSlotBinding(childMaterialBindings, slot.ownerNodePath);
|
|
934
|
+
const legacyBinding = legacy?.binding;
|
|
935
|
+
if (!legacyBinding)
|
|
936
|
+
continue;
|
|
937
|
+
materialSlotBindings[slot.slotId] = mergeEditorSceneMaterialBindingOverrides(materialSlotBindings[slot.slotId], legacyBinding);
|
|
938
|
+
delete childMaterialBindings[legacy.ownerNodePath];
|
|
939
|
+
}
|
|
940
|
+
if (Object.keys(materialSlotBindings).length > 0)
|
|
941
|
+
overrides.materialSlotBindings = materialSlotBindings;
|
|
942
|
+
if (Object.keys(childMaterialBindings).length > 0)
|
|
943
|
+
overrides.childMaterialBindings = childMaterialBindings;
|
|
944
|
+
else
|
|
945
|
+
delete overrides.childMaterialBindings;
|
|
946
|
+
return overrides;
|
|
947
|
+
}
|
|
948
|
+
function collectCompiledEditorSceneMaterialSlots(asset) {
|
|
949
|
+
const rawSlots = Array.isArray(asset?.metadata?.materialSlots) ? asset.metadata.materialSlots : [];
|
|
950
|
+
const slots = [];
|
|
951
|
+
for (const rawSlot of rawSlots) {
|
|
952
|
+
if (!rawSlot || typeof rawSlot !== 'object' || Array.isArray(rawSlot))
|
|
953
|
+
continue;
|
|
954
|
+
const record = rawSlot;
|
|
955
|
+
const slotId = typeof record.slotId === 'string' ? record.slotId.trim() : '';
|
|
956
|
+
const ownerNodePath = normalizeSceneMaterialSlotMigrationOwnerPath(typeof record.ownerNodePath === 'string'
|
|
957
|
+
? record.ownerNodePath
|
|
958
|
+
: typeof record.path === 'string'
|
|
959
|
+
? record.path
|
|
960
|
+
: '');
|
|
961
|
+
if (slotId && ownerNodePath)
|
|
962
|
+
slots.push({ slotId, ownerNodePath });
|
|
963
|
+
}
|
|
964
|
+
return slots;
|
|
965
|
+
}
|
|
966
|
+
function findLegacySceneMaterialSlotBinding(childMaterialBindings, ownerNodePath) {
|
|
967
|
+
const exact = childMaterialBindings[ownerNodePath];
|
|
968
|
+
if (exact)
|
|
969
|
+
return { ownerNodePath, binding: exact };
|
|
970
|
+
const normalizedOwnerNodePath = normalizeSceneMaterialSlotMigrationOwnerPath(ownerNodePath);
|
|
971
|
+
for (const [legacyOwnerNodePath, binding] of Object.entries(childMaterialBindings)) {
|
|
972
|
+
if (!binding)
|
|
973
|
+
continue;
|
|
974
|
+
if (normalizeSceneMaterialSlotMigrationOwnerPath(legacyOwnerNodePath) === normalizedOwnerNodePath) {
|
|
975
|
+
return { ownerNodePath: legacyOwnerNodePath, binding };
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return null;
|
|
979
|
+
}
|
|
980
|
+
function normalizeSceneMaterialSlotMigrationOwnerPath(ownerNodePath) {
|
|
981
|
+
return String(ownerNodePath ?? '').split('/').filter(Boolean).join('/');
|
|
982
|
+
}
|
|
983
|
+
function isRecord(value) {
|
|
984
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
985
|
+
}
|
|
986
|
+
function compileEditorSceneCamera(camera) {
|
|
987
|
+
const compiled = structuredClone(camera);
|
|
988
|
+
delete compiled.inspectorLanguage;
|
|
989
|
+
return compiled;
|
|
990
|
+
}
|
|
991
|
+
function compileEditorSceneLight(light) {
|
|
992
|
+
const compiled = structuredClone(light);
|
|
993
|
+
delete compiled.inspectorLanguage;
|
|
994
|
+
return compiled;
|
|
995
|
+
}
|
|
996
|
+
//# sourceMappingURL=compiler.js.map
|