(args)
| 270 | |
| 271 | |
| 272 | def cmd_glb(args): |
| 273 | image_path = Path(args.image) |
| 274 | if not image_path.exists(): |
| 275 | result_json(False, error=f"Image not found: {image_path}") |
| 276 | sys.exit(1) |
| 277 | |
| 278 | preset = _resolve_preset(args.quality) |
| 279 | |
| 280 | face_limit = args.face_limit if args.quality == "default" else preset["face_limit"] |
| 281 | |
| 282 | output = Path(args.output) |
| 283 | output.parent.mkdir(parents=True, exist_ok=True) |
| 284 | |
| 285 | print(f"Generating GLB (quality={args.quality}, pbr={args.pbr}, face_limit={face_limit})...", file=sys.stderr) |
| 286 | |
| 287 | sidecar = { |
| 288 | "kind": "mesh", |
| 289 | "preset": args.quality, |
| 290 | "pbr": args.pbr, |
| 291 | "status": "pending", |
| 292 | } |
| 293 | try: |
| 294 | task_id = create_image_to_model_task( |
| 295 | image_path, |
| 296 | face_limit=face_limit, |
| 297 | pbr=args.pbr, |
| 298 | geometry_quality=preset["geometry_quality"], |
| 299 | texture_quality=preset["texture_quality"], |
| 300 | ) |
| 301 | print(f" image_to_model: {task_id}", file=sys.stderr) |
| 302 | sidecar["image_to_model_task_id"] = task_id |
| 303 | _write_sidecar(output, sidecar) |
| 304 | |
| 305 | result = poll_task(task_id) |
| 306 | download_model(result, output) |
| 307 | except TimeoutError as e: |
| 308 | result_json(False, error=f"{e}. {_resume_hint(output)}", cost_cents=preset["cost_cents"]) |
| 309 | sys.exit(1) |
| 310 | except Exception as e: |
| 311 | result_json(False, error=str(e)) |
| 312 | sys.exit(1) |
| 313 | |
| 314 | sidecar["status"] = "complete" |
| 315 | _write_sidecar(output, sidecar) |
| 316 | print(f"Saved: {output}", file=sys.stderr) |
| 317 | result_json(True, path=str(output), cost_cents=preset["cost_cents"]) |
| 318 | |
| 319 | |
| 320 | def cmd_rig(args): |
nothing calls this directly
no test coverage detected