@volter/editor-game 0.5.65 → 0.5.67
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/contributions/audio-unlock.service.ts +2 -2
- package/contributions/autoplay.service.ts +1 -1
- package/contributions/bridge.command.ts +3 -3
- package/contributions/canvas/component-board.service.ts +16 -0
- package/contributions/canvas/design-time-mount.service.ts +45 -0
- package/contributions/canvas-story-capture.service.ts +12 -0
- package/contributions/edit-mode-audio.service.ts +2 -2
- package/contributions/edit-mode-networking.service.ts +1 -1
- package/contributions/gameplay.command.ts +4 -4
- package/contributions/generation.service.ts +3 -3
- package/contributions/generations.status.tsx +1 -1
- package/contributions/godot.palette.json +99 -0
- package/contributions/godot.style.ts +82 -0
- package/contributions/godot.view.ts +75 -0
- package/contributions/ingest.service.ts +4 -4
- package/contributions/instances.command.ts +1 -1
- package/contributions/navmesh.menu.ts +1 -1
- package/contributions/network-observer.service.ts +14 -0
- package/contributions/play.command.ts +11 -5
- package/contributions/react/component-board.service.ts +1 -1
- package/contributions/react/design-time-mount.service.ts +1 -1
- package/contributions/react/react-inspector.service.ts +2 -2
- package/contributions/scene-document.service.ts +5 -5
- package/contributions/state-watch.menu.ts +1 -1
- package/contributions/state-watch.utility.tsx +1 -1
- package/contributions/team-playtest.service.ts +4 -4
- package/contributions/three/component-board.service.ts +1 -1
- package/contributions/three/component-verbs.command.ts +8 -8
- package/contributions/three/three-authoring.service.ts +8 -5
- package/contributions/three-story-capture.service.ts +12 -0
- package/contributions/unity.palette.json +102 -0
- package/contributions/unity.style.ts +72 -0
- package/contributions/unity.view.ts +82 -0
- package/contributions/unreal.palette.json +105 -0
- package/contributions/unreal.style.ts +66 -0
- package/contributions/unreal.view.ts +93 -0
- package/dist-node/serving.mjs +16 -0
- package/package.json +33 -16
- package/serving/index.ts +27 -0
- package/src/asset-budget/AssetBudgetPanel.tsx +1 -1
- package/src/asset-budget/asset-budget-model.ts +4 -4
- package/src/asset-budget/optimize-apply.ts +7 -7
- package/src/audio/AudioDebuggerPanel.tsx +1 -1
- package/src/bridge/dispatch.ts +16 -16
- package/src/bridge/live-frames.ts +1 -1
- package/src/bridge/screenshot.ts +6 -6
- package/src/build/BuildProfilesPanel.tsx +3 -3
- package/src/canvas/canvas-board/CanvasBoardDocument.tsx +676 -0
- package/src/canvas/canvas-board/canvas-board-model.ts +407 -0
- package/src/canvas/canvas-board/canvas-component-board.ts +56 -0
- package/src/canvas/canvas-design-mount.ts +524 -0
- package/src/canvas/design-time-canvas-mount.ts +79 -0
- package/src/coverage/live-authoring-surface.ts +6 -6
- package/src/coverage/live-project-verbs.ts +2 -2
- package/src/coverage/native-system-coverage.ts +6 -6
- package/src/coverage/root-coverage.ts +1 -1
- package/src/coverage/session-coverage.ts +5 -5
- package/src/design-system-stories/ApplicationChrome.stories.tsx +5 -5
- package/src/design-system-stories/InspectorNarrowBodies.stories.tsx +13 -53
- package/src/edit-mode/edit-mode-audio.ts +4 -4
- package/src/edit-mode/edit-mode-networking.ts +2 -2
- package/src/game-document/GameCaptureFrameButton.tsx +2 -2
- package/src/game-document/GameDocument.tsx +2 -2
- package/src/game-document/GamePanel.tsx +8 -8
- package/src/game-document/InstanceInspectorPicker.tsx +2 -2
- package/src/game-document/crowd-debug.ts +1 -1
- package/src/game-document/device-preview.ts +10 -11
- package/src/game-document/physics-debug.ts +1 -1
- package/src/generation/GenerationActivity.tsx +6 -8
- package/src/generation/generation-documents.tsx +8 -8
- package/src/generation/generation-jobs.ts +2 -2
- package/src/generation/generation-presentation.ts +1 -1
- package/src/host/adapter-reach.ts +1 -1
- package/src/host/adapter-runtime-bindings.ts +97 -6
- package/src/host/api/configurations.ts +2 -2
- package/src/host/authoring/babylon-authoring-adapter.ts +8 -8
- package/src/host/authoring/contract-hierarchy-authoring.ts +1 -1
- package/src/host/authoring/contract-scenes-stories.ts +1 -1
- package/src/host/authoring/creation-site-related.ts +2 -2
- package/src/host/authoring/ephemeral-persistence.ts +1 -1
- package/src/host/authoring/gesture-persist.ts +2 -2
- package/src/host/authoring/ingest-data-writer.ts +1 -1
- package/src/host/authoring/ingest-source-persistence.ts +8 -8
- package/src/host/authoring/mount-isolated-pixi-screen.ts +1 -1
- package/src/host/authoring/mounted-authoring.ts +4 -4
- package/src/host/authoring/phaser-live-authoring-adapter.ts +4 -4
- package/src/host/authoring/pixi-authoring-adapter.ts +42 -17
- package/src/host/authoring/pixi-creation-site-write-target.ts +2 -2
- package/src/host/authoring/pixi-live-write-target.ts +7 -7
- package/src/host/authoring/pixi-source-identity.ts +3 -3
- package/src/host/authoring/pixi-source-write-target.ts +1614 -0
- package/src/host/authoring/pixi-still-presentation.ts +2 -2
- package/src/host/authoring/pixi-structure-history.ts +3 -3
- package/src/host/authoring/pixi-transform-channels.ts +16 -14
- package/src/host/authoring/source-persistence-backend.ts +6 -6
- package/src/host/authoring/struct-write-pipe.ts +3 -3
- package/src/host/binding-resolver.ts +8 -9
- package/src/host/browser-transpile.ts +2 -2
- package/src/host/canvas-entry-runtime.ts +59 -48
- package/src/host/canvas-preview-frames.ts +482 -0
- package/src/host/components/CameraAuthoringOverlay.tsx +1 -1
- package/src/host/components/HeaderTelemetry.tsx +9 -16
- package/src/host/components/PixiIsolationSceneContent.tsx +17 -16
- package/src/host/components/ThreeIsolationSceneContent.tsx +5 -5
- package/src/host/components/frame-debugger-model.ts +2 -2
- package/src/host/components/header-telemetry-model.ts +2 -2
- package/src/host/components/scene-document.tsx +29 -61
- package/src/host/components/utility-view-state.ts +1 -1
- package/src/host/components/world-root-stage-binding.tsx +17 -26
- package/src/host/components/world-root-stage.ts +130 -63
- package/src/host/coverage/capability-coverage.ts +13 -1
- package/src/host/coverage/game-contract-seam-evidence.ts +1 -1
- package/src/host/coverage/project-verb-coverage.ts +2 -17
- package/src/host/coverage/system-adapter-coverage.ts +4 -5
- package/src/host/design-system-stories/fixtures/editor-runtime.tsx +14 -8
- package/src/host/document-preview-three.ts +2 -2
- package/src/host/entry-adjudication.ts +6 -6
- package/src/host/game-css-scope-transform.ts +4 -0
- package/src/host/game-module-access.ts +1 -1
- package/src/host/game-realm-page.ts +16 -8
- package/src/host/game-realm-reclaim.ts +1 -1
- package/src/host/gameplay-export.ts +25 -14
- package/src/host/gameplay-recording.ts +5 -5
- package/src/host/gated-globals.ts +6 -6
- package/src/host/history/json-history-resource.ts +3 -3
- package/src/host/instance-extract-actions.ts +1 -1
- package/src/host/instance-fork-actions.ts +1 -1
- package/src/host/projection/dom.ts +2 -2
- package/src/host/projection/pixi.ts +25 -3
- package/src/host/r3f-entry-runtime.ts +65 -34
- package/src/host/react-mount-runtime.ts +8 -49
- package/src/host/realm-services.ts +2 -2
- package/src/host/roots/canvas-root.tsx +361 -0
- package/src/host/roots/module-root.ts +1 -1
- package/src/host/roots/r3f-root.tsx +473 -0
- package/src/host/roots/react-root.ts +9 -43
- package/src/host/scene-view-drawability.ts +2 -2
- package/src/host/served-bundle-runtime-modules.ts +1 -19
- package/src/host/server-log-bridge.ts +3 -3
- package/src/host/stories/mounted-story-viewport-source.ts +1 -1
- package/src/host/stories/pixi-story-model.ts +30 -0
- package/src/host/stories/story-media-captures.ts +46 -0
- package/src/host/stories/story-media-presence.ts +3 -3
- package/src/host/stories/story-pixi-preview.ts +408 -0
- package/src/host/stories/story-three-preview.ts +806 -0
- package/src/host/stories/three-story-captures.ts +35 -0
- package/src/host/story-three-preview-runtime.ts +56 -0
- package/src/host/three-ingest-runtime.ts +1 -1
- package/src/host/use-active-performance-source.ts +3 -3
- package/src/host/viewport-pose-memory.ts +1 -1
- package/src/host/viewport-root-presentation.ts +6 -5
- package/src/ingest/active-ingest.ts +2 -2
- package/src/ingest/authoring/ingest-dom-surface-authoring.ts +4 -4
- package/src/ingest/authoring/ingest-root-adapter.ts +13 -13
- package/src/ingest/capture-wait-report.ts +1 -1
- package/src/ingest/deferred-ingest-play.ts +11 -10
- package/src/ingest/discovery-public-ingest.ts +2 -2
- package/src/ingest/ingest-boot-viewport.ts +6 -8
- package/src/ingest/ingest-canvas-scene-document.tsx +17 -16
- package/src/ingest/ingest-canvas-scene.ts +5 -8
- package/src/ingest/ingest-evidence-hook.ts +1 -1
- package/src/ingest/ingest-frame-snapshot.ts +1 -1
- package/src/ingest/ingest-play-control.ts +4 -4
- package/src/ingest/ingest-render-debug.ts +11 -11
- package/src/ingest/ingest-siblings.ts +16 -28
- package/src/ingest/module-mode.ts +18 -19
- package/src/ingest/mount-canvas-ingest-root.ts +27 -27
- package/src/ingest/mount-coverage.ts +4 -4
- package/src/ingest/mount-dom-ingest-root.ts +16 -16
- package/src/ingest/mount-ingest-root.ts +14 -14
- package/src/ingest/mount-three-ingest-root.ts +12 -12
- package/src/ingest/resolve-canvas.ts +1 -1
- package/src/ingest/served-html-boot.ts +1 -1
- package/src/ingest/surface-canvas.ts +1 -1
- package/src/ingest/unmount-ingest-root.ts +7 -7
- package/src/navmesh/navmesh-handler.ts +24 -16
- package/src/network/NetworkInspectorPanel.tsx +449 -14
- package/src/network/network-inspector-model.ts +14 -2
- package/src/play/play-log-events.ts +1 -1
- package/src/play/play-mode.ts +99 -142
- package/src/play/play-recording.ts +2 -2
- package/src/play/react-play-live-authoring.ts +3 -3
- package/src/play/run-selection.ts +93 -0
- package/src/play-bar/PlayBar.tsx +20 -39
- package/src/profiler/FrameDebuggerPanel.tsx +1 -1
- package/src/profiler/PerformancePanel.tsx +4 -4
- package/src/react/design-time-react-mount.ts +37 -85
- package/src/react/dom-authoring-adapter.ts +11 -11
- package/src/react/react-inspector-section.tsx +13 -13
- package/src/react/react-world-authoring-adapter.ts +31 -143
- package/src/react/story-documents/story-documents.tsx +18 -22
- package/src/react/ui-board-document.tsx +10 -11
- package/src/react/ui-component-board.ts +5 -5
- package/src/runtime/adapter/audio-meter.ts +21 -0
- package/src/runtime/adapter/first-party-audio-system.ts +230 -0
- package/src/runtime/adapter/ingest/contract-debug-adapter.ts +114 -0
- package/src/runtime/adapter/ingest/contract-system-adapters.ts +256 -0
- package/src/runtime/adapter/ingest/merge-debug-adapters.ts +197 -0
- package/src/runtime/adapter/ingest/observation-debug-adapter.ts +162 -0
- package/src/runtime/adapter/ingest/upstream-pin.ts +51 -0
- package/src/runtime/adapter/native-debug-module.ts +498 -0
- package/src/runtime/audio/bus-mixer.ts +161 -0
- package/src/runtime/audio/pose-guard.ts +80 -0
- package/src/runtime/core/frame-pacing.ts +126 -0
- package/src/runtime/core/game-loop.ts +225 -0
- package/src/runtime/core/game-scoped-slot.ts +28 -0
- package/src/runtime/core/seeded-random.ts +162 -0
- package/src/runtime/core/sim-clock.ts +391 -0
- package/src/runtime/core/system-runner.ts +269 -0
- package/src/runtime/core/types.ts +104 -0
- package/src/runtime/create-runtime.ts +1128 -0
- package/src/runtime/debug-bridge.ts +570 -0
- package/src/runtime/debug-registry.ts +899 -0
- package/src/runtime/dev/chrome-trace.ts +153 -0
- package/src/runtime/dev/instruments.ts +403 -0
- package/src/runtime/dev/logger.ts +119 -0
- package/src/runtime/dev/performance-profiler.ts +367 -0
- package/src/runtime/dev/register-render-vitals.ts +276 -0
- package/src/runtime/dev/render-census.ts +354 -0
- package/src/runtime/dev/render-debug-adapter.ts +218 -0
- package/src/runtime/dev/render-memory.ts +226 -0
- package/src/runtime/dev/render-vitals.ts +338 -0
- package/src/runtime/dev/static-batch-advisor.ts +188 -0
- package/src/runtime/dev/webgl-frame-capture.ts +366 -0
- package/src/runtime/dev/webgl-gpu-timer.ts +53 -0
- package/src/runtime/dev-build.ts +47 -0
- package/src/runtime/game.ts +1636 -0
- package/src/runtime/gameplay-rng-trap.ts +135 -0
- package/src/runtime/host-context.ts +64 -0
- package/src/runtime/input-router.ts +169 -0
- package/src/runtime/mount-manifest.ts +480 -0
- package/src/runtime/pixi/authoring.ts +706 -0
- package/src/runtime/pixi/ingest.ts +116 -0
- package/src/runtime/pixi/physics-registry.ts +49 -0
- package/src/runtime/pixi/render-pass-bracket.ts +117 -0
- package/src/runtime/pixi/scene-capture.ts +179 -0
- package/src/runtime/pixi/system-adapters.ts +69 -0
- package/src/runtime/playtest.ts +22 -0
- package/src/runtime/presentation.ts +141 -0
- package/src/runtime/render-control.ts +642 -0
- package/src/runtime/render-seed.ts +77 -0
- package/src/runtime/run-ticks-settled.ts +73 -0
- package/src/runtime/setup/setup-audio.ts +72 -0
- package/src/services/audio-pose-guard.ts +2 -2
- package/src/services/game-audio.ts +152 -0
- package/src/services/game-network.ts +657 -0
- package/src/services/game-physics.ts +334 -0
- package/src/state-watch/StateWatchPanel.tsx +1 -1
- package/src/three/authoring/camera-runtime-inspector-section.tsx +4 -3
- package/src/three/authoring/constraint-inspector-section.tsx +8 -7
- package/src/three/authoring/model-asset-inspector-section.tsx +14 -17
- package/src/three/authoring/oid-source-persistence.ts +13 -13
- package/src/three/authoring/r3f-design-session.ts +79 -61
- package/src/three/authoring/r3f-source-authoring-adapter.ts +112 -108
- package/src/three/authoring/reflection-probe-inspector-section.tsx +5 -4
- package/src/three/authoring/spatial-joint-handles.ts +1 -1
- package/src/three/authoring/spatial-lod-handles.ts +1 -1
- package/src/three/authoring/spatial-particle-handles.ts +1 -1
- package/src/three/authoring/three-authoring-adapter.ts +33 -33
- package/src/three/component-verbs/extract-menu.ts +8 -7
- package/src/three/component-verbs/fork-menu.ts +8 -7
- package/src/three/component-verbs/internals-menu.ts +3 -3
- package/src/three/drei-asset-caches.ts +13 -0
- package/src/three/story-documents/three-story-documents.tsx +24 -34
- package/src/three/three-board/ThreeBoardDocument.tsx +25 -25
- package/src/three/three-board/board-scene.ts +7 -7
- package/src/three/three-board/three-component-board.ts +5 -5
- package/contributions/react/pasteboard.action.ts +0 -41
- package/contributions/xstate-behavior.action.ts +0 -42
- package/contributions/xstate-behavior.document.tsx +0 -73
- package/contributions/xstate-behavior.inspector.tsx +0 -28
- package/contributions/xstate-behavior.menu.ts +0 -23
- package/src/react/pasteboard-materialize.ts +0 -154
- package/src/services/game-audio-unlock.ts +0 -48
- package/src/xstate/XStateBehaviorSection.tsx +0 -130
- package/src/xstate/XStateMachineInspector.tsx +0 -566
- package/src/xstate/character-animation-machine.fixture.ts +0 -74
- package/src/xstate/live-behaviors.ts +0 -106
- package/src/xstate/use-live-actor-state.ts +0 -44
- package/src/xstate/xstate-graph.ts +0 -235
- package/src/xstate/xstate-layout.ts +0 -76
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* resetting the gate is no longer a separate step.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { setActiveAuthoring } from '@volter/editor-
|
|
20
|
-
import { setActiveSystems } from '@volter/editor-
|
|
21
|
-
import { clearMountFailureReports } from '@volter/editor-
|
|
22
|
-
import { editorConsole } from '@volter/editor-
|
|
19
|
+
import { setActiveAuthoring } from '@volter/editor-sdk/kit/authoring/active-adapter';
|
|
20
|
+
import { setActiveSystems } from '@volter/editor-sdk/kit/authoring/active-systems';
|
|
21
|
+
import { clearMountFailureReports } from '@volter/editor-sdk/kit/mount-failure-report';
|
|
22
|
+
import { editorConsole } from '@volter/editor-sdk/kit/editor-console';
|
|
23
23
|
import { reclaimGameRealm } from '../host/game-realm-reclaim';
|
|
24
24
|
import { setGameRealmReloadHandler } from '../host/gated-globals';
|
|
25
25
|
import {
|
|
@@ -121,7 +121,7 @@ function disposeThreejsSession(s: IngestSession): void {
|
|
|
121
121
|
/* scene may not have been swapped if capture failed */
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
s.store.setPlayState('stopped');
|
|
124
|
+
s.store.shell.setPlayState('stopped');
|
|
125
125
|
|
|
126
126
|
// Tear down the mounted game (stops its loop, frees renderer, uninstalls trap).
|
|
127
127
|
try {
|
|
@@ -153,7 +153,7 @@ function disposePixiSession(s: IngestSession2D): void {
|
|
|
153
153
|
setActiveAuthoring(null);
|
|
154
154
|
setActiveSystems(null);
|
|
155
155
|
clearMountFailureReports(); // D-W3: no session -> nothing left to report
|
|
156
|
-
s.store.setPlayState('stopped');
|
|
156
|
+
s.store.shell.setPlayState('stopped');
|
|
157
157
|
try {
|
|
158
158
|
s.dispose();
|
|
159
159
|
} catch {
|
|
@@ -177,7 +177,7 @@ function disposeReactSession(s: IngestSessionReact): void {
|
|
|
177
177
|
setActiveAuthoring(null);
|
|
178
178
|
setActiveSystems(null);
|
|
179
179
|
clearMountFailureReports(); // D-W3: no session -> nothing left to report (mirrors disposeThreejsSession's identical call)
|
|
180
|
-
s.store.setPlayState('stopped');
|
|
180
|
+
s.store.shell.setPlayState('stopped');
|
|
181
181
|
try {
|
|
182
182
|
s.stop();
|
|
183
183
|
} catch {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getActiveSystems } from '@volter/editor-
|
|
1
|
+
import { getActiveSystems } from '@volter/editor-sdk/kit/authoring/active-systems';
|
|
2
2
|
import { editorHost } from '@volter/editor-sdk/host';
|
|
3
3
|
import type { NavigationAdapter } from '@volter/editor-project/adapter';
|
|
4
4
|
import { getUserData } from '@volter/threejs-runtime/ecs/user-data';
|
|
@@ -11,18 +11,21 @@ import {
|
|
|
11
11
|
navBakeBusy,
|
|
12
12
|
resetNavMeshBaked,
|
|
13
13
|
} from './navmesh-workflow-store';
|
|
14
|
+
import { threeNavigation } from '@volter/editor-threejs/adapter/three-contract';
|
|
15
|
+
import { hostHierarchyObjects } from '@volter/editor-threejs/host-hierarchy-objects';
|
|
16
|
+
import { setViewportHelper, viewportRig } from '@volter/editor-threejs/viewport-door';
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* The game skew's side of the Navigation verbs: bake/clear and the walkable
|
|
17
|
-
* overlay tint, shown through the viewport door (`
|
|
20
|
+
* overlay tint, shown through the viewport door (`viewport-door`'s `setViewportHelper`,
|
|
18
21
|
* kind `navmesh` — the Helpers menu's own toggle).
|
|
19
22
|
*
|
|
20
23
|
* Started by `contributions/navmesh.service.ts`, so its lifetime is the
|
|
21
24
|
* contribution pass; it used to be a mount effect in the editor's scene panel,
|
|
22
25
|
* which made a host panel the owner of a game-skew tool.
|
|
23
26
|
*
|
|
24
|
-
* It reads the authoring scene through `host
|
|
25
|
-
* viewport through `
|
|
27
|
+
* It reads the authoring scene through `host-hierarchy-objects` and the
|
|
28
|
+
* viewport through `viewport-door`'s `setViewportHelper` / `.rig()`, but keeps the
|
|
26
29
|
* `@editor/authoring/active-systems` import for the adapter itself: the bake
|
|
27
30
|
* collects the PRIMARY AUTHORING mount's walkable meshes, so the adapter it
|
|
28
31
|
* bakes into must be that same mount's — `getActiveSystems()`. The door's
|
|
@@ -63,20 +66,21 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
63
66
|
*/
|
|
64
67
|
function collectNavigationIds(role: 'walkable' | 'obstacle'): Set<string> {
|
|
65
68
|
const ids = new Set<string>();
|
|
66
|
-
for (const [id, obj] of
|
|
69
|
+
for (const [id, obj] of (hostHierarchyObjects()?.objects() ?? new Map<string, THREE.Object3D>())) {
|
|
67
70
|
if (getUserData(obj, 'navRole') === role) ids.add(id);
|
|
68
71
|
}
|
|
69
72
|
return ids;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
function clearPresentation(): void {
|
|
73
|
-
|
|
76
|
+
setViewportHelper('navmesh', null);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
/** Follow late registration/replacement of the primary mounted adapter. A
|
|
77
80
|
* root may register navigation only after its async WASM setup completes. */
|
|
78
81
|
function syncMountedNavigation(): void {
|
|
79
|
-
const
|
|
82
|
+
const active = getActiveSystems().navigation;
|
|
83
|
+
const nav = active ? threeNavigation(active) : null;
|
|
80
84
|
if (nav !== boundNavigation) {
|
|
81
85
|
boundNavigation = nav;
|
|
82
86
|
clearPresentation();
|
|
@@ -101,7 +105,7 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
101
105
|
markNavMeshBaked();
|
|
102
106
|
// The adapter builds its debug mesh against the editor's scene; without
|
|
103
107
|
// a mounted viewport there is nothing to show it in.
|
|
104
|
-
const scene =
|
|
108
|
+
const scene = viewportRig()?.scene;
|
|
105
109
|
if (!scene) return;
|
|
106
110
|
let debugMesh: THREE.Object3D | null = null;
|
|
107
111
|
try {
|
|
@@ -114,7 +118,7 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
114
118
|
}
|
|
115
119
|
if (debugMesh) {
|
|
116
120
|
applyWalkableTint(debugMesh);
|
|
117
|
-
|
|
121
|
+
setViewportHelper('navmesh', debugMesh);
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
|
|
@@ -124,7 +128,8 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
124
128
|
// Recast's solo bake is synchronous WASM — yield a frame so the Bake
|
|
125
129
|
// button visibly paints its busy state before the build blocks the thread.
|
|
126
130
|
await new Promise((r) => requestAnimationFrame(() => r(null)));
|
|
127
|
-
const
|
|
131
|
+
const active = getActiveSystems().navigation;
|
|
132
|
+
const nav = active ? threeNavigation(active) : undefined;
|
|
128
133
|
if (!nav) {
|
|
129
134
|
const reason = 'The mounted game has no NavigationAdapter';
|
|
130
135
|
editorHost().console.warn(`${reason} — nothing can be baked`, 'navigation');
|
|
@@ -141,7 +146,9 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
141
146
|
const walkableIds = collectNavigationIds('walkable');
|
|
142
147
|
if (walkableIds.size === 0) {
|
|
143
148
|
editorHost().console.warn(
|
|
144
|
-
|
|
149
|
+
// The role is the object's own `userData.navRole` (see `collectNavigationIds`); a source
|
|
150
|
+
// world tags it where the mesh is written.
|
|
151
|
+
'No walkable meshes found — give the floors `userData={{ navRole: \'walkable\' }}` (and blockers `\'obstacle\'`) where they are written',
|
|
145
152
|
'navigation',
|
|
146
153
|
);
|
|
147
154
|
endNavBake('No walkable-tagged entities in the scene');
|
|
@@ -155,7 +162,7 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
155
162
|
// the bake; obstacles alone can't produce a mesh.
|
|
156
163
|
const meshes: THREE.Mesh[] = [];
|
|
157
164
|
for (const id of [...walkableIds, ...collectNavigationIds('obstacle')]) {
|
|
158
|
-
const obj =
|
|
165
|
+
const obj = (hostHierarchyObjects()?.objects() ?? new Map<string, THREE.Object3D>()).get(id);
|
|
159
166
|
if (!obj) continue;
|
|
160
167
|
obj.traverse((child) => {
|
|
161
168
|
if ((child as THREE.Mesh).isMesh) meshes.push(child as THREE.Mesh);
|
|
@@ -186,11 +193,11 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
186
193
|
}
|
|
187
194
|
|
|
188
195
|
boundNavigation = nav;
|
|
189
|
-
const scene =
|
|
196
|
+
const scene = viewportRig()?.scene;
|
|
190
197
|
const debugMesh = scene ? nav.debugMesh(scene) : null;
|
|
191
198
|
if (debugMesh) {
|
|
192
199
|
applyWalkableTint(debugMesh);
|
|
193
|
-
|
|
200
|
+
setViewportHelper('navmesh', debugMesh);
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
endNavBake(null);
|
|
@@ -200,7 +207,8 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
200
207
|
};
|
|
201
208
|
|
|
202
209
|
const onClear = () => {
|
|
203
|
-
const
|
|
210
|
+
const active = getActiveSystems().navigation;
|
|
211
|
+
const nav = active ? threeNavigation(active) : undefined;
|
|
204
212
|
if (!nav) {
|
|
205
213
|
editorHost().console.warn('The mounted game has no NavigationAdapter to clear', 'navigation');
|
|
206
214
|
return;
|
|
@@ -213,7 +221,7 @@ export function setupNavMeshHandlers(): () => void {
|
|
|
213
221
|
return;
|
|
214
222
|
}
|
|
215
223
|
try {
|
|
216
|
-
nav.clear(
|
|
224
|
+
nav.clear(viewportRig()?.scene ?? new THREE.Scene());
|
|
217
225
|
} catch (error) {
|
|
218
226
|
editorHost().console.error(`NavMesh clear failed: ${error}`, 'navigation');
|
|
219
227
|
return;
|