@volter/blender-engine 0.1.20 → 0.1.21
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.
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
PAGE_OWNED_DIRECTORIES,
|
|
38
38
|
SESSION_ROOT,
|
|
39
39
|
SESSION_SCRIPT,
|
|
40
|
+
sessionLevel,
|
|
40
41
|
sleep,
|
|
41
42
|
} from './blender-engine.mts';
|
|
42
43
|
import sessionPython from './session.py?raw';
|
|
@@ -195,10 +196,7 @@ export async function startEmscriptenBlenderEngine(
|
|
|
195
196
|
// session's OWN named conditions go there.
|
|
196
197
|
const say = (_level: 'log' | 'error', text: string) => {
|
|
197
198
|
if (text.startsWith('@@VOLTER-READY ')) readyLine = text.slice('@@VOLTER-READY '.length);
|
|
198
|
-
options.log(
|
|
199
|
-
text.startsWith('@@VOLTER-WARN') || text.startsWith('@@VOLTER-ERROR') ? 'error' : 'log',
|
|
200
|
-
text,
|
|
201
|
-
);
|
|
199
|
+
options.log(sessionLevel(text), text);
|
|
202
200
|
};
|
|
203
201
|
const module = await factory({
|
|
204
202
|
arguments: ['--background', '--factory-startup', '--python', SESSION_SCRIPT],
|
|
@@ -107,7 +107,7 @@ export interface BlenderFiles {
|
|
|
107
107
|
export interface BlenderEngineOptions {
|
|
108
108
|
/** The project's absolute path; the engine's filesystem mirrors it there. */
|
|
109
109
|
project: string;
|
|
110
|
-
log(level: 'log' | 'error', text: string): void;
|
|
110
|
+
log(level: 'log' | 'warn' | 'error', text: string): void;
|
|
111
111
|
/** What the session asks the TAB for, mid-call: a frame, and sometimes a
|
|
112
112
|
* photograph of it. Whatever this resolves to is what Python receives.
|
|
113
113
|
*
|
|
@@ -161,6 +161,14 @@ export interface BlenderEngine {
|
|
|
161
161
|
|
|
162
162
|
export const ARTIFACT_BASE = '/__editor/blender-wasm';
|
|
163
163
|
|
|
164
|
+
/** The console level of one line the session printed. Only the session's own named conditions
|
|
165
|
+
* reach the editor's console, each at the severity it names; Blender's streams stay page output. */
|
|
166
|
+
export function sessionLevel(line: string): 'log' | 'warn' | 'error' {
|
|
167
|
+
if (line.startsWith('@@VOLTER-ERROR')) return 'error';
|
|
168
|
+
if (line.startsWith('@@VOLTER-WARN')) return 'warn';
|
|
169
|
+
return 'log';
|
|
170
|
+
}
|
|
171
|
+
|
|
164
172
|
/**
|
|
165
173
|
* An artifact URL, resolved against THE MODULE — never against `self.location`.
|
|
166
174
|
*
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
PAGE_OWNED_DIRECTORIES,
|
|
53
53
|
SESSION_ROOT,
|
|
54
54
|
SESSION_SCRIPT,
|
|
55
|
+
sessionLevel,
|
|
55
56
|
sleep,
|
|
56
57
|
} from './blender-engine.mts';
|
|
57
58
|
import sessionPython from './session.py?raw';
|
|
@@ -381,10 +382,7 @@ export async function startWaliBlenderEngine(
|
|
|
381
382
|
// -- the same rule as the standalone engine, and for the same measured
|
|
382
383
|
// reason: only the session's own named conditions belong in the set an
|
|
383
384
|
// agent must drive to zero.
|
|
384
|
-
options.log(
|
|
385
|
-
line.startsWith('@@VOLTER-WARN') || line.startsWith('@@VOLTER-ERROR') ? 'error' : 'log',
|
|
386
|
-
line,
|
|
387
|
-
);
|
|
385
|
+
options.log(sessionLevel(line), line);
|
|
388
386
|
}
|
|
389
387
|
};
|
|
390
388
|
// THE PROGRAM DOES NOT RETURN. `session.py` loops forever, so `run` settles
|
package/browser/protocol.ts
CHANGED
|
@@ -109,7 +109,7 @@ export type WorkerReply =
|
|
|
109
109
|
* as the record of what the session submitted — the second side a
|
|
110
110
|
* displayed-versus-submitted comparison otherwise does not have. */
|
|
111
111
|
| { op: 'present'; id: number; frame: unknown; description: unknown; capture?: CaptureRequest }
|
|
112
|
-
| { op: 'log'; level: 'log' | 'error'; text: string }
|
|
112
|
+
| { op: 'log'; level: 'log' | 'warn' | 'error'; text: string }
|
|
113
113
|
/**
|
|
114
114
|
* HOW BIG THE MODULE'S LINEAR MEMORY IS, posted after every call.
|
|
115
115
|
*
|
package/browser/runtime.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface BlenderRuntimeOptions {
|
|
|
44
44
|
description: unknown,
|
|
45
45
|
capture?: CaptureRequest,
|
|
46
46
|
): Promise<PresentAnswer> | PresentAnswer;
|
|
47
|
-
log?(level: 'log' | 'error', text: string): void;
|
|
47
|
+
log?(level: 'log' | 'warn' | 'error', text: string): void;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
package/browser/worker.ts
CHANGED
|
@@ -41,7 +41,7 @@ import type { CaptureRequest, FileEntry, WorkerReply, WorkerRequest } from './pr
|
|
|
41
41
|
import { columnsToTypedArrays, describeFrame } from './session-frame.mts';
|
|
42
42
|
|
|
43
43
|
const post = (reply: WorkerReply) => (self as unknown as Worker).postMessage(reply);
|
|
44
|
-
const log = (level: 'log' | 'error', text: string) => post({ op: 'log', level, text });
|
|
44
|
+
const log = (level: 'log' | 'warn' | 'error', text: string) => post({ op: 'log', level, text });
|
|
45
45
|
|
|
46
46
|
interface Session {
|
|
47
47
|
start(project: string): Promise<unknown>;
|