Replace TownSquare with HomeCamp art and land humanoid bots, LittleBear, and LmGirl review assets.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
"""Copy HomeCamp v2 prop design images into Doc, audit white corners and add them to the scene manifest."""
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = Path.home() / ".cursor/projects/d-UD-AI-AIGame/assets"
|
||||
DESIGN = ROOT / "Doc/Design/Scene/HomeCamp"
|
||||
MANIFEST = DESIGN / "homecamp_scene_manifest.json"
|
||||
|
||||
# id: (tier, targetTriangles, real size in meters [width, height, depth])
|
||||
PROPS = {
|
||||
"fence": ("B", 1000, [3.0, 0.9, 0.25]),
|
||||
"stall": ("B", 2500, [2.2, 2.4, 1.3]),
|
||||
"flowerpots": ("C", 800, [1.2, 0.9, 0.9]),
|
||||
"rocks": ("C", 600, [1.6, 0.9, 1.2]),
|
||||
"steps": ("B", 1200, [2.5, 1.0, 2.0]),
|
||||
"cypress": ("B", 1500, [1.3, 5.0, 1.3]),
|
||||
"bush": ("C", 800, [1.2, 0.9, 1.2]),
|
||||
}
|
||||
|
||||
|
||||
def sha(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def main():
|
||||
manifest = json.loads(MANIFEST.read_text(encoding="utf-8"))
|
||||
components = {c["id"]: c for c in manifest["components"]}
|
||||
audits = {a["id"]: a for a in manifest["designImageAudit"]}
|
||||
for pid, (tier, target, size) in PROPS.items():
|
||||
out = DESIGN / f"{pid}.png"
|
||||
img = Image.open(SRC / f"{pid}.jpg").convert("RGB")
|
||||
img.save(out)
|
||||
w, h = img.size
|
||||
corners = [list(img.getpixel(p)) for p in [(2, 2), (w - 3, 2), (2, h - 3), (w - 3, h - 3)]]
|
||||
audits[pid] = {
|
||||
"id": pid, "path": out.relative_to(ROOT).as_posix(), "width": w, "height": h,
|
||||
"sha256": sha(out), "corners": corners, "imageDecodes": True,
|
||||
"whiteCornersPass": all(min(c) >= 245 for c in corners),
|
||||
}
|
||||
comp = components.get(pid, {"id": pid})
|
||||
comp.update({
|
||||
"designImage": out.relative_to(ROOT).as_posix(), "tier": tier, "targetTriangles": target,
|
||||
"realSizeMeters": size, "highpoly": f"Tools/output/homecamp_3d/{pid}/{pid}.glb",
|
||||
"modelStatus": comp.get("modelStatus", "design_ready"),
|
||||
})
|
||||
components[pid] = comp
|
||||
manifest["components"] = list(components.values())
|
||||
manifest["designImageAudit"] = list(audits.values())
|
||||
MANIFEST.write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
for pid in PROPS:
|
||||
a = audits[pid]
|
||||
print(pid, a["width"], a["height"], a["whiteCornersPass"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user