Skip to content

Instantly share code, notes, and snippets.

@Besjan
Created March 31, 2023 07:47
Show Gist options
  • Save Besjan/63d9bc7b4ee36bd051706e0728459bbb to your computer and use it in GitHub Desktop.
Save Besjan/63d9bc7b4ee36bd051706e0728459bbb to your computer and use it in GitHub Desktop.
import bpy
import os
import sys
# set input and output file paths
input_file = sys.argv[-2]
output_file = sys.argv[-1]
# Delete the default cube, camera, and light
bpy.ops.object.select_all(action="SELECT")
bpy.ops.object.delete()
# import DAE file
bpy.ops.wm.collada_import(filepath=input_file)
# export GLB file with Draco compression
bpy.ops.export_scene.gltf(
filepath=output_file,
export_format="GLB",
export_draco_mesh_compression_enable=True,
export_draco_mesh_compression_level=6,
export_draco_position_quantization=14,
export_draco_normal_quantization=10,
export_draco_texcoord_quantization=12,
export_draco_color_quantization=10,
export_draco_generic_quantization=12,
)
# exit Blender
os._exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment