40 lines
1.3 KiB
Python
40 lines
1.3 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)
|
|
if basedir is not '':
|
|
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.glb(filepath=args.output,
|
|
# Embedding
|
|
export_copyright="Zenly",
|
|
# Nodes
|
|
export_selected=False,
|
|
export_layers=True,
|
|
export_extras=True,
|
|
# Mesh
|
|
export_apply=True,
|
|
# 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)
|