| 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) | 
|  | 20         bpy.ops.export_scene.gltf(filepath=outputfile[:-4], export_apply=True) | 
| 389 | 21 | 
|  | 22 | 
|  | 23 if __name__ == "__main__": | 
|  | 24     runner() |