@volter/editor-blender 0.1.146 → 0.1.148

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.
@@ -3,7 +3,11 @@ import { modelOpeningErrorMessage } from '../src/model-opening-error';
3
3
  import { Button, StateSurface, fontMono, fontSizeVar, spaceVar, themeVars } from '@volter/sdk/widgets';
4
4
  import type { AuthoringAdapter, EditorNode } from '@volter/project/adapter';
5
5
  import { AssetEditorSubject } from '@volter/sdk/kit/components/AssetEditorShell';
6
- import { useMemo } from 'react';
6
+ import { useEffect, useMemo, useState } from 'react';
7
+
8
+ /** How long an open may run before the surface says it may have stalled and offers a retry. A
9
+ * limited view's first open downloads the engine and the project, so this is generous. */
10
+ const STALL_AFTER_MS = 180_000;
7
11
 
8
12
  /** A loading/error surface has no authoring stage and publishes no model. */
9
13
  export function BlenderModelOpening({ documentId, path, error, preview, retry, returnToPreview, preparingView = false, note = null }: {
@@ -18,6 +22,18 @@ export function BlenderModelOpening({ documentId, path, error, preview, retry, r
18
22
  readonly note?: string | null;
19
23
  }) {
20
24
  const title = error ? 'Could not open model' : preparingView ? 'Preparing model view' : 'Opening model';
25
+ // A STALLED OPEN SAYS SO: a playtester waited twenty minutes on "Preparing Blender" with no error,
26
+ // no progress and no way out but reloading the page. After STALL_AFTER_MS the surface names the
27
+ // wait and offers the same retry an error does.
28
+ const [startedAt] = useState(() => Date.now());
29
+ const [now, setNow] = useState(() => Date.now());
30
+ useEffect(() => {
31
+ if (error) return;
32
+ const timer = setInterval(() => setNow(Date.now()), 5_000);
33
+ return () => clearInterval(timer);
34
+ }, [error]);
35
+ const waited = now - startedAt;
36
+ const stalled = !error && waited >= STALL_AFTER_MS;
21
37
  // This document has not published an authoring stage yet. Its panels still
22
38
  // belong to it, rather than the empty project's "Declare a root" fallback.
23
39
  // A boundary row is informational; no old model objects remain editable.
@@ -49,13 +65,16 @@ export function BlenderModelOpening({ documentId, path, error, preview, retry, r
49
65
  {/* THE CAUSE, VERBATIM, where the person is looking: the sentence above is a
50
66
  category, and "details are available in the console" sent people to a console
51
67
  they could not see (2026-10-06 audit). Selectable, so it can be copied. */}
68
+ {stalled && <div data-testid="blender-model-opening-stalled" style={{ marginTop: spaceVar[3], color: themeVars.content.primary }}>
69
+ Still opening after {Math.floor(waited / 60_000)} minutes. It may have stalled: retry opening, or reload the page.
70
+ </div>}
52
71
  {!error && note && <div data-testid="blender-model-opening-note" style={{ marginTop: spaceVar[3], color: themeVars.content.muted, userSelect: 'text' }}>{note}</div>}
53
72
  {error && <div data-testid="blender-model-opening-detail"
54
73
  style={{ marginTop: spaceVar[3], fontFamily: fontMono, fontSize: fontSizeVar.sm, color: themeVars.content.muted, whiteSpace: 'pre-wrap', userSelect: 'text', textAlign: 'left' }}>
55
74
  {error}
56
75
  </div>}
57
76
  </>}
58
- action={error ? <div style={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: spaceVar[3] }}>
77
+ action={error || stalled ? <div style={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: spaceVar[3] }}>
59
78
  {preview && <Button onClick={returnToPreview}>Return to previous model</Button>}
60
79
  <Button variant="secondary" onClick={retry}>Retry opening</Button>
61
80
  </div> : <progress aria-label={`Opening ${path}`} style={{ width: 'min(100%, 18rem)', accentColor: themeVars.accent.default }} />}
@@ -1026,14 +1026,25 @@ function BlenderViewportArea({
1026
1026
  waitForDraw();
1027
1027
  const stopStages = onViewportStages(waitForDraw);
1028
1028
  const onEscape = (event: KeyboardEvent): void => {
1029
- if (event.key === 'Escape' && surfaceAcceptsKey(event)) {
1029
+ if (event.key !== 'Escape' || !surfaceAcceptsKey(event)) return;
1030
+ // Decided once the event has finished dispatching: a play script that claims Escape (a
1031
+ // game's pause, registered after this listener) prevents its default, and the Escape that
1032
+ // frees a game's mouse look is the person taking their mouse back. Both used to stop Play
1033
+ // (three playtests of a Cyclotron game lost a mission each to it).
1034
+ if (globalThis.document.pointerLockElement || performance.now() - lastPointerUnlockAt < 500) return;
1035
+ setTimeout(() => {
1036
+ if (event.defaultPrevented) return;
1030
1037
  const extension = documentPlayExtension('model');
1031
1038
  if (extension?.escape) extension.escape(modelId);
1032
1039
  else extension?.setPlaying(modelId, false);
1033
- }
1040
+ }, 0);
1034
1041
  };
1042
+ let lastPointerUnlockAt = -Infinity;
1043
+ const onLockChange = (): void => { if (!globalThis.document.pointerLockElement) lastPointerUnlockAt = performance.now(); };
1044
+ globalThis.document.addEventListener('pointerlockchange', onLockChange);
1035
1045
  window.addEventListener('keydown', onEscape, true);
1036
1046
  return () => {
1047
+ globalThis.document.removeEventListener('pointerlockchange', onLockChange);
1037
1048
  stopped = true;
1038
1049
  stopStages();
1039
1050
  stopPrepareFrames?.();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@volter/editor-blender",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "AGPL-3.0-only AND GPL-3.0-or-later",
5
- "version": "0.1.146",
5
+ "version": "0.1.148",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -72,15 +72,15 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@modelcontextprotocol/sdk": "1.32.1",
75
- "@volter/blender-engine": "0.1.144",
76
- "@volter/editor-threejs": "0.5.207",
75
+ "@volter/blender-engine": "0.1.146",
76
+ "@volter/editor-threejs": "0.5.209",
77
77
  "zod": "^4.3.6",
78
78
  "@fortawesome/free-solid-svg-icons": "^7.2.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@volter/live": "0.5.207",
82
- "@volter/project": "0.5.207",
83
- "@volter/sdk": "0.5.207",
81
+ "@volter/live": "0.5.209",
82
+ "@volter/project": "0.5.209",
83
+ "@volter/sdk": "0.5.209",
84
84
  "react": "^19.0.0",
85
85
  "react-dom": "^19.0.0",
86
86
  "three": "^0.180.0",