Skip to content

Instantly share code, notes, and snippets.

@AngryLoki
Created September 28, 2012 15:42
Show Gist options
  • Save AngryLoki/3800594 to your computer and use it in GitHub Desktop.
Save AngryLoki/3800594 to your computer and use it in GitHub Desktop.
Obj to dae Blender
# simple script to batch convert collada to obj.
# run as:
# blender --background --python dae2obj.py -- input_dir output_dir
import os
import sys
import glob
import bpy
if len(sys.argv) != 7:
print("Must provide input and output path")
else:
for infile in glob.glob(os.path.join(sys.argv[5], '*.dae')):
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
bpy.ops.wm.collada_import(filepath=infile)
outfilename = os.path.splitext(os.path.split(infile)[1])[0] + ".obj"
bpy.ops.export_scene.obj(filepath=os.path.join(sys.argv[6], outfilename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment