File size: 2,354 Bytes
73a87be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import sys
from pathlib import Path

from pipeline_common import ROOT, load_config, require_dir, require_file, resolve_path, run


def main() -> None:
    parser = argparse.ArgumentParser(description="Validate assets and generate portable Linux manifests.")
    parser.add_argument("--config", type=Path, default=ROOT / "config/linux.json")
    parser.add_argument("--texture-count", type=int, default=5000)
    parser.add_argument("--seed", type=int, default=42)
    parser.add_argument("--disable-hair", action="store_true")
    parser.add_argument("--force", action="store_true")
    args = parser.parse_args()
    config = load_config(args.config.resolve())

    template = resolve_path(config, "template_blend")
    addon = resolve_path(config, "addon_dir")
    skin = resolve_path(config, "skin_dir")
    clothing = resolve_path(config, "clothing_dir")
    hair = None if args.disable_hair else resolve_path(config, "hair_dir")
    asset_manifest = resolve_path(config, "asset_manifest")
    hair_manifest = None if args.disable_hair else resolve_path(config, "hair_manifest")
    require_file(template, "Blender template")
    require_file(addon / "data/smplx_model_lh_20230302.blend", "SMPL-X addon model")
    require_dir(skin, "BEDLAM skin directory")
    require_dir(clothing, "BEDLAM clothing directory")
    if hair is not None:
        require_dir(hair, "Hair directory")

    for key in ("cache_root", "render_root", "annotation_root", "debug_root", "log_root"):
        resolve_path(config, key).mkdir(parents=True, exist_ok=True)

    python = sys.executable
    if args.force or not asset_manifest.exists():
        run([
            python, str(ROOT / "scripts/create_bedlam_layered_manifest.py"),
            "--skin-dir", str(skin), "--overlay-dir", str(clothing),
            "--out", str(asset_manifest), "--num", str(args.texture_count), "--seed", str(args.seed),
        ], "asset-manifest")
    if hair_manifest is not None and hair is not None and (args.force or not hair_manifest.exists()):
        run([
            python, str(ROOT / "scripts/create_hair_manifest.py"),
            "--hair-dir", str(hair), "--out", str(hair_manifest),
        ], "hair-manifest")
    print(f"[OK] Bundle prepared at {ROOT}")


if __name__ == "__main__":
    main()