Files
godot-tests/tests/blend_export/blend/blender-export.py
K. S. Ernest (iFire) Lee 8498629b1a Add export blend script.
2020-09-27 12:20:21 -07:00

30 lines
961 B
Python

# blender --background --python .\blender-export.py
import bpy
import posixpath
import shutil
blend = "32678-respect-import-hints-with-empty"
bpy.ops.wm.open_mainfile(filepath=blend + ".blend")
export_type = "gltf"
shutil.rmtree("../" + export_type, ignore_errors=True)
posixpath.os.mkdir("../" + export_type, mode=0o777)
bpy.ops.export_scene.gltf(
filepath="../" + export_type + "/" + blend + ".gltf",
export_format="GLTF_SEPARATE",
export_copyright="The MIT License (MIT) Copyright (c) 2016 Godot Engine",
)
export_type = "obj"
shutil.rmtree("../" + export_type, ignore_errors=True)
posixpath.os.mkdir("../" + export_type, mode=0o777)
bpy.ops.export_scene.obj(filepath="../" + export_type + "/" + blend + "." + export_type)
export_type = "fbx"
shutil.rmtree("../" + export_type, ignore_errors=True)
posixpath.os.mkdir("../" + export_type, mode=0o777)
bpy.ops.export_scene.fbx(filepath="../" + export_type + "/" + blend + "." + export_type)