Use local Python renderer for previews
This commit is contained in:
@@ -2,29 +2,33 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="Render renameable item previews with the Minecraft client.")
|
||||
parser = argparse.ArgumentParser(description="Render renameable item previews from resource pack model JSON.")
|
||||
parser.add_argument("--manifest", default="build/renameable-items.json", help="Path to the generated manifest")
|
||||
parser.add_argument("--pack-root", default="resourcepack", help="Path to the resource pack root")
|
||||
parser.add_argument("--output-dir", default="build", help="Directory where renders should be written")
|
||||
args = parser.parse_args()
|
||||
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
client_renderer = repo_root / "build" / "client-renderer"
|
||||
renderer_script = repo_root / "build" / "scripts" / "render_models.py"
|
||||
|
||||
env = os.environ.copy()
|
||||
env["RENDER_MANIFEST"] = str((repo_root / args.manifest).resolve())
|
||||
env["RENDER_OUTPUT_DIR"] = str((repo_root / args.output_dir).resolve())
|
||||
env["RENDER_PACK_ROOT"] = str((repo_root / args.pack_root).resolve())
|
||||
command = [
|
||||
sys.executable,
|
||||
str(renderer_script),
|
||||
"--manifest",
|
||||
str((repo_root / args.manifest).resolve()),
|
||||
"--pack-root",
|
||||
str((repo_root / args.pack_root).resolve()),
|
||||
"--output-dir",
|
||||
str((repo_root / args.output_dir).resolve()),
|
||||
]
|
||||
|
||||
command = ["gradle", "-p", str(client_renderer), "runClient", "--no-daemon"]
|
||||
|
||||
completed = subprocess.run(command, cwd=repo_root, env=env)
|
||||
completed = subprocess.run(command, cwd=repo_root)
|
||||
|
||||
return completed.returncode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user