@volter/editor-blender 0.1.3 → 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 +23 -5
- package/package.json +3 -3
|
@@ -1050,6 +1050,7 @@ export async function handleBlenderCommand(cmd: {
|
|
|
1050
1050
|
};
|
|
1051
1051
|
try {
|
|
1052
1052
|
const project = cmd.type === 'blender-start' ? string(cmd, 'project') : null;
|
|
1053
|
+
let requestedDocument = typeof cmd['document'] === 'string' ? cmd['document'] : undefined;
|
|
1053
1054
|
if (cmd.type === 'blender-stop' || (cmd.type === 'blender-start' && cmd['fresh'] === true)) {
|
|
1054
1055
|
// Do not invalidate history or discard the worker if persistence fails.
|
|
1055
1056
|
await runtime?.stop();
|
|
@@ -1064,13 +1065,30 @@ export async function handleBlenderCommand(cmd: {
|
|
|
1064
1065
|
// build's answer that nothing here opens that address; the Model
|
|
1065
1066
|
// document is this package's own contribution, so it is a build without
|
|
1066
1067
|
// `@volter/editor-blender` rather than a broken call.
|
|
1067
|
-
|
|
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 });
|
|
1068
1086
|
if (!opened)
|
|
1069
1087
|
return {
|
|
1070
1088
|
ok: false,
|
|
1071
1089
|
error:
|
|
1072
|
-
|
|
1073
|
-
|
|
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).',
|
|
1074
1092
|
};
|
|
1075
1093
|
}
|
|
1076
1094
|
const session = blenderRuntime();
|
|
@@ -1081,8 +1099,8 @@ export async function handleBlenderCommand(cmd: {
|
|
|
1081
1099
|
// `blender-start` that named none is asking for the session this tab
|
|
1082
1100
|
// is showing, not for a second file beside it.
|
|
1083
1101
|
const document =
|
|
1084
|
-
|
|
1085
|
-
?
|
|
1102
|
+
requestedDocument !== undefined
|
|
1103
|
+
? requestedDocument
|
|
1086
1104
|
: (boundModel?.blend ?? DEFAULT_BLENDER_DOCUMENT);
|
|
1087
1105
|
return { ok: true, data: { ...(await session.start(project!, document)) } };
|
|
1088
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": {
|