为相机网格笔画增加双视图导出
沿用彩色纹理的视图归属、接缝留白和自动页面尺寸。 已验证双视图与单视图 Blender 导出、相关测试及文档门禁。
This commit is contained in:
@@ -59,7 +59,33 @@ def test_exports_from_geometry_job(tmp_path, monkeypatch):
|
||||
assert len(calls) == 1
|
||||
|
||||
|
||||
def test_rejects_multiview(tmp_path, monkeypatch):
|
||||
job = _job(tmp_path)
|
||||
monkeypatch.setattr(cli, "_run_blender_script", lambda *_: 99)
|
||||
assert cli.cmd_stroke_texture(REVISION, _args(job, tmp_path / "out", views=True)) == 2
|
||||
def test_multiview_exports_owned_pairs_without_colour_artwork(tmp_path, monkeypatch):
|
||||
paths = RevisionPaths.from_revision_dir(REVISION)
|
||||
job = tmp_path / "_texture_views_job.json"
|
||||
job.write_text(json.dumps({
|
||||
"schema": "orisys-sensor-design/texture-job-multiview-v1",
|
||||
"revision_dir": str(paths.root), "source_blend": str(paths.source_blend),
|
||||
"settings": {"nx": 80, "ny": 80}, "objects": {"mesh": "sensing_surface"},
|
||||
"pairs": [{"id": "uv_1"}, {"id": "uv_2"}],
|
||||
}), encoding="utf-8")
|
||||
output_dir = tmp_path / "strokes"
|
||||
calls = []
|
||||
|
||||
def run_blender(script, blend, args):
|
||||
calls.append((script, blend, args))
|
||||
for pair in ("uv_1", "uv_2"):
|
||||
for fmt in ("png", "svg", "pdf"):
|
||||
(output_dir / f"stroke_texture_{pair}.{fmt}").write_bytes(pair.encode())
|
||||
for name in ("_multiview_ground_truth.json", "_print_views.json"):
|
||||
(output_dir / name).write_text("{}", encoding="utf-8")
|
||||
return 0
|
||||
|
||||
monkeypatch.setattr(cli, "_run_blender_script", run_blender)
|
||||
assert cli.cmd_stroke_texture(REVISION, _args(job, output_dir, views=True)) == 0
|
||||
assert calls[0][0] == "random_patch_multiview.py"
|
||||
assert "--stroke-params" in calls[0][2]
|
||||
manifest = json.loads((output_dir / "stroke_texture_manifest.json").read_text())
|
||||
assert manifest["views"] is True
|
||||
assert [entry["id"] for entry in manifest["outputs"]] == ["uv_1", "uv_2"]
|
||||
assert set(manifest["auxiliary"]) == {"_multiview_ground_truth.json", "_print_views.json"}
|
||||
assert len(calls) == 1
|
||||
|
||||
Reference in New Issue
Block a user