fix: automate GLB compression and real viewport smoke
This commit is contained in:
@@ -199,9 +199,12 @@ def wait_for_http(url: str, timeout: float = 20.0) -> None:
|
||||
def run_browser_smoke(pipeline: Pipeline, web_dir: Path, report: Path, screenshots: Path) -> None:
|
||||
"""Serve the formal Web bundle and mechanically prove desktop/mobile loading."""
|
||||
pipeline.run(
|
||||
"browser_dependencies",
|
||||
"node_dependencies",
|
||||
["npm", "install", "--prefix", str(ROOT), "--ignore-scripts"],
|
||||
[ROOT / "node_modules" / "playwright" / "package.json"],
|
||||
[
|
||||
ROOT / "node_modules" / "playwright" / "package.json",
|
||||
ROOT / "node_modules" / "@gltf-transform" / "core" / "package.json",
|
||||
],
|
||||
)
|
||||
pipeline.run(
|
||||
"browser_runtime",
|
||||
@@ -295,6 +298,7 @@ def build_with_trimesh(pipeline: Pipeline, bundle: Path) -> list[Path]:
|
||||
for key in ("overview", "standard", "detail"):
|
||||
spec = bundle / "variant_specs" / f"{key}.json"
|
||||
out_dir = bundle / "variants" / key
|
||||
raw_glb = out_dir / f"{key}.raw.glb"
|
||||
glb = out_dir / f"{key}.glb"
|
||||
metadata = out_dir / "model_metadata.json"
|
||||
pipeline.run(
|
||||
@@ -304,15 +308,20 @@ def build_with_trimesh(pipeline: Pipeline, bundle: Path) -> list[Path]:
|
||||
"--spec",
|
||||
str(spec),
|
||||
"--out",
|
||||
str(glb),
|
||||
str(raw_glb),
|
||||
"--metadata-out",
|
||||
str(metadata),
|
||||
"--name",
|
||||
key,
|
||||
),
|
||||
[glb, metadata],
|
||||
[raw_glb, metadata],
|
||||
forbidden_stderr=("WARNING mesh_from_polygons",),
|
||||
)
|
||||
pipeline.run(
|
||||
f"compress_{key}",
|
||||
["node", str(ROOT / "tools" / "compress.mjs"), str(raw_glb), str(glb)],
|
||||
[glb],
|
||||
)
|
||||
glbs.append(glb)
|
||||
return glbs
|
||||
|
||||
@@ -408,6 +417,14 @@ def run_pipeline(args: argparse.Namespace) -> int:
|
||||
variant_cmd.extend(["--blender", args.blender])
|
||||
pipeline.run("variants", variant_cmd, [manifest, bundle / "variant_specs" / "standard.json"])
|
||||
if args.backend == "trimesh":
|
||||
pipeline.run(
|
||||
"node_dependencies",
|
||||
["npm", "install", "--prefix", str(ROOT), "--ignore-scripts"],
|
||||
[
|
||||
ROOT / "node_modules" / "playwright" / "package.json",
|
||||
ROOT / "node_modules" / "@gltf-transform" / "core" / "package.json",
|
||||
],
|
||||
)
|
||||
glbs = build_with_trimesh(pipeline, bundle)
|
||||
else:
|
||||
glbs = [bundle / "variants" / key / f"{key}.glb" for key in ("overview", "standard", "detail")]
|
||||
|
||||
Reference in New Issue
Block a user