@fps-games/editor 0.1.6-beta.1 → 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-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-harness.d.ts +26 -2
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +773 -75
- package/dist/local-editor-harness.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 +5 -0
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js +2 -0
- package/dist/playable-local-editor-host.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/projection.d.ts +30 -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 +346 -11
- 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 +5 -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 +3 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
- 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 +7 -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.js +2 -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.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js +288 -71
- 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 +3 -0
- 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 +21 -14
- 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-prefab-stage.d.ts +19 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +79 -39
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.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-types.d.ts +68 -1
- 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 +2 -0
- 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 +10 -0
- 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 +3 -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 +401 -241
- 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/viewport-tools.d.ts +1 -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.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-placement/document.d.ts +0 -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 +4 -42
- 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 +42 -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 +612 -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 +42 -0
- 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 +16 -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 +5 -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 +28 -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/mutation/field-patch.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js +99 -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 +16 -32
- 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 +5 -22
- 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 +4 -0
- 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.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js +224 -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 +158 -50
- 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/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/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/index.d.ts +2 -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 +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/package.json +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import { EDITOR_AGENT_BRIDGE_CAPABILITY_ID, } from '@fps-games/editor-protocol';
|
|
2
|
+
import { createLocalEditorAgentBridgeFailure, isLocalEditorAgentBridgeVec3 } from '../diagnostics.js';
|
|
3
|
+
import { normalizeAgentBridgeString, } from '../shared.js';
|
|
4
|
+
import { findAgentBridgeVisibleAssetInfo, listAgentBridgeVisibleAssetInfos } from './assets.js';
|
|
5
|
+
const PREFAB_STAGE_ITEM_PREFIX = 'prefab-node:';
|
|
6
|
+
const PREFAB_ROOT_NODE_ID = 'prefab-root';
|
|
7
|
+
const ZERO_VEC3 = { x: 0, y: 0, z: 0 };
|
|
8
|
+
const ONE_VEC3 = { x: 1, y: 1, z: 1 };
|
|
9
|
+
export function createLocalEditorAgentBridgePrefabSource(state, options, renderUi, operations) {
|
|
10
|
+
return {
|
|
11
|
+
resolvePrefab(input) {
|
|
12
|
+
return resolvePrefabs(state, options, operations, input);
|
|
13
|
+
},
|
|
14
|
+
openStage(input) {
|
|
15
|
+
const resolved = resolvePrefabs(state, options, operations, input);
|
|
16
|
+
if (!resolved.resolvedPrefab) {
|
|
17
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_STAGE_OPEN, resolved.ambiguous
|
|
18
|
+
? 'Prefab query matched multiple prefab assets; provide assetId or browserAssetId.'
|
|
19
|
+
: 'Prefab asset not found.', { code: resolved.ambiguous ? 'prefab.ambiguous' : 'prefab.notFound' });
|
|
20
|
+
}
|
|
21
|
+
const currentStage = operations.getPrefabStage();
|
|
22
|
+
if (isSamePrefabStage(currentStage, resolved.resolvedPrefab)) {
|
|
23
|
+
return {
|
|
24
|
+
opened: false,
|
|
25
|
+
alreadyOpen: true,
|
|
26
|
+
prefab: resolved.resolvedPrefab,
|
|
27
|
+
stage: currentStage,
|
|
28
|
+
status: `Editing Prefab ${currentStage.label}`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const output = operations.openPrefabStage({
|
|
32
|
+
assetId: resolved.resolvedPrefab.assetId,
|
|
33
|
+
browserAssetId: resolved.resolvedPrefab.browserAssetId,
|
|
34
|
+
});
|
|
35
|
+
if (!output) {
|
|
36
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_STAGE_OPEN, `Prefab stage unavailable: ${resolved.resolvedPrefab.assetId}`, { code: 'prefab.stageOpenFailed' });
|
|
37
|
+
}
|
|
38
|
+
renderUi();
|
|
39
|
+
return output;
|
|
40
|
+
},
|
|
41
|
+
exitStage() {
|
|
42
|
+
const output = operations.exitPrefabStage();
|
|
43
|
+
if (output.exited)
|
|
44
|
+
renderUi();
|
|
45
|
+
return output;
|
|
46
|
+
},
|
|
47
|
+
renameAsset(input) {
|
|
48
|
+
const details = operations.getPrefabStageDetails();
|
|
49
|
+
const assetId = normalizeAgentBridgeString(input.assetId) || details?.stage.assetId || '';
|
|
50
|
+
const displayNameResult = normalizePrefabEditableName(input.displayName);
|
|
51
|
+
if (!assetId || !displayNameResult.ok) {
|
|
52
|
+
const displayNameError = displayNameResult.ok ? '' : displayNameResult.message;
|
|
53
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_ASSET_RENAME, !assetId ? 'Prefab asset id is required.' : displayNameError, {
|
|
54
|
+
code: !assetId ? 'prefab.invalidInput' : 'prefab.invalidName',
|
|
55
|
+
details: { assetId: input.assetId, displayName: input.displayName },
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const asset = findAgentBridgeVisibleAssetInfo(state, options, assetId);
|
|
59
|
+
if (!asset || !isPrefabAsset(asset)) {
|
|
60
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_ASSET_RENAME, `Prefab asset not found: ${assetId}`, { code: 'prefab.notFound', details: { assetId } });
|
|
61
|
+
}
|
|
62
|
+
const conflict = listAgentBridgeVisibleAssetInfos(state, options)
|
|
63
|
+
.find(candidate => candidate.assetId !== assetId
|
|
64
|
+
&& isPrefabAsset(candidate)
|
|
65
|
+
&& candidate.displayName.trim().toLowerCase() === displayNameResult.name.toLowerCase());
|
|
66
|
+
if (conflict) {
|
|
67
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_ASSET_RENAME, `Prefab name already exists: ${displayNameResult.name}`, {
|
|
68
|
+
code: 'asset.nameConflict',
|
|
69
|
+
details: { assetId, conflictingAssetId: conflict.assetId, displayName: displayNameResult.name },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const previousDisplayName = asset.displayName;
|
|
73
|
+
if (previousDisplayName === displayNameResult.name) {
|
|
74
|
+
return createPrefabAssetRenameOutput({
|
|
75
|
+
assetId,
|
|
76
|
+
previousDisplayName,
|
|
77
|
+
displayName: displayNameResult.name,
|
|
78
|
+
stageActive: !!details && details.stage.assetId === assetId,
|
|
79
|
+
renamed: false,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const patched = operations.runPrefabStageAssetAction({
|
|
83
|
+
actionId: 'asset.rename',
|
|
84
|
+
assetId,
|
|
85
|
+
assetKind: 'prefab',
|
|
86
|
+
targetPrefabAssetId: details?.stage.assetId === assetId ? assetId : undefined,
|
|
87
|
+
value: displayNameResult.name,
|
|
88
|
+
});
|
|
89
|
+
if (!patched) {
|
|
90
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_ASSET_RENAME, `Prefab rename action unavailable: ${assetId}`, { code: 'prefab.actionUnavailable', details: { assetId } });
|
|
91
|
+
}
|
|
92
|
+
renderUi();
|
|
93
|
+
const stageActive = !!operations.getPrefabStageDetails() && operations.getPrefabStageDetails()?.stage.assetId === assetId;
|
|
94
|
+
return createPrefabAssetRenameOutput({
|
|
95
|
+
assetId,
|
|
96
|
+
previousDisplayName,
|
|
97
|
+
displayName: displayNameResult.name,
|
|
98
|
+
stageActive,
|
|
99
|
+
renamed: true,
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
getScene(input) {
|
|
103
|
+
const details = operations.getPrefabStageDetails();
|
|
104
|
+
if (!details || !isRequestedPrefabStage(details.stage, input.assetId)) {
|
|
105
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_SCENE_GET, createPrefabStageUnavailableMessage(input.assetId), { code: 'prefab.stageNotOpen', details: { assetId: input.assetId } });
|
|
106
|
+
}
|
|
107
|
+
return createPrefabSceneOutput(details);
|
|
108
|
+
},
|
|
109
|
+
selectNode(input) {
|
|
110
|
+
const nodeId = normalizePrefabNodeId(input.nodeId);
|
|
111
|
+
const details = operations.getPrefabStageDetails();
|
|
112
|
+
if (!details || !nodeId) {
|
|
113
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_SELECT, nodeId ? 'Prefab stage is not open.' : 'Prefab node id is required.', { code: nodeId ? 'prefab.stageNotOpen' : 'prefab.invalidInput', details: { nodeId: input.nodeId } });
|
|
114
|
+
}
|
|
115
|
+
const scene = createPrefabSceneOutput(details);
|
|
116
|
+
const node = scene.nodes.find(candidate => candidate.nodeId === nodeId) ?? null;
|
|
117
|
+
if (!node) {
|
|
118
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_SELECT, `Prefab node not found: ${nodeId}`, { code: 'prefab.nodeNotFound', details: { assetId: details.stage.assetId, nodeId } });
|
|
119
|
+
}
|
|
120
|
+
const changed = operations.selectPrefabStageItem(createPrefabStageItemId(nodeId));
|
|
121
|
+
if (changed)
|
|
122
|
+
renderUi();
|
|
123
|
+
const nextDetails = operations.getPrefabStageDetails() ?? details;
|
|
124
|
+
const nextScene = createPrefabSceneOutput(nextDetails);
|
|
125
|
+
const selectedNode = nextScene.nodes.find(candidate => candidate.nodeId === nodeId) ?? node;
|
|
126
|
+
return {
|
|
127
|
+
stage: nextScene.stage,
|
|
128
|
+
selectedNodeId: nodeId,
|
|
129
|
+
node: selectedNode,
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
createNodeFromAsset(input) {
|
|
133
|
+
const details = operations.getPrefabStageDetails();
|
|
134
|
+
const assetId = normalizeAgentBridgeString(input.assetId);
|
|
135
|
+
const asset = findAgentBridgeVisibleAssetInfo(state, options, assetId);
|
|
136
|
+
if (!details || !asset || !assetId) {
|
|
137
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_CREATE_FROM_ASSET, !details
|
|
138
|
+
? 'Prefab stage is not open.'
|
|
139
|
+
: `Asset not found: ${assetId || '(empty)'}`, { code: !details ? 'prefab.stageNotOpen' : 'asset.notFound', details: { assetId } });
|
|
140
|
+
}
|
|
141
|
+
const beforeScene = createPrefabSceneOutput(details);
|
|
142
|
+
const parentNodeId = resolvePrefabMutationParentNodeId(input.parentNodeId, beforeScene);
|
|
143
|
+
const action = {
|
|
144
|
+
actionId: 'asset.add-to-current-prefab',
|
|
145
|
+
assetId,
|
|
146
|
+
assetKind: asset.kind,
|
|
147
|
+
targetPrefabAssetId: details.stage.assetId,
|
|
148
|
+
parentNodeId,
|
|
149
|
+
value: createPrefabNodeCreateActionValue(input),
|
|
150
|
+
};
|
|
151
|
+
return runPrefabNodeMutation({
|
|
152
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_CREATE_FROM_ASSET,
|
|
153
|
+
state,
|
|
154
|
+
operations,
|
|
155
|
+
renderUi,
|
|
156
|
+
beforeScene,
|
|
157
|
+
action,
|
|
158
|
+
select: input.select,
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
createGroupNode(input) {
|
|
162
|
+
const details = operations.getPrefabStageDetails();
|
|
163
|
+
if (!details) {
|
|
164
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_CREATE_GROUP, 'Prefab stage is not open.', { code: 'prefab.stageNotOpen' });
|
|
165
|
+
}
|
|
166
|
+
const beforeScene = createPrefabSceneOutput(details);
|
|
167
|
+
const parentNodeId = resolvePrefabMutationParentNodeId(input.parentNodeId, beforeScene);
|
|
168
|
+
const action = {
|
|
169
|
+
actionId: 'prefab.node.createGroup',
|
|
170
|
+
targetPrefabAssetId: details.stage.assetId,
|
|
171
|
+
parentNodeId,
|
|
172
|
+
value: createPrefabNodeCreateActionValue(input),
|
|
173
|
+
};
|
|
174
|
+
return runPrefabNodeMutation({
|
|
175
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_CREATE_GROUP,
|
|
176
|
+
state,
|
|
177
|
+
operations,
|
|
178
|
+
renderUi,
|
|
179
|
+
beforeScene,
|
|
180
|
+
action,
|
|
181
|
+
select: input.select,
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
createPrimitiveNode(input) {
|
|
185
|
+
const details = operations.getPrefabStageDetails();
|
|
186
|
+
if (!details) {
|
|
187
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_CREATE_PRIMITIVE, 'Prefab stage is not open.', { code: 'prefab.stageNotOpen' });
|
|
188
|
+
}
|
|
189
|
+
const beforeScene = createPrefabSceneOutput(details);
|
|
190
|
+
const parentNodeId = resolvePrefabMutationParentNodeId(input.parentNodeId, beforeScene);
|
|
191
|
+
const action = {
|
|
192
|
+
actionId: 'prefab.node.createPrimitive',
|
|
193
|
+
targetPrefabAssetId: details.stage.assetId,
|
|
194
|
+
parentNodeId,
|
|
195
|
+
primitiveShape: input.shape,
|
|
196
|
+
value: createPrefabNodeCreateActionValue(input),
|
|
197
|
+
};
|
|
198
|
+
return runPrefabNodeMutation({
|
|
199
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_CREATE_PRIMITIVE,
|
|
200
|
+
state,
|
|
201
|
+
operations,
|
|
202
|
+
renderUi,
|
|
203
|
+
beforeScene,
|
|
204
|
+
action,
|
|
205
|
+
select: input.select,
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
setNodeTransform(input) {
|
|
209
|
+
const nodeId = normalizePrefabNodeId(input.nodeId);
|
|
210
|
+
const details = operations.getPrefabStageDetails();
|
|
211
|
+
if (!details || !nodeId) {
|
|
212
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_SET_TRANSFORM, nodeId ? 'Prefab stage is not open.' : 'Prefab node id is required.', { code: nodeId ? 'prefab.stageNotOpen' : 'prefab.invalidInput', details: { nodeId: input.nodeId } });
|
|
213
|
+
}
|
|
214
|
+
const beforeScene = createPrefabSceneOutput(details);
|
|
215
|
+
const node = beforeScene.nodes.find(candidate => candidate.nodeId === nodeId) ?? null;
|
|
216
|
+
if (!node) {
|
|
217
|
+
return createLocalEditorAgentBridgeFailure(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_SET_TRANSFORM, `Prefab node not found: ${nodeId}`, { code: 'prefab.nodeNotFound', details: { assetId: details.stage.assetId, nodeId } });
|
|
218
|
+
}
|
|
219
|
+
const transform = createPrefabTransformActionValue({
|
|
220
|
+
position: input.position,
|
|
221
|
+
rotation: input.rotation,
|
|
222
|
+
scale: input.scale,
|
|
223
|
+
}, node.transform);
|
|
224
|
+
const action = {
|
|
225
|
+
actionId: 'prefab.node.setTransform',
|
|
226
|
+
targetPrefabAssetId: details.stage.assetId,
|
|
227
|
+
nodeId,
|
|
228
|
+
value: transform,
|
|
229
|
+
};
|
|
230
|
+
return runPrefabNodeMutation({
|
|
231
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_SET_TRANSFORM,
|
|
232
|
+
state,
|
|
233
|
+
operations,
|
|
234
|
+
renderUi,
|
|
235
|
+
beforeScene,
|
|
236
|
+
action,
|
|
237
|
+
changedNodeId: nodeId,
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
reparentNode(input) {
|
|
241
|
+
return runNodeIdMutation({
|
|
242
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_REPARENT,
|
|
243
|
+
state,
|
|
244
|
+
operations,
|
|
245
|
+
renderUi,
|
|
246
|
+
nodeId: input.nodeId,
|
|
247
|
+
parentNodeId: input.parentNodeId,
|
|
248
|
+
actionId: 'prefab.node.reparent',
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
renameNode(input) {
|
|
252
|
+
return runNodeIdMutation({
|
|
253
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_RENAME,
|
|
254
|
+
state,
|
|
255
|
+
operations,
|
|
256
|
+
renderUi,
|
|
257
|
+
nodeId: input.nodeId,
|
|
258
|
+
actionId: 'prefab.node.rename',
|
|
259
|
+
value: input.name,
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
deleteNode(input) {
|
|
263
|
+
return runNodeIdMutation({
|
|
264
|
+
capabilityId: EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_NODE_DELETE,
|
|
265
|
+
state,
|
|
266
|
+
operations,
|
|
267
|
+
renderUi,
|
|
268
|
+
nodeId: input.nodeId,
|
|
269
|
+
actionId: 'prefab.node.delete',
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
getSourceStructure(input) {
|
|
273
|
+
const resolved = resolvePrefabAssetForInspection(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_SOURCE_STRUCTURE_GET, state, options, operations, input);
|
|
274
|
+
if (!resolved.ok)
|
|
275
|
+
return resolved.result;
|
|
276
|
+
const structure = createPrefabSourceStructure(resolved.asset, resolved.node);
|
|
277
|
+
return {
|
|
278
|
+
stage: resolved.scene.stage,
|
|
279
|
+
...(resolved.node ? { nodeId: resolved.node.nodeId } : {}),
|
|
280
|
+
assetId: resolved.asset.assetId,
|
|
281
|
+
structure,
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
listMaterialSlots(input) {
|
|
285
|
+
const resolved = resolvePrefabAssetForInspection(EDITOR_AGENT_BRIDGE_CAPABILITY_ID.PREFAB_MATERIAL_SLOTS_LIST, state, options, operations, input);
|
|
286
|
+
if (!resolved.ok)
|
|
287
|
+
return resolved.result;
|
|
288
|
+
const slots = createPrefabMaterialSlots(resolved.asset, resolved.node)
|
|
289
|
+
.filter(slot => input.includeReadonly === true || slot.editable);
|
|
290
|
+
return {
|
|
291
|
+
stage: resolved.scene.stage,
|
|
292
|
+
...(resolved.node ? { nodeId: resolved.node.nodeId } : {}),
|
|
293
|
+
assetId: resolved.asset.assetId,
|
|
294
|
+
slots,
|
|
295
|
+
};
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function resolvePrefabs(state, options, operations, input) {
|
|
300
|
+
const assetId = normalizeAgentBridgeString(input.assetId);
|
|
301
|
+
const browserAssetId = normalizeAgentBridgeString(input.browserAssetId);
|
|
302
|
+
const name = normalizeAgentBridgeString(input.name).toLowerCase();
|
|
303
|
+
const query = normalizeAgentBridgeString(input.query).toLowerCase();
|
|
304
|
+
const includeUnavailable = 'includeUnavailable' in input && input.includeUnavailable === true;
|
|
305
|
+
const prefabs = listAgentBridgeVisibleAssetInfos(state, options)
|
|
306
|
+
.filter(asset => isPrefabAsset(asset))
|
|
307
|
+
.filter(asset => includeUnavailable || asset.placeable !== false)
|
|
308
|
+
.map(createPrefabSummary);
|
|
309
|
+
const matches = prefabs.filter(prefab => ((!!assetId && prefab.assetId === assetId)
|
|
310
|
+
|| (!!browserAssetId && prefab.browserAssetId === browserAssetId)
|
|
311
|
+
|| (!!name && prefab.displayName.toLowerCase() === name)
|
|
312
|
+
|| (!!query && prefabMatchesQuery(prefab, query))
|
|
313
|
+
|| (!assetId && !browserAssetId && !name && !query)));
|
|
314
|
+
const resolvedPrefab = matches.length === 1 ? matches[0] : null;
|
|
315
|
+
return {
|
|
316
|
+
prefabs: matches,
|
|
317
|
+
resolvedPrefab,
|
|
318
|
+
ambiguous: matches.length > 1,
|
|
319
|
+
currentStage: operations.getPrefabStage(),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function isPrefabAsset(asset) {
|
|
323
|
+
return String(asset.kind).toLowerCase() === 'prefab'
|
|
324
|
+
|| String(asset.type).toLowerCase() === 'prefab'
|
|
325
|
+
|| !!asset.prefab;
|
|
326
|
+
}
|
|
327
|
+
function createPrefabSummary(asset) {
|
|
328
|
+
const prefab = readRecord(asset.prefab);
|
|
329
|
+
const explicitBrowserAssetId = readString(prefab.browserAssetId);
|
|
330
|
+
const prefabId = readString(prefab.id);
|
|
331
|
+
const browserAssetId = explicitBrowserAssetId
|
|
332
|
+
|| (prefabId && prefabId !== asset.assetId ? prefabId : undefined)
|
|
333
|
+
|| (asset.prefab ? `prefab:${asset.assetId}` : undefined);
|
|
334
|
+
const sourceAssetId = readString(prefab.sourceAssetId) || readString(asset.metadata?.sourceAssetId);
|
|
335
|
+
const sourceAssetGuid = readString(prefab.sourceAssetGuid) || readString(asset.metadata?.sourceAssetGuid);
|
|
336
|
+
return {
|
|
337
|
+
assetId: asset.assetId,
|
|
338
|
+
...(browserAssetId && browserAssetId !== asset.assetId ? { browserAssetId } : {}),
|
|
339
|
+
displayName: asset.displayName,
|
|
340
|
+
...(sourceAssetId ? { sourceAssetId } : {}),
|
|
341
|
+
...(sourceAssetGuid ? { sourceAssetGuid } : {}),
|
|
342
|
+
placeable: asset.placeable,
|
|
343
|
+
...(prefab.readonly === true ? { readonly: true } : {}),
|
|
344
|
+
status: asset.prefab ? 'ready' : 'metadata-only',
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function prefabMatchesQuery(prefab, query) {
|
|
348
|
+
return [
|
|
349
|
+
prefab.assetId,
|
|
350
|
+
prefab.browserAssetId,
|
|
351
|
+
prefab.displayName,
|
|
352
|
+
prefab.sourceAssetId,
|
|
353
|
+
prefab.sourceAssetGuid,
|
|
354
|
+
prefab.status,
|
|
355
|
+
].some(value => String(value ?? '').toLowerCase().includes(query));
|
|
356
|
+
}
|
|
357
|
+
function isSamePrefabStage(stage, prefab) {
|
|
358
|
+
if (!stage)
|
|
359
|
+
return false;
|
|
360
|
+
return stage.assetId === prefab.assetId
|
|
361
|
+
|| (!!prefab.browserAssetId && stage.browserAssetId === prefab.browserAssetId);
|
|
362
|
+
}
|
|
363
|
+
function readRecord(value) {
|
|
364
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
365
|
+
}
|
|
366
|
+
function readString(value) {
|
|
367
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
368
|
+
}
|
|
369
|
+
function readPrefabPrimitive(value) {
|
|
370
|
+
const record = readRecord(value);
|
|
371
|
+
const shape = readString(record.shape);
|
|
372
|
+
return shape ? { ...structuredClone(record), shape } : null;
|
|
373
|
+
}
|
|
374
|
+
function createPrefabStageUnavailableMessage(assetId) {
|
|
375
|
+
const normalized = normalizeAgentBridgeString(assetId);
|
|
376
|
+
return normalized
|
|
377
|
+
? `Prefab stage is not open for asset: ${normalized}`
|
|
378
|
+
: 'Prefab stage is not open.';
|
|
379
|
+
}
|
|
380
|
+
function isRequestedPrefabStage(stage, assetId) {
|
|
381
|
+
const normalized = normalizeAgentBridgeString(assetId);
|
|
382
|
+
return !normalized || stage.assetId === normalized || stage.browserAssetId === normalized;
|
|
383
|
+
}
|
|
384
|
+
function createPrefabSceneOutput(details) {
|
|
385
|
+
const nodes = listPrefabSceneNodes(details.structureItems);
|
|
386
|
+
const rootNodeId = nodes.find(node => node.kind === 'root')?.nodeId
|
|
387
|
+
?? nodes.find(node => !node.parentNodeId)?.nodeId
|
|
388
|
+
?? PREFAB_ROOT_NODE_ID;
|
|
389
|
+
const selectedNodeId = getSelectedPrefabNodeId(details.stage.selectedItemId);
|
|
390
|
+
return {
|
|
391
|
+
stage: details.stage,
|
|
392
|
+
rootNodeId,
|
|
393
|
+
selectedNodeId,
|
|
394
|
+
nodes,
|
|
395
|
+
...(nodes.length === 0
|
|
396
|
+
? {
|
|
397
|
+
diagnostics: [{
|
|
398
|
+
severity: 'warning',
|
|
399
|
+
source: 'editor',
|
|
400
|
+
code: 'prefab.sceneEmpty',
|
|
401
|
+
message: 'Prefab stage did not expose editable prefab nodes.',
|
|
402
|
+
}],
|
|
403
|
+
}
|
|
404
|
+
: {}),
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function listPrefabSceneNodes(items) {
|
|
408
|
+
const nodes = [];
|
|
409
|
+
const visit = (item, parentNodeId, parentPath) => {
|
|
410
|
+
const nodeId = normalizePrefabNodeId(item.nodeId ?? item.id);
|
|
411
|
+
const isPrefabNode = item.itemType === 'prefab-node' || !!item.nodeId || item.id.startsWith(PREFAB_STAGE_ITEM_PREFIX);
|
|
412
|
+
const kind = normalizePrefabNodeKind(item.kind);
|
|
413
|
+
const path = parentPath ? `${parentPath}/${item.label}` : item.label;
|
|
414
|
+
const currentParentNodeId = isPrefabNode && nodeId ? nodeId : parentNodeId;
|
|
415
|
+
if (isPrefabNode && nodeId && kind) {
|
|
416
|
+
const transform = readPrefabItemTransform(item.transform);
|
|
417
|
+
const primitive = readPrefabPrimitive(item.primitive);
|
|
418
|
+
const node = {
|
|
419
|
+
nodeId,
|
|
420
|
+
...(item.guid ? { guid: item.guid } : {}),
|
|
421
|
+
name: item.label,
|
|
422
|
+
kind,
|
|
423
|
+
...(parentNodeId ? { parentNodeId } : { parentNodeId: null }),
|
|
424
|
+
...(path ? { path } : {}),
|
|
425
|
+
...(item.sourceAssetId ? { sourceAssetId: item.sourceAssetId } : {}),
|
|
426
|
+
...(item.sourceNodePath ? { sourceNodePath: item.sourceNodePath } : {}),
|
|
427
|
+
...(item.childPrefabId ? { childPrefabId: item.childPrefabId } : {}),
|
|
428
|
+
...(transform ? { transform } : {}),
|
|
429
|
+
...(primitive ? { primitive } : {}),
|
|
430
|
+
...(Object.keys(readRecord(item.defaults)).length > 0 ? { defaults: structuredClone(readRecord(item.defaults)) } : {}),
|
|
431
|
+
...(Object.keys(readRecord(item.overrides)).length > 0 ? { overrides: structuredClone(readRecord(item.overrides)) } : {}),
|
|
432
|
+
...(item.readonly != null ? { readonly: item.readonly } : {}),
|
|
433
|
+
};
|
|
434
|
+
nodes.push(node);
|
|
435
|
+
}
|
|
436
|
+
for (const child of item.children ?? []) {
|
|
437
|
+
visit(child, currentParentNodeId, path);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
for (const item of items)
|
|
441
|
+
visit(item, null, '');
|
|
442
|
+
return nodes;
|
|
443
|
+
}
|
|
444
|
+
function normalizePrefabNodeKind(kind) {
|
|
445
|
+
if (kind === 'root'
|
|
446
|
+
|| kind === 'group'
|
|
447
|
+
|| kind === 'model'
|
|
448
|
+
|| kind === 'primitive'
|
|
449
|
+
|| kind === 'light'
|
|
450
|
+
|| kind === 'prefabInstance'
|
|
451
|
+
|| kind === 'collision') {
|
|
452
|
+
return kind;
|
|
453
|
+
}
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
function normalizePrefabNodeId(value) {
|
|
457
|
+
const id = normalizeAgentBridgeString(value);
|
|
458
|
+
return id.startsWith(PREFAB_STAGE_ITEM_PREFIX) ? id.slice(PREFAB_STAGE_ITEM_PREFIX.length) : id;
|
|
459
|
+
}
|
|
460
|
+
function normalizePrefabEditableName(value) {
|
|
461
|
+
if (typeof value !== 'string')
|
|
462
|
+
return { ok: false, message: 'Prefab name must be a string.' };
|
|
463
|
+
const name = value.trim();
|
|
464
|
+
if (!name)
|
|
465
|
+
return { ok: false, message: 'Prefab name cannot be empty.' };
|
|
466
|
+
if (name.length > 80)
|
|
467
|
+
return { ok: false, message: 'Prefab name cannot be longer than 80 characters.' };
|
|
468
|
+
if (/[\u0000-\u001f\u007f/\\]/u.test(name)) {
|
|
469
|
+
return { ok: false, message: 'Prefab name cannot contain control characters, /, or \\.' };
|
|
470
|
+
}
|
|
471
|
+
return { ok: true, name };
|
|
472
|
+
}
|
|
473
|
+
function createPrefabAssetRenameOutput(input) {
|
|
474
|
+
return { ...input };
|
|
475
|
+
}
|
|
476
|
+
function createPrefabStageItemId(nodeId) {
|
|
477
|
+
return `${PREFAB_STAGE_ITEM_PREFIX}${nodeId}`;
|
|
478
|
+
}
|
|
479
|
+
function getSelectedPrefabNodeId(itemId) {
|
|
480
|
+
const nodeId = normalizePrefabNodeId(itemId);
|
|
481
|
+
return nodeId || null;
|
|
482
|
+
}
|
|
483
|
+
function resolvePrefabMutationParentNodeId(inputParentNodeId, scene) {
|
|
484
|
+
const parentNodeId = normalizePrefabNodeId(inputParentNodeId);
|
|
485
|
+
if (parentNodeId)
|
|
486
|
+
return parentNodeId;
|
|
487
|
+
return scene.selectedNodeId || scene.rootNodeId;
|
|
488
|
+
}
|
|
489
|
+
function createPrefabNodeCreateActionValue(input) {
|
|
490
|
+
const name = normalizeAgentBridgeString(input.name);
|
|
491
|
+
const sourceNodePath = normalizeAgentBridgeString(input.sourceNodePath);
|
|
492
|
+
const transform = input.position || input.rotation || input.scale
|
|
493
|
+
? createPrefabTransformActionValue(input)
|
|
494
|
+
: undefined;
|
|
495
|
+
const value = {
|
|
496
|
+
...(name ? { name } : {}),
|
|
497
|
+
...(sourceNodePath ? { sourceNodePath } : {}),
|
|
498
|
+
...(transform ? { transform } : {}),
|
|
499
|
+
};
|
|
500
|
+
return Object.keys(value).length > 0 ? value : undefined;
|
|
501
|
+
}
|
|
502
|
+
function createPrefabTransformActionValue(input, before) {
|
|
503
|
+
return {
|
|
504
|
+
type: 'Transform',
|
|
505
|
+
position: clonePrefabVec3(input.position ?? before?.position ?? ZERO_VEC3),
|
|
506
|
+
rotation: clonePrefabVec3(input.rotation ?? before?.rotation ?? ZERO_VEC3),
|
|
507
|
+
scale: clonePrefabVec3(input.scale ?? before?.scale ?? ONE_VEC3),
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
function readPrefabItemTransform(value) {
|
|
511
|
+
const record = readRecord(value);
|
|
512
|
+
if (Object.keys(record).length === 0)
|
|
513
|
+
return undefined;
|
|
514
|
+
const transform = {
|
|
515
|
+
...(isLocalEditorAgentBridgeVec3(record.position) ? { position: clonePrefabVec3(record.position) } : {}),
|
|
516
|
+
...(isLocalEditorAgentBridgeVec3(record.rotation) ? { rotation: clonePrefabVec3(record.rotation) } : {}),
|
|
517
|
+
...(isLocalEditorAgentBridgeVec3(record.scale) ? { scale: clonePrefabVec3(record.scale) } : {}),
|
|
518
|
+
};
|
|
519
|
+
return Object.keys(transform).length > 0 ? transform : undefined;
|
|
520
|
+
}
|
|
521
|
+
function clonePrefabVec3(value) {
|
|
522
|
+
return isLocalEditorAgentBridgeVec3(value) ? { x: value.x, y: value.y, z: value.z } : { ...ZERO_VEC3 };
|
|
523
|
+
}
|
|
524
|
+
function runNodeIdMutation(input) {
|
|
525
|
+
const nodeId = normalizePrefabNodeId(input.nodeId);
|
|
526
|
+
const parentNodeId = normalizePrefabNodeId(input.parentNodeId);
|
|
527
|
+
const details = input.operations.getPrefabStageDetails();
|
|
528
|
+
if (!details || !nodeId || (input.actionId === 'prefab.node.reparent' && !parentNodeId)) {
|
|
529
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, !details ? 'Prefab stage is not open.' : 'Prefab node id is required.', {
|
|
530
|
+
code: !details ? 'prefab.stageNotOpen' : 'prefab.invalidInput',
|
|
531
|
+
details: { nodeId: input.nodeId, parentNodeId: input.parentNodeId },
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
const beforeScene = createPrefabSceneOutput(details);
|
|
535
|
+
const node = beforeScene.nodes.find(candidate => candidate.nodeId === nodeId) ?? null;
|
|
536
|
+
if (!node) {
|
|
537
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, `Prefab node not found: ${nodeId}`, { code: 'prefab.nodeNotFound', details: { assetId: details.stage.assetId, nodeId } });
|
|
538
|
+
}
|
|
539
|
+
if (input.actionId === 'prefab.node.delete' && nodeId === beforeScene.rootNodeId) {
|
|
540
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, 'Prefab root node cannot be deleted.', { code: 'prefab.rootNodeProtected', details: { assetId: details.stage.assetId, nodeId } });
|
|
541
|
+
}
|
|
542
|
+
let renameName = null;
|
|
543
|
+
let previousName = null;
|
|
544
|
+
if (input.actionId === 'prefab.node.rename') {
|
|
545
|
+
if (nodeId === beforeScene.rootNodeId) {
|
|
546
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, 'Prefab root node name follows the prefab asset displayName; use prefab.asset.rename instead.', { code: 'prefab.rootRenameUseAssetRename', details: { assetId: details.stage.assetId, nodeId } });
|
|
547
|
+
}
|
|
548
|
+
const nameResult = normalizePrefabEditableName(input.value);
|
|
549
|
+
if (!nameResult.ok) {
|
|
550
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, nameResult.message, { code: 'prefab.invalidName', details: { assetId: details.stage.assetId, nodeId, name: String(input.value ?? '') } });
|
|
551
|
+
}
|
|
552
|
+
const conflict = beforeScene.nodes.find(candidate => candidate.nodeId !== nodeId
|
|
553
|
+
&& candidate.parentNodeId === node.parentNodeId
|
|
554
|
+
&& candidate.name?.trim().toLowerCase() === nameResult.name.toLowerCase());
|
|
555
|
+
if (conflict) {
|
|
556
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, `Prefab node name already exists under the same parent: ${nameResult.name}`, {
|
|
557
|
+
code: 'prefab.nodeNameConflict',
|
|
558
|
+
details: { assetId: details.stage.assetId, nodeId, conflictingNodeId: conflict.nodeId, name: nameResult.name },
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
previousName = node.name ?? '';
|
|
562
|
+
renameName = nameResult.name;
|
|
563
|
+
if (node.name === nameResult.name) {
|
|
564
|
+
return {
|
|
565
|
+
nodeId,
|
|
566
|
+
previousName,
|
|
567
|
+
name: nameResult.name,
|
|
568
|
+
selectedNodeId: beforeScene.selectedNodeId,
|
|
569
|
+
nodes: beforeScene.nodes,
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const action = {
|
|
574
|
+
actionId: input.actionId,
|
|
575
|
+
targetPrefabAssetId: details.stage.assetId,
|
|
576
|
+
nodeId,
|
|
577
|
+
...(parentNodeId ? { parentNodeId } : {}),
|
|
578
|
+
...(input.value !== undefined ? { value: input.value } : {}),
|
|
579
|
+
};
|
|
580
|
+
const mutationResult = runPrefabNodeMutation({
|
|
581
|
+
capabilityId: input.capabilityId,
|
|
582
|
+
state: input.state,
|
|
583
|
+
operations: input.operations,
|
|
584
|
+
renderUi: input.renderUi,
|
|
585
|
+
beforeScene,
|
|
586
|
+
action,
|
|
587
|
+
changedNodeId: input.actionId === 'prefab.node.delete' ? undefined : nodeId,
|
|
588
|
+
deletedNodeIds: input.actionId === 'prefab.node.delete' ? [nodeId] : undefined,
|
|
589
|
+
});
|
|
590
|
+
if (input.actionId !== 'prefab.node.rename' || 'ok' in mutationResult)
|
|
591
|
+
return mutationResult;
|
|
592
|
+
const renamedNode = mutationResult.nodes.find(candidate => candidate.nodeId === nodeId) ?? null;
|
|
593
|
+
return {
|
|
594
|
+
nodeId,
|
|
595
|
+
previousName: previousName ?? node.name ?? '',
|
|
596
|
+
name: renamedNode?.name ?? renameName ?? node.name ?? '',
|
|
597
|
+
selectedNodeId: mutationResult.selectedNodeId,
|
|
598
|
+
nodes: mutationResult.nodes,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
function runPrefabNodeMutation(input) {
|
|
602
|
+
const previousSelectedItemId = input.beforeScene.stage.selectedItemId ?? null;
|
|
603
|
+
const patched = input.operations.runPrefabStageAssetAction(input.action);
|
|
604
|
+
if (!patched) {
|
|
605
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, `Prefab action unavailable: ${input.action.actionId}`, {
|
|
606
|
+
code: 'prefab.actionUnavailable',
|
|
607
|
+
details: {
|
|
608
|
+
actionId: input.action.actionId,
|
|
609
|
+
assetId: input.beforeScene.stage.assetId,
|
|
610
|
+
nodeId: input.action.nodeId,
|
|
611
|
+
},
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
if (input.select === false && previousSelectedItemId)
|
|
615
|
+
input.operations.selectPrefabStageItem(previousSelectedItemId);
|
|
616
|
+
input.renderUi();
|
|
617
|
+
const afterDetails = input.operations.getPrefabStageDetails();
|
|
618
|
+
if (!afterDetails) {
|
|
619
|
+
return createLocalEditorAgentBridgeFailure(input.capabilityId, 'Prefab mutation completed, but Prefab stage is no longer open.', { code: 'prefab.stageClosed' });
|
|
620
|
+
}
|
|
621
|
+
const afterScene = createPrefabSceneOutput(afterDetails);
|
|
622
|
+
const beforeNodeIds = new Set(input.beforeScene.nodes.map(node => node.nodeId));
|
|
623
|
+
const afterNodeIds = new Set(afterScene.nodes.map(node => node.nodeId));
|
|
624
|
+
const createdNodeId = afterScene.nodes.find(node => !beforeNodeIds.has(node.nodeId))?.nodeId;
|
|
625
|
+
const deletedNodeIds = input.deletedNodeIds ?? input.beforeScene.nodes
|
|
626
|
+
.filter(node => !afterNodeIds.has(node.nodeId))
|
|
627
|
+
.map(node => node.nodeId);
|
|
628
|
+
const selectedNodeId = afterScene.selectedNodeId;
|
|
629
|
+
const changedNodeId = input.changedNodeId ?? createdNodeId ?? selectedNodeId ?? undefined;
|
|
630
|
+
const node = changedNodeId
|
|
631
|
+
? afterScene.nodes.find(candidate => candidate.nodeId === changedNodeId) ?? null
|
|
632
|
+
: selectedNodeId
|
|
633
|
+
? afterScene.nodes.find(candidate => candidate.nodeId === selectedNodeId) ?? null
|
|
634
|
+
: null;
|
|
635
|
+
return {
|
|
636
|
+
stage: afterScene.stage,
|
|
637
|
+
changed: true,
|
|
638
|
+
...(createdNodeId ? { createdNodeId } : {}),
|
|
639
|
+
...(changedNodeId ? { changedNodeId } : {}),
|
|
640
|
+
...(deletedNodeIds.length > 0 ? { deletedNodeIds } : {}),
|
|
641
|
+
selectedNodeId,
|
|
642
|
+
node,
|
|
643
|
+
rootNodeId: afterScene.rootNodeId,
|
|
644
|
+
nodes: afterScene.nodes,
|
|
645
|
+
status: input.state.status,
|
|
646
|
+
...(afterScene.diagnostics ? { diagnostics: afterScene.diagnostics } : {}),
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function resolvePrefabAssetForInspection(capabilityId, state, options, operations, input) {
|
|
650
|
+
const details = operations.getPrefabStageDetails();
|
|
651
|
+
if (!details) {
|
|
652
|
+
return {
|
|
653
|
+
ok: false,
|
|
654
|
+
result: createLocalEditorAgentBridgeFailure(capabilityId, 'Prefab stage is not open.', { code: 'prefab.stageNotOpen' }),
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
const scene = createPrefabSceneOutput(details);
|
|
658
|
+
const nodeId = normalizePrefabNodeId(input.nodeId) || scene.selectedNodeId || '';
|
|
659
|
+
const node = nodeId ? scene.nodes.find(candidate => candidate.nodeId === nodeId) ?? null : null;
|
|
660
|
+
const assetId = normalizeAgentBridgeString(input.assetId)
|
|
661
|
+
|| node?.sourceAssetId
|
|
662
|
+
|| node?.childPrefabId
|
|
663
|
+
|| '';
|
|
664
|
+
const asset = assetId ? findAgentBridgeVisibleAssetInfo(state, options, assetId) : null;
|
|
665
|
+
if (!asset) {
|
|
666
|
+
return {
|
|
667
|
+
ok: false,
|
|
668
|
+
result: createLocalEditorAgentBridgeFailure(capabilityId, `Prefab source asset not found: ${assetId || '(empty)'}`, { code: 'asset.notFound', details: { assetId, nodeId: node?.nodeId } }),
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
return {
|
|
672
|
+
ok: true,
|
|
673
|
+
scene,
|
|
674
|
+
asset,
|
|
675
|
+
node,
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function createPrefabSourceStructure(asset, node) {
|
|
679
|
+
const analysis = readRecord(readRecord(asset.metadata).assetAnalysis);
|
|
680
|
+
return {
|
|
681
|
+
assetId: asset.assetId,
|
|
682
|
+
...(node ? { nodeId: node.nodeId } : {}),
|
|
683
|
+
...(node?.sourceNodePath ? { sourceNodePath: node.sourceNodePath } : {}),
|
|
684
|
+
...(readNumber(analysis.nodeCount) != null ? { nodeCount: readNumber(analysis.nodeCount) } : {}),
|
|
685
|
+
...(readNumber(analysis.meshCount) != null ? { meshCount: readNumber(analysis.meshCount) } : {}),
|
|
686
|
+
...(readNumber(analysis.materialCount) != null ? { materialCount: readNumber(analysis.materialCount) } : {}),
|
|
687
|
+
...(readNumber(analysis.textureCount) != null ? { textureCount: readNumber(analysis.textureCount) } : {}),
|
|
688
|
+
...(Array.isArray(analysis.nodes) ? { nodes: structuredClone(analysis.nodes) } : {}),
|
|
689
|
+
...(Array.isArray(analysis.meshes) ? { meshes: structuredClone(analysis.meshes) } : {}),
|
|
690
|
+
...(Array.isArray(analysis.materials) ? { materials: structuredClone(analysis.materials) } : {}),
|
|
691
|
+
...(readString(asset.relativePath) ? { relativePath: asset.relativePath } : {}),
|
|
692
|
+
...(readString(asset.contentHash) ? { contentHash: asset.contentHash } : {}),
|
|
693
|
+
...(readString(analysis.summary) ? { summary: readString(analysis.summary) } : {}),
|
|
694
|
+
...(readString(analysis.complexity) ? { complexity: readString(analysis.complexity) } : {}),
|
|
695
|
+
...(Array.isArray(analysis.diagnostics) ? { diagnostics: structuredClone(analysis.diagnostics) } : {}),
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
function createPrefabMaterialSlots(asset, node) {
|
|
699
|
+
const slots = readArray(readRecord(asset.metadata).materialSlots);
|
|
700
|
+
return slots.map((slot, index) => {
|
|
701
|
+
const slotId = readString(slot.slotId) ?? readString(slot.id);
|
|
702
|
+
const ownerNodePath = readString(slot.ownerNodePath);
|
|
703
|
+
const sourceMaterialIndex = readNumber(slot.sourceMaterialIndex);
|
|
704
|
+
const sourceMaterialName = readString(slot.sourceMaterialName)
|
|
705
|
+
?? readString(slot.materialName)
|
|
706
|
+
?? readArray(slot.materialNames).map(readString).find(Boolean);
|
|
707
|
+
const editable = !!slotId || !!ownerNodePath;
|
|
708
|
+
const bindingPath = slotId
|
|
709
|
+
? `prefab.overrides.materialSlotBindings.${slotId}`
|
|
710
|
+
: ownerNodePath
|
|
711
|
+
? `prefab.overrides.childMaterialBindings.${ownerNodePath}`
|
|
712
|
+
: undefined;
|
|
713
|
+
return {
|
|
714
|
+
...(slotId ? { slotId } : {}),
|
|
715
|
+
label: readString(slot.label) ?? sourceMaterialName ?? `Material Slot ${index + 1}`,
|
|
716
|
+
...(ownerNodePath ? { ownerNodePath } : {}),
|
|
717
|
+
...(sourceMaterialIndex != null ? { sourceMaterialIndex } : {}),
|
|
718
|
+
...(sourceMaterialName ? { sourceMaterialName } : {}),
|
|
719
|
+
...(bindingPath ? { bindingPath, overridePath: bindingPath } : {}),
|
|
720
|
+
...(bindingPath ? { materialAssetIdPath: `${bindingPath}.materialAssetId` } : {}),
|
|
721
|
+
...(node ? { nodeId: node.nodeId } : {}),
|
|
722
|
+
editable,
|
|
723
|
+
...(!editable ? { readonlyReason: 'Material slot has no stable slotId or owner node path.' } : {}),
|
|
724
|
+
};
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
function readArray(value) {
|
|
728
|
+
return Array.isArray(value)
|
|
729
|
+
? value.filter((item) => !!item && typeof item === 'object' && !Array.isArray(item))
|
|
730
|
+
: [];
|
|
731
|
+
}
|
|
732
|
+
function readNumber(value) {
|
|
733
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
734
|
+
}
|
|
735
|
+
//# sourceMappingURL=prefabs.js.map
|