H2SMV-FPV / generator /scripts /setup_bundle.py
mage0001's picture
Add portable H2SMV-FPV generator and third-party asset policy
73a87be verified
Raw History Blame Contribute Delete
2.35 kB
#!/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()