389
|
1 import os
|
|
2 import sys
|
|
3
|
|
4 import bpy
|
|
5
|
|
6
|
|
7 def runner():
|
|
8 argv = sys.argv
|
|
9 print(sys.argv)
|
|
10 script_args = sys.argv[sys.argv.index("--") + 1 :]
|
|
11 inputfile = script_args[0]
|
|
12 outputfile = script_args[1]
|
|
13 if not os.path.exists(inputfile):
|
|
14 print(f"Input file '{inputfile}' does not exists")
|
|
15 quit(1)
|
|
16 if not outputfile.endswith(".glb"):
|
|
17 print(f"Output file '{outputfile}' is not a *.glb file")
|
|
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()
|