Files
workinf_Blender_Wasm/tools/web/inspect-image.mjs
mes123456 63db6caf1f
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
Environment lighting:
- ship all eight desktop studiolights/world datasets (WBENV1 float32) and a
  shared loader used by both the main viewport and the offscreen worker
- add the N-panel "studio 环境" selector
- rotate the world background together with the environment
  (backgroundRotation/backgroundIntensity), so camera view and offscreen
  renders match the desktop Mapping-node behaviour

Verification (Chromium, OPFS, NOT_CLAIMED):
- environment lighting + 8 world pixel identity
- camera-view rotation correspondence (camera matrices, 207 samples)
- offscreen vs on-screen background parity after hiding geometry (1305 samples)
- metals case extended with material-field OPFS roundtrip
- material Principled edits and rename undo/redo
- eight studio worlds: pairwise frame differences + luminance rank correlation
- undo history depth capped at 64 steps and undo across OPFS save/reopen

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 09:27:47 +08:00

61 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
/**
* Audit image evidence: does each file actually contain a picture?
*
* node tools/web/inspect-image.mjs <file|dir> [...] [--json] [--allow-blank]
*
* node tools/web/inspect-image.mjs web/app/public/tutorial/render-basics/evidence
* node tools/web/inspect-image.mjs /tmp/frames --json
*
* Prints width/height, alpha coverage, brightest channel and a verdict for each
* PNG; JPEGs report dimensions only. Exits 2 when a blank frame is found, which
* makes it usable as a gate in a capture pipeline.
*
* Why this exists: a render can report SUCCEEDED, write ~220 KB, and still be an
* all-transparent frame. File size proves nothing; the pixels do.
*/
import {collectImages, imageStats} from "./lib/image-stats.mjs";
const argv = process.argv.slice(2);
const json = argv.includes("--json");
const allowBlank = argv.includes("--allow-blank");
const inputs = argv.filter((item) => !item.startsWith("--"));
if (!inputs.length) {
console.error("usage: node tools/web/inspect-image.mjs <file|dir> [...] [--json] [--allow-blank]");
process.exit(1);
}
const results = collectImages(inputs).map((file) => {
try { return imageStats(file); }
catch (error) { return {path: file, verdict: "error", error: String(error?.message ?? error)}; }
});
if (json) {
console.log(JSON.stringify(results, null, 2));
}
else {
const rows = results.map((stats) => ({
file: stats.path.replace(`${process.cwd()}/`, ""),
size: stats.width ? `${stats.width}×${stats.height}` : "—",
bytes: stats.bytes ? `${Math.round(stats.bytes / 1024)} KiB` : "—",
alpha: stats.maxAlpha === null || stats.maxAlpha === undefined ? "—" : String(stats.maxAlpha),
opaque: stats.opaqueRatio === null || stats.opaqueRatio === undefined ? "—" : `${(stats.opaqueRatio * 100).toFixed(1)}%`,
rgb: stats.maxRgb === null || stats.maxRgb === undefined ? "—" : String(stats.maxRgb),
verdict: stats.verdict,
}));
const width = (key) => Math.max(4, ...rows.map((row) => String(row[key]).length));
const widths = {file: width("file"), size: width("size"), bytes: width("bytes"), alpha: width("alpha"), opaque: width("opaque"), rgb: width("rgb"), verdict: width("verdict")};
const line = (row, keys) => keys.map((key) => String(row[key]).padEnd(widths[key])).join(" ");
const keys = ["file", "size", "bytes", "alpha", "opaque", "rgb", "verdict"];
console.log(line({file: "file", size: "size", bytes: "bytes", alpha: "alpha", opaque: "opaque", rgb: "maxRGB", verdict: "verdict"}, keys));
console.log(keys.map((key) => "-".repeat(widths[key])).join(" "));
for (const row of rows) console.log(line(row, keys));
}
const blank = results.filter((stats) => stats.verdict === "transparent" || stats.verdict === "noise-only" || stats.verdict === "error");
if (blank.length) {
console.error(`\n${blank.length} image(s) contain no picture: ${blank.map((stats) => stats.path).join(", ")}`);
if (!allowBlank) process.exit(2);
}
else console.error(`\n${results.length} image(s) checked, all contain a picture.`);