# HG changeset patch # User Sam # Date 1701791192 -25200 # Node ID ae8a6c6ff4681766455cbc9846257494ab029a79 # Parent 405bb1fb52b89427ed16f04ed340d531edc7f798 add: importer-script for blender diff -r 405bb1fb52b8 -r ae8a6c6ff468 scripts/blender_gltf_converter.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/blender_gltf_converter.py Tue Dec 05 22:46:32 2023 +0700 @@ -0,0 +1,24 @@ +import os +import sys + +import bpy + + +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") + + bpy.ops.wm.open_mainfile(filepath=inputfile) + bpy.ops.export_scene.gltf(filepath=outputfile[:-4], export_apply=True) + + +if __name__ == "__main__": + runner()