[211] Rendering: Fortschritt auch im Format von Blender 3.x/4.x („Rendering n / m samples“), letzte Blender-Zeile im Dialog (z. B. erstmaliges Übersetzen der Metal-Kernel)

This commit is contained in:
Claude committed 2026-11-12 22:30:43 +00:00
1 parent 35c26f9e85
commit e37286b668
3 files changed
+16 -1

No files matched your search

+2
View File
@@ -125,6 +125,8 @@ describe("Paket", () => {
describe("Blender-Ausgabe", () => {
it("liest Cycles-Fortschritt und die Marken des Skripts", () => {
expect(parseBlenderLine("Fra:1 Mem:34.12M (Peak 40M) | Time:00:02.10 | Remaining:00:10.5 | Mem:2M | Scene, ViewLayer | Sample 16/128")).toEqual({ kind: "sample", done: 16, total: 128 });
// Blender 4.x (macOS): andere Fortschrittszeile
expect(parseBlenderLine("Fra:1 Mem:120.4M (Peak 300M) | Time:00:03.21 | Remaining:00:09.12 | Mem:80M, Peak:90M | Scene, ViewLayer | Rendering 5 / 32 samples")).toEqual({ kind: "sample", done: 5, total: 32 });
expect(parseBlenderLine("DOSSIER_STAGE render")).toEqual({ kind: "stage", stage: "render" });
expect(parseBlenderLine("DOSSIER_DONE /tmp/x/render.png")).toEqual({ kind: "done", path: "/tmp/x/render.png" });
expect(parseBlenderLine("DOSSIER_ERROR kaputt")).toEqual({ kind: "error", message: "kaputt" });
+2 -1
View File
@@ -455,7 +455,8 @@ export type BlenderEvent =
/** Eine Ausgabezeile von Blender: Cycles meldet `… | Sample 16/128`, das Skript die `DOSSIER_*`-Marken. */
export function parseBlenderLine(line: string): BlenderEvent | null {
const s = /\bSample\s+(\d+)\s*\/\s*(\d+)/.exec(line);
// Cycles je nach Version: `| Sample 16/128` (5.x) bzw. `| Rendering 16 / 128 samples` (3.x/4.x, auch macOS).
const s = /\bSample\s+(\d+)\s*\/\s*(\d+)/.exec(line) ?? /\bRendering\s+(\d+)\s*\/\s*(\d+)\s+samples\b/i.exec(line);
if (s) return { kind: "sample", done: Number(s[1]), total: Number(s[2]) };
const m = /^DOSSIER_(STAGE|DONE|ERROR|NOTE)\s+(.*)$/.exec(line.trim());
if (!m) return null;
+12
View File
@@ -57,6 +57,8 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
const [cameraKey, setCameraKey] = useState("live");
const [cameras, setCameras] = useState<RenderCameraChoice[]>([]);
const [blenderPath, setPath] = useState("");
// Letzte Ausgabezeile von Blender (zeigt z. B. das erstmalige Übersetzen der Metal-Kernel, das Minuten dauern kann).
const [lastLine, setLastLine] = useState("");
const [host, setHost] = useState<BlenderHost | null | undefined>(undefined);
const [phase, setPhase] = useState<Phase>("setup");
const [status, setStatus] = useState("");
@@ -157,8 +159,13 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
if (pkg.missingTextures.length > 0) st.notify(t("render.missingTextures", { n: pkg.missingTextures.length }), "warning");
if (!host) throw new Error("kein Gastgeber");
setPhase("running");
setLastLine("");
const res = await renderWithBlender(host, pkg, {
signal: ac.signal,
onLine: (l) => {
const v = l.trim();
if (v) setLastLine(v.length > 160 ? `${v.slice(0, 157)}…` : v);
},
onProgress: (e) => {
setFraction(e.fraction);
setStatus(
@@ -323,6 +330,11 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
<section className="imp-section" data-testid="render-progress">
<progress max={1} value={phase === "running" ? fraction : undefined} style={{ width: "100%" }} />
<div className="imp-note">{status}</div>
{lastLine && (
<div className="imp-note" data-testid="render-last-line" style={{ fontFamily: "ui-monospace, monospace", fontSize: 11, opacity: 0.7, overflowWrap: "anywhere" }}>
{lastLine}
</div>
)}
</section>
)}