Created
May 31, 2023 05:07
-
-
Save rohanpsingh/b2dc85e253a0322ff5878269194bf611 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Example command-line usage: $ for i in *.dae; do echo $i; blender -b --python convert.py -- $i ${i%.dae}.obj; done | |
## Need to be careful about face normals direction of exported object | |
import bpy | |
import sys | |
argv = sys.argv | |
argv = argv[argv.index("--") + 1:] # get all args after "--" | |
dae_in = argv[0] | |
obj_out = argv[1] | |
while bpy.data.objects: | |
bpy.data.objects.remove(bpy.data.objects[0], do_unlink=True) | |
bpy.ops.wm.collada_import(filepath=dae_in) | |
bpy.ops.export_scene.obj(filepath=obj_out, axis_forward='Y', axis_up='Z', use_materials=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment