389
|
1 import os
|
|
2 import sys
|
|
3
|
|
4 import bpy
|
|
5
|
|
6
|
|
7 def runner():
|
|
8 script_args = sys.argv[sys.argv.index("--") + 1 :]
|
390
|
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)
|
389
|
18
|
390
|
19 bpy.ops.wm.open_mainfile(filepath=inputfile)
|
1342
|
20 bpy.ops.export_scene.gltf(
|
|
21 filepath=outputfile[:-4],
|
|
22 export_apply=True,
|
|
23 export_yup=True,
|
|
24 check_existing=False,
|
|
25 export_image_format="AUTO",
|
|
26 export_format="GLB",
|
|
27 export_materials="EXPORT",
|
|
28 )
|
389
|
29
|
|
30
|
|
31 if __name__ == "__main__":
|
|
32 runner()
|