42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
import sys
|
|
import os
|
|
import argparse
|
|
import bpy
|
|
|
|
# get all args after "--"
|
|
argv = sys.argv
|
|
argv = argv[argv.index("--") + 1:]
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-o','--output')
|
|
|
|
args = parser.parse_args(argv)
|
|
basedir = os.path.dirname(args.output)
|
|
os.makedirs(basedir, exist_ok=True)
|
|
|
|
# You can read the documentation at:
|
|
# https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/docs/user.md
|
|
bpy.ops.export_scene.gltf(filepath=args.output,
|
|
# Embedding
|
|
export_copyright="Zenly",
|
|
export_embed_buffers=False, # leave binary data in .bin
|
|
export_embed_images=False,
|
|
export_strip=False, # JSON not striped
|
|
# Nodes
|
|
export_selected=False,
|
|
export_layers=True,
|
|
export_extras=True,
|
|
# Mesh
|
|
export_apply=False,
|
|
# Attributes
|
|
export_texcoords=True,
|
|
export_normals=True,
|
|
export_tangents=True,
|
|
export_colors=True,
|
|
# Objects
|
|
export_materials=True,
|
|
export_cameras=True,
|
|
export_camera_infinite=False,
|
|
# Animation
|
|
export_animations=True)
|