Land Explorer in HomeCamp with boot loading, journal UI, and CDN publish tooling.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
from pathlib import Path
|
||||
import requests
|
||||
|
||||
BASE = "http://127.0.0.1:8008"
|
||||
OUTPUT_DIR = Path("Tools/output/explorer_3d")
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
def wait_job(url_path, timeout=3600, interval=3):
|
||||
deadline = time.monotonic() + timeout
|
||||
while time.monotonic() < deadline:
|
||||
r = session.get(f"{BASE}{url_path}", timeout=30)
|
||||
r.raise_for_status()
|
||||
job = r.json()
|
||||
status = job.get("status")
|
||||
stage = job.get("stage", "")
|
||||
progress = job.get("progress", 0)
|
||||
print(f"[{status}] stage={stage} progress={progress}%", flush=True)
|
||||
if status in ("completed", "failed"):
|
||||
if status != "completed" or job.get("error"):
|
||||
raise RuntimeError(f"Job failed: {job.get('error') or job}")
|
||||
return job
|
||||
time.sleep(interval)
|
||||
raise TimeoutError(f"Job timeout: {url_path}")
|
||||
|
||||
# Step 0: Check status and generate reference image
|
||||
print("Step 0: Generating Character Concept Image...")
|
||||
prompt = (
|
||||
"chibi 3D game character boy adventurer, young cute explorer, 3.5 heads tall cartoon proportions, "
|
||||
"wearing brown explorer hat with goggles, beige short-sleeve adventurer jacket, cargo shorts, hiking boots, "
|
||||
"small utility pouch on leather belt, standard A-pose with arms angled down 40 degrees, "
|
||||
"legs straight and slightly apart, facing front directly, clean pure white background, full body, isolated, high quality 3D model turnaround"
|
||||
)
|
||||
|
||||
img_batch = session.post(f"{BASE}/api/local-images/jobs", data={
|
||||
"model": "turbo",
|
||||
"profile": "concept",
|
||||
"prompt": prompt,
|
||||
"width": 1024,
|
||||
"height": 1024,
|
||||
"count": 1,
|
||||
"seed": 20261104
|
||||
}, timeout=60).json()
|
||||
|
||||
img_job_id = img_batch["id"]
|
||||
print("Image Batch ID:", img_job_id)
|
||||
|
||||
img_res = wait_job(f"/api/local-images/jobs/{img_job_id}", timeout=300)
|
||||
img_url = img_res["images"][0]["url"]
|
||||
ref_path = OUTPUT_DIR / "explorer_ref.png"
|
||||
img_bytes = session.get(f"{BASE}{img_url}").content
|
||||
ref_path.write_bytes(img_bytes)
|
||||
print(f"Downloaded reference image: {ref_path} ({len(img_bytes)} bytes)")
|
||||
|
||||
# Prepare 3D
|
||||
session.post(f"{BASE}/api/local-images/prepare-3d", timeout=120)
|
||||
print("3D environment prepared.")
|
||||
|
||||
Reference in New Issue
Block a user