@volter/editor-blender 0.1.5 → 0.1.6
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/host/blender-runtime-host.ts +27 -8
- package/package.json +5 -5
|
@@ -650,13 +650,24 @@ let captureLifetime: AbortController | null = null;
|
|
|
650
650
|
* terminate, and the host door only exists inside a running editor. */
|
|
651
651
|
let watchingSessionEnd = false;
|
|
652
652
|
|
|
653
|
+
/** Diagnostics must not prevent teardown if the host has already detached. */
|
|
654
|
+
function beginBlenderWork(label: string): () => void {
|
|
655
|
+
try {
|
|
656
|
+
const end = editorHost().session.beginWork(`Blender: ${label}`);
|
|
657
|
+
return () => { try { end(); } catch { /* preserve the operation's result */ } };
|
|
658
|
+
} catch { return () => {}; }
|
|
659
|
+
}
|
|
660
|
+
|
|
653
661
|
function terminateBlenderRuntime(): void {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
662
|
+
const end = beginBlenderWork('invalidating history and releasing runtime');
|
|
663
|
+
try {
|
|
664
|
+
invalidateBlenderHistory();
|
|
665
|
+
captureLifetime?.abort();
|
|
666
|
+
captureLifetime = null;
|
|
667
|
+
runtime?.terminate();
|
|
668
|
+
runtime = null;
|
|
669
|
+
lastCapture = null;
|
|
670
|
+
} finally { end(); }
|
|
660
671
|
}
|
|
661
672
|
|
|
662
673
|
// THE ENGINE DIES WITH THE SESSION, whether or not the tab can. A page told
|
|
@@ -707,6 +718,7 @@ export function blenderRuntime(): BlenderRuntime {
|
|
|
707
718
|
captureLifetime = lifetime;
|
|
708
719
|
let photographing = false;
|
|
709
720
|
runtime = new BlenderRuntime({
|
|
721
|
+
work: beginBlenderWork,
|
|
710
722
|
history: (entries) => {
|
|
711
723
|
const owner = runtime;
|
|
712
724
|
if (!owner) throw new Error('Blender history arrived before its runtime');
|
|
@@ -736,7 +748,9 @@ export function blenderRuntime(): BlenderRuntime {
|
|
|
736
748
|
},
|
|
737
749
|
present: async (frame, description, capture) => {
|
|
738
750
|
const documentId = presentationDocumentId();
|
|
739
|
-
const
|
|
751
|
+
const endWait = beginBlenderWork('waiting for Model presenter');
|
|
752
|
+
let view: RuntimeView;
|
|
753
|
+
try { view = await runtimeView(); } finally { endWait(); }
|
|
740
754
|
lifetime.signal.throwIfAborted();
|
|
741
755
|
if (presentationDocumentId() !== documentId)
|
|
742
756
|
throw new Error('Blender document changed before its frame could be presented');
|
|
@@ -747,7 +761,11 @@ export function blenderRuntime(): BlenderRuntime {
|
|
|
747
761
|
// still-running worker (`blender-runtime-view.ts::applyFrame` says how).
|
|
748
762
|
// A document that answers `applyFrame` without one reports no `held` at
|
|
749
763
|
// all, rather than a wrong `null`.
|
|
750
|
-
const
|
|
764
|
+
const endApply = beginBlenderWork('applying frame to Model');
|
|
765
|
+
const applied = (() => {
|
|
766
|
+
try { return view.applyFrame(frame) as { held?: unknown } | null | undefined; }
|
|
767
|
+
finally { endApply(); }
|
|
768
|
+
})();
|
|
751
769
|
const reports = typeof applied === 'object' && applied !== null && 'held' in applied;
|
|
752
770
|
const held = reports ? (applied.held as { session: string; revision: number } | null) : null;
|
|
753
771
|
const answer = (capture: unknown): PresentAnswer => ({
|
|
@@ -893,6 +911,7 @@ export function blenderRuntime(): BlenderRuntime {
|
|
|
893
911
|
await snapshot.prepare(renderCamera);
|
|
894
912
|
assertBinding();
|
|
895
913
|
const captureOptions = {
|
|
914
|
+
effect: snapshot.effect,
|
|
896
915
|
width: render.width,
|
|
897
916
|
height: render.height,
|
|
898
917
|
transparent: render.transparent === true,
|
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.
|
|
5
|
+
"version": "0.1.6",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@volter/blender-engine": "0.1.
|
|
65
|
-
"@volter/editor-threejs": "0.5.
|
|
64
|
+
"@volter/blender-engine": "0.1.6",
|
|
65
|
+
"@volter/editor-threejs": "0.5.63",
|
|
66
66
|
"zod": "^4.3.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@volter/editor-sdk": "
|
|
70
|
-
"@volter/editor-project": "
|
|
69
|
+
"@volter/editor-sdk": "0.5.63",
|
|
70
|
+
"@volter/editor-project": "0.5.63",
|
|
71
71
|
"react": "^19.0.0",
|
|
72
72
|
"three": "^0.180.0"
|
|
73
73
|
},
|