diff scripts/blender_gltf_converter.py @ 390:1727bec9ca2f

did: finish importing system
author Sam <sam@basx.dev>
date Wed, 06 Dec 2023 00:05:55 +0700
parents ae8a6c6ff468
children
line wrap: on
line diff
--- a/scripts/blender_gltf_converter.py	Tue Dec 05 22:46:32 2023 +0700
+++ b/scripts/blender_gltf_converter.py	Wed Dec 06 00:05:55 2023 +0700
@@ -5,19 +5,19 @@
 
 
 def runner():
-    argv = sys.argv
-    print(sys.argv)
     script_args = sys.argv[sys.argv.index("--") + 1 :]
-    inputfile = script_args[0]
-    outputfile = script_args[1]
-    if not os.path.exists(inputfile):
-        print(f"Input file '{inputfile}' does not exists")
-        quit(1)
-    if not outputfile.endswith(".glb"):
-        print(f"Output file '{outputfile}' is not a *.glb file")
+    for i in range(0, len(script_args), 2):
+        inputfile = script_args[i]
+        outputfile = script_args[i + 1]
+        if not os.path.exists(inputfile):
+            print(f"Input file '{inputfile}' does not exists")
+            quit(1)
+        if not outputfile.endswith(".glb"):
+            print(f"Output file '{outputfile}' is not a *.glb file")
+            quit(1)
 
-    bpy.ops.wm.open_mainfile(filepath=inputfile)
-    bpy.ops.export_scene.gltf(filepath=outputfile[:-4], export_apply=True)
+        bpy.ops.wm.open_mainfile(filepath=inputfile)
+        bpy.ops.export_scene.gltf(filepath=outputfile[:-4], export_apply=True)
 
 
 if __name__ == "__main__":