@volter/editor-blender 0.1.2 → 0.1.4
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 +28 -5
- package/package.json +3 -3
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
import { fitClipPlanes } from '@volter/editor-threejs/viewport/clip-planes';
|
|
61
61
|
import { contentWorldBounds } from '@volter/editor-threejs/viewport/content-bounds';
|
|
62
62
|
import * as THREE from 'three';
|
|
63
|
+
import { blenderEngineSelection, refreshBlenderOutliner } from '../contributions/blender-outliner-model';
|
|
63
64
|
import {
|
|
64
65
|
type NodeViewState,
|
|
65
66
|
nodeViewState,
|
|
@@ -720,6 +721,10 @@ export function blenderRuntime(): BlenderRuntime {
|
|
|
720
721
|
if (runtime !== owner) throw new Error('This Blender history belongs to a closed worker');
|
|
721
722
|
const moved = await owner.historyStep(entry.id, direction);
|
|
722
723
|
noteBlenderRnaChanged();
|
|
724
|
+
// The restored frame arrives before the Outliner's scheduled read.
|
|
725
|
+
// A following structural edit resolves its targets through that index:
|
|
726
|
+
// redo-duplicate -> delete must not see the tree from before redo.
|
|
727
|
+
await refreshBlenderOutliner(blenderEngineSelection().selected);
|
|
723
728
|
return moved;
|
|
724
729
|
};
|
|
725
730
|
editorHost().history.record({
|
|
@@ -1045,6 +1050,7 @@ export async function handleBlenderCommand(cmd: {
|
|
|
1045
1050
|
};
|
|
1046
1051
|
try {
|
|
1047
1052
|
const project = cmd.type === 'blender-start' ? string(cmd, 'project') : null;
|
|
1053
|
+
let requestedDocument = typeof cmd['document'] === 'string' ? cmd['document'] : undefined;
|
|
1048
1054
|
if (cmd.type === 'blender-stop' || (cmd.type === 'blender-start' && cmd['fresh'] === true)) {
|
|
1049
1055
|
// Do not invalidate history or discard the worker if persistence fails.
|
|
1050
1056
|
await runtime?.stop();
|
|
@@ -1059,13 +1065,30 @@ export async function handleBlenderCommand(cmd: {
|
|
|
1059
1065
|
// build's answer that nothing here opens that address; the Model
|
|
1060
1066
|
// document is this package's own contribution, so it is a build without
|
|
1061
1067
|
// `@volter/editor-blender` rather than a broken call.
|
|
1062
|
-
|
|
1068
|
+
// During startup the Model may not have mounted/bound yet. Resolve the
|
|
1069
|
+
// real declared table, including custom entry ids. A generic fallback
|
|
1070
|
+
// exists only in projects that have no file-backed Model of their own.
|
|
1071
|
+
const table = await host.project.documentTable();
|
|
1072
|
+
const models = table.entries.filter(entry => entry.kind === 'model');
|
|
1073
|
+
const entry = requestedDocument !== undefined
|
|
1074
|
+
? models.find(candidate => candidate.source?.path === requestedDocument)
|
|
1075
|
+
: models.find(candidate => candidate.id === (boundModel?.entryId ?? table.default))
|
|
1076
|
+
?? (models.length === 1 ? models[0] : undefined);
|
|
1077
|
+
if (!entry) return {
|
|
1078
|
+
ok: false,
|
|
1079
|
+
error: requestedDocument !== undefined
|
|
1080
|
+
? `No declared Model document names ${requestedDocument}.`
|
|
1081
|
+
: `Choose a Model document before starting Blender. Available: ${models.map(model => model.id).join(', ') || '(none)'}.`,
|
|
1082
|
+
};
|
|
1083
|
+
const entryId = entry.id;
|
|
1084
|
+
requestedDocument = entry.source?.path;
|
|
1085
|
+
const opened = await host.workspace.open({ kind: 'document', id: entryId });
|
|
1063
1086
|
if (!opened)
|
|
1064
1087
|
return {
|
|
1065
1088
|
ok: false,
|
|
1066
1089
|
error:
|
|
1067
|
-
|
|
1068
|
-
|
|
1090
|
+
`blender-start could not open the Blender Model document ${entryId}: nothing in this editor ` +
|
|
1091
|
+
'opens that document (the Model document ships with @volter/editor-blender).',
|
|
1069
1092
|
};
|
|
1070
1093
|
}
|
|
1071
1094
|
const session = blenderRuntime();
|
|
@@ -1076,8 +1099,8 @@ export async function handleBlenderCommand(cmd: {
|
|
|
1076
1099
|
// `blender-start` that named none is asking for the session this tab
|
|
1077
1100
|
// is showing, not for a second file beside it.
|
|
1078
1101
|
const document =
|
|
1079
|
-
|
|
1080
|
-
?
|
|
1102
|
+
requestedDocument !== undefined
|
|
1103
|
+
? requestedDocument
|
|
1081
1104
|
: (boundModel?.blend ?? DEFAULT_BLENDER_DOCUMENT);
|
|
1082
1105
|
return { ok: true, data: { ...(await session.start(project!, document)) } };
|
|
1083
1106
|
}
|
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.4",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -61,8 +61,8 @@
|
|
|
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.4",
|
|
65
|
+
"@volter/editor-threejs": "0.5.61",
|
|
66
66
|
"zod": "^4.3.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|