Mercurial > games > semicongine
comparison tools/blender_gltf_converter.py @ 1039:ea9270ed03ea
and even more cleanup of the repo
author | sam <sam@basx.dev> |
---|---|
date | Sat, 23 Mar 2024 22:57:11 +0700 |
parents | scripts/blender_gltf_converter.py@1727bec9ca2f |
children | 34ae5835bfa8 |
comparison
equal
deleted
inserted
replaced
1038:e267983f5edf | 1039:ea9270ed03ea |
---|---|
1 import os | |
2 import sys | |
3 | |
4 import bpy | |
5 | |
6 | |
7 def runner(): | |
8 script_args = sys.argv[sys.argv.index("--") + 1 :] | |
9 for i in range(0, len(script_args), 2): | |
10 inputfile = script_args[i] | |
11 outputfile = script_args[i + 1] | |
12 if not os.path.exists(inputfile): | |
13 print(f"Input file '{inputfile}' does not exists") | |
14 quit(1) | |
15 if not outputfile.endswith(".glb"): | |
16 print(f"Output file '{outputfile}' is not a *.glb file") | |
17 quit(1) | |
18 | |
19 bpy.ops.wm.open_mainfile(filepath=inputfile) | |
20 bpy.ops.export_scene.gltf(filepath=outputfile[:-4], export_apply=True) | |
21 | |
22 | |
23 if __name__ == "__main__": | |
24 runner() |