This commit is contained in:
zcr
2026-03-17 11:29:47 +08:00
parent a6d9bac6d0
commit 06659057c3
26 changed files with 3742 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import argparse
import os
import subprocess
def render_glb_preview(glb_path, output_path):
os.makedirs(os.path.dirname(output_path), exist_ok=True)
cmd = [
"blender",
"--background",
"--python",
"render_model.py",
"--",
glb_path,
output_path
]
result = subprocess.run(cmd, capture_output=True, text=True)
print(result)
if result.returncode != 0:
raise RuntimeError(
f"Blender render failed\nstdout:\n{result.stdout}\nstderr:\n{result.stderr}"
)
return output_path
if __name__ == '__main__':
x = render_glb_preview(glb_path='glb_output/sample_20260316_113848_a956a189.glb',
output_path='glb_output/static_model_image_20260316_113856_57ad56d2.png')
print(x)